ARM アセンブラ If-Then コンパイルできず(涙)
Thumb-2 の If-Then 命令を試したくて下記のコードをコンパイルするも、オプションで Thum(-2)を指定するとエラーになります。
ファイル名:"it.s"
.text .global _start _start: mov r0, #0 cmp r0, #0 itte eq mvneq r1, r1 mvneq r2, r2 mvnne r3, r3 mov r0, #1 cmp r0, #0 itte eq mvneq r4, r4 mvneq r5, r5 mvnne r6, r6 mov r0, #0 mov r7, #1 svc #0
コンパイルはこんなかんじです
$ arm-xilinx-linux-gnueabi-as -g -march=armv7-a -mthumb -o it.o it.s it.s: Assembler messages: it.s:7: Error: Thumb does not support conditional execution it.s:8: Error: Thumb does not support conditional execution it.s:9: Error: Thumb does not support conditional execution it.s:11: Error: instruction not allowed in IT block -- `mov r0,#1' it.s:12: Error: instruction not allowed in IT block -- `cmp r0,#0' it.s:13: Error: IT falling in the range of a previous IT block -- `itte eq' it.s:14: Error: Thumb does not support conditional execution it.s:15: Error: Thumb does not support conditional execution it.s:16: Error: Thumb does not support conditional execution
ちなみに、"-mthumb" オプションを指定しなければ ARM 32ビットでコンパイルできて、objdump で確認すると IT命令は無視されています。
コンパイラオプションも調べましたが、アーキテクチャ ARMV7-A で Thumb を指定するのが Thumb-2 になるらしいのでこれであっているはずなのですが。。。
コンパイラオプションも調べましたが、アーキテクチャ ARMV7-A で Thumb を指定するのが Thumb-2 になるらしいのでこれであっているはずなのですが。。。
ねんのため、ツールバージョンはいつものこれ↓です。
$ arm-xilinx-linux-gnueabi-as --version GNU assembler (Sourcery CodeBench Lite 2013.05-40) 2.23.52.20130219 Copyright 2013 Free Software Foundation, Inc.