In ARM assembly, the Zero flag (Z) is set when the result of an operation is zero. Which conditional branch instruction will execute if the Zero flag is set?
Think about what the Zero flag indicates about the last comparison or arithmetic operation.
The Zero flag is set when the result is zero, which usually means two values compared are equal. The BEQ instruction branches when Z=1, so it executes if the Zero flag is set.
Which ARM conditional branch instruction will execute if the Negative flag (N) is set and the Overflow flag (V) is clear?
Consider the signed comparison rules using N and V flags.
BLT branches when N != V, meaning the Negative flag is set and Overflow is clear (or vice versa). This indicates a less-than condition in signed comparisons.
Given the flags after a comparison: N=0, Z=0, C=1, V=0, which conditional branch instruction will execute?
Check the meaning of the Carry and Zero flags for unsigned comparisons.
BHI branches when C=1 and Z=0, meaning the first value is higher than the second in unsigned comparison. Here, C=1 and Z=0, so BHI executes.
Which ARM conditional branch instruction is used for signed greater than comparison?
Signed comparisons use the Negative and Overflow flags differently than unsigned.
BGT branches when Z=0 and N=V, indicating a signed greater than condition. BHI is for unsigned comparisons.
After a subtraction operation, the flags are: N=1, Z=0, C=0, V=1. Which conditional branch instruction will execute?
Analyze the signed comparison conditions using N and V flags.
BLT branches when N != V. Here, N=1 and V=1, so N != V is false, so BLT does not execute. BGE branches when N equals V, which is true here, so BGE executes.