Bird
0
0

What will be the effect of this Thumb-2 code?

medium📝 Analysis Q5 of 15
ARM Architecture - Control Flow Instructions
What will be the effect of this Thumb-2 code?
IT GT
MOVGT R4, #10
MOVLE R5, #20

If the signed comparison sets the greater-than flag?
AR5 is set to 20, R4 is unchanged
BR4 is set to 10, R5 is unchanged
CBoth R4 and R5 are set
DNeither R4 nor R5 is set
Step-by-Step Solution
Solution:
  1. Step 1: Interpret IT GT

    IT GT means the following instructions execute if greater-than condition is true.
  2. Step 2: Check instructions conditions

    MOVGT R4 executes if GT is true; MOVLE R5 executes if less or equal (LE) is true.
  3. Final Answer:

    R4 is set to 10, R5 is unchanged -> Option B
  4. Quick Check:

    GT true runs MOVGT only [OK]
Quick Trick: GT runs first instruction; LE runs second in IT block [OK]
Common Mistakes:
  • Assuming both instructions run simultaneously
  • Confusing GT and LE conditions
  • Ignoring IT block condition mask

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes