Bird
0
0

Which conditional branch instructions should you use after SUBS R5, R6, R7?

hard📝 Application Q15 of 15
ARM Architecture - Control Flow Instructions
You want to write ARM assembly code that jumps to handle_negative if a subtraction results in a negative value, and to handle_zero if the result is zero. Which conditional branch instructions should you use after SUBS R5, R6, R7?
ABGT handle_negative and BNE handle_zero
BBLT handle_negative and BEQ handle_zero
CBLE handle_negative and BNE handle_zero
DBHS handle_negative and BLO handle_zero
Step-by-Step Solution
Solution:
  1. Step 1: Understand SUBS and flag updates

    SUBS subtracts and updates flags including negative (N) and zero (Z).
  2. Step 2: Match flags to branch instructions

    BLT branches if negative flag set (result negative), BEQ branches if zero flag set (result zero).
  3. Step 3: Confirm correct instructions for conditions

    BLT for negative result and BEQ for zero result are the correct choices.
  4. Final Answer:

    BLT handle_negative and BEQ handle_zero -> Option B
  5. Quick Check:

    Negative uses BLT, zero uses BEQ [OK]
Quick Trick: Use BLT for negative, BEQ for zero after SUBS [OK]
Common Mistakes:
  • Using BGT or BHS for negative values
  • Mixing zero and negative flag conditions
  • Using unsigned branch instructions incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes