user277465
user277465

Reputation:

ARM conditional instruction setting flags

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?

Upvotes: 0

Views: 942

Answers (2)

Erik Man
Erik Man

Reputation: 844

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

Upvotes: 3

TonyK
TonyK

Reputation: 17114

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

Upvotes: 1

Related Questions