ARM NEON assembler error: “instruction cannot be conditional”

牧云@^-^@ 提交于 2019-12-31 03:30:39

问题


According to the arm info center vadd can be executed condtitionally however when i try

vaddeq.f32 d0,d0,d1

Xcode returns

65:instruction cannot be conditional -- vaddeq.f32 d0,d0,d1

one thing i've noticed is that it seems to be only NEON instructions that give this error. VFP instructions don't produce these errors.

Is there a compiler flag I have to set in order to enable NEON conditional instructions?


回答1:


The ARM Architecture Reference Manual says:

 An ARM Advanced SIMD VADD instruction must be unconditional.

I.e., if you're in ARM mode, those instructions are not conditional. You can use them conditionally in Thumb-2 if you put them in an IT block.

  .syntax unified
  .code 16
  .globl _foo
_foo:
  cmp r0, #0
  it eq
  vaddeq.f32 d0, d0, d1
  bx lr



回答2:


The reason why conditional NEON instructions are not available in ARM mode is because they use encodings with the condition field set to NV (never). You need to use conditional branches or (better) rewrite the code to not use the comparison results directly - e.g. set a register to 0 or 1 depending on the result and use its value in further operations.




回答3:


Only instructions shared by NEON and VFP can be executed conditionally.

(vldmia for example.)

For me, there have been a few situations where conditional execution could have saved me from some minor headaches, but in general, you won't need it that badly.

Take a careful look at the NEON logical and compare operations. They very well indicate how NEON is supposed to be programmed.

cya.



来源:https://stackoverflow.com/questions/7004643/arm-neon-assembler-error-instruction-cannot-be-conditional

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!