]> begriffs open source - cmsis/commit
IAR: RRX doesn't modify flags, but has flags as input
authorKevin Bracey <kevin.bracey@arm.com>
Wed, 9 Jan 2019 13:51:08 +0000 (15:51 +0200)
committerJonatan Antoni <jonatan.antoni@arm.com>
Tue, 30 Jul 2019 14:56:18 +0000 (16:56 +0200)
commit98ccf875ffdafc6bfa7cab91032aba095763526f
tree881af0b64664acb3ed7be572f59976ec9fcef7bf
parentdb746d66cda089f1f5acd86a07b4f469bc6f2aad
IAR: RRX doesn't modify flags, but has flags as input

IAR assembler version of RRX had a "cc" clobber for RRX, but this is
unneeded - it doesn't modify the condition codes - it's not "RRXS".

Instead the assembler should have a volatile, as already seen in GCC and Clang
versions to reflect the CC input to the instruction.

CMSIS intrinsics use "volatile" attributes to force ordering of
instructions that work on the PSR, either input or output.

A "cc" clobber does not have that effect, at least in gcc; it only
indicates "changes condition codes", not "reads condition codes", so
CC-clobbering instructions can be reordered. This reflects that in
general the compilers make no guarantees about preserving flag state
between assembler sequences, meaning that __RRX will always be prone to
unreliability.

But the volatile marker increases the chances of stuff coming out in the
right order.
CMSIS/Core/Include/cmsis_iccarm.h