Question: Exercise 3: The following problems deal with translating from C to ARM. Assume that the variables g, h, I and j are given and could
Exercise 3: The following problems deal with translating from C to ARM. Assume that the variables g, h, I and j are given and could be considered 32-bit integers as declared in a C program. Assume that the variables f. g, h, i, and j (in C) are assigned to registers rO, r1, r2, r3, and r4, respectively. 1. (2 pts) For the C statement below, what is the corresponding ARM assembly code? Use a minimal number of ARM assembly instructions and do not modify the content of any register (r1-r4), but you can use additional registers if you need to. f(2 g + h) -4* j) - 10; 2. (2 pts) Using shift capabilities, how would you translate the C statement below (assume variable i contains a positive value)? Note: you may want to verify in AMin that your solution works... f = (1023*) / 4; @ initialization for i mov r3, #5 3. (2 pts) Would the shifting technique work also if the variable j contains a negative value? Why or why not
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
