2.6.4.8.4 Condition Flags

These instructions do not change the flags.

Examples

MOV R1, #0x1        ; Initialize the ‘lock taken’ value
try
     LDREX R0, [LockAddr]         ; Load the lock value
     CMP R0, #0                   ; Is the lock free?
     ITT EQ                       ; IT instruction for STREXEQ and CMPEQ
     STREXEQ R0, R1, [LockAddr]   ; Try and claim the lock
     CMPEQ R0, #0                 ; Did this succeed?
     BNE try                      ; No – try again
      ....                        ; Yes – we have the lock.