Alan
Alan

Reputation: 489

How can I put thumb conditional instruction into IT block

I'm porting some inherited codes to my current platform. When I compiling it, it reports some error about arm assembler codes.

The message shows:

| {standard input}:7236: Error: thumb conditional instruction should be in IT block -- `movne r0,r2'
| {standard input}:7237: Error: thumb conditional instruction should be in IT block -- `biceq r0,r0,#0xff'
| {standard input}:7238: Error: thumb conditional instruction should be in IT block -- `biceq r0,r0,#0xf00'

I'm a totally newbie to arm assembler, so my question is how to make below codes into IT block. Just as required by the compiler.

"movne   r0, r2;\n"
"biceq  r0, r0, #0xff;\n"
"biceq  r0, r0, #0xf00;"

Thanks

Upvotes: 3

Views: 5303

Answers (1)

Notlikethat
Notlikethat

Reputation: 20984

An "IT block" refers to up to 4 instructions made conditional by a single IT ("If-Then") instruction. Whilst you have two different conditions there, they are logical opposites so can still be covered by a single IT thanks to the additional "Else" encoding. With one ne conditional followed by two eq conditionals, the appropriate instruction to proceed them with would be (I for if, then T for then as movne, E for else as biceq and another E for else as another biceq):

ITEE   ne
movne  r0, r2
biceq  r0, r0, #0xff
biceq  r0, r0, #0xf00

Upvotes: 4

Related Questions