ARM conditional instruction setting flags

842 views Asked by At

As I read about conditional execution in ARM, I can see why instructions in ARM do not set the flags by default. They seem to set flags only when the S suffix is added in. I was wondering if it would be possible to have an ARM instruction that executes conditionally, but also sets flags. Could you give me an example for the same?

2

There are 2 answers

1
TonyK On BEST ANSWER

Every ARM instruction executes conditionally (unless the condition code is AL for always). Any condition code is allowed on any instruction.

0
Erik Man On

Yes it is possible to both execute conditionally and set the flags, for example

ADDSCS  r0, r1, r2    ; If C flag set then r0 = r1 + r2, and update flags