I've got the following ARM assembly code.
CMP R0, #0
ITT EQ
MOVEQ R0, #0x7FFFFFFF
BXEQ LR
Firstly, why is the EQ needed after the MOV and BX instructions? The ARM reference says that the condition (EQ) after the ITT will be applied to the first instruction (MOV) in the IT block and then because of the second T in ITT the EQ will be applied to the second instruction (BX) in the IT block. So if the ITT is applying the EQ, why is the EQ needed in MOVEQ and BXEQ?
Secondly, why is the IT instruction needed at all? Why not just have:
CMP R0, #0
MOVEQ R0, #0x7FFFFFFF
BXEQ LR
It's MOV not MOVS so the flags won't be updated and the EQ in BXEQ will still be "referring" to the flag values set by the CMP.