如何将拇指条件指令放入 IT 块

How can I put thumb conditional instruction into IT block

我正在将一些继承的代码移植到我当前的平台上。编译的时候报了一些arm汇编代码的错误

消息显示:

| {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'

我是 arm 汇编程序的新手,所以我的问题是如何将以下代码制作成 IT 块。正如编译器所要求的那样。

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

谢谢

一个"IT block"指的是最多4条由一个IT ("If-Then") instruction条件化的指令。虽然那里有两个不同的条件,但它们在逻辑上是相反的,因此由于额外的 "Else" 编码,它们仍然可以被单个 IT 覆盖。一个 ne 条件后跟两个 eq 条件,继续它们的适当指令是 (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