Bird
0
0

What is wrong with this ARM code snippet?

medium📝 Analysis Q7 of 15
ARM Architecture - Control Flow Instructions
What is wrong with this ARM code snippet?
BL subroutine
MOV R0, #3
subroutine:
MOV R0, #4
BX R14
ABL cannot be used before MOV instructions
BBX R14 should be BX LR for clarity
CBX R14 is correct to return from subroutine
DMOV R0, #3 should be after subroutine
Step-by-Step Solution
Solution:
  1. Step 1: Understand BX instruction

    BX R14 is functionally correct since LR is R14, but using BX LR is clearer and standard.
  2. Step 2: Identify best practice

    Using BX LR improves readability and avoids confusion.
  3. Final Answer:

    BX R14 should be BX LR for clarity -> Option B
  4. Quick Check:

    Use BX LR instead of BX R14 for clarity [OK]
Quick Trick: Use BX LR (not BX R14) for clearer return [OK]
Common Mistakes:
  • Thinking BX R14 is incorrect syntax
  • Ignoring best practice for readability
  • Assuming MOV order is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes