Description
Bugzilla Link | 13241 |
Version | trunk |
OS | All |
Blocks | llvm/llvm-bugzilla-archive#18926 |
CC | @rengolin |
Extended Description
The MCInst for the ARM ADR instruction as created by the MC assembler is re-encoded into an ADD/SUB instruction (Reproducers below)
It seems to me that there has been some re-engineering of the ADD/SUB instructions and the ADR instruction has not been taken into account in this.
Reproduce with:
(A1 encoding)
echo 'ADR r0,#0x40000000' | ./llvm-oss/build-none/bin/llvm-mc -triple=armv7 -show-inst -show-encoding
.section __TEXT,__text,regular,pure_instructions
adr r0, #1073741824 @ encoding: [0x00,0x00,0x8f,0xe2]
@ <MCInst #30 ADR
@
@
@
@ >
echo 0x00 0x00 0x8f 0xe2 | ./llvm-oss/build-none/bin/llvm-mc -triple=armv7 -show-inst -show-encoding -disassemble
.section __TEXT,__text,regular,pure_instructions
add r0, pc, #0 @ encoding: [0x00,0x00,0x8f,0xe2]
@ <MCInst #24 ADDri
@
@
@
@
@
@ >
(A2 encoding)
echo 'ADR r0,#-0x0' | ./llvm-oss/build-none/bin/llvm-mc -triple=armv7 -show-inst -show-encoding
.section __TEXT,__text,regular,pure_instructions
adr r0, #-2147483648 @ encoding: [0x00,0x00,0x4f,0xe2]
@ <MCInst #30 ADR
@
@
@
@ >
echo 0x00 0x00 0x4f 0xe2 | ./llvm-oss/build-none/bin/llvm-mc -triple=armv7 -show-inst -show-encoding -disassemble
.section __TEXT,__text,regular,pure_instructions
sub r0, pc, #0 @ encoding: [0x00,0x00,0x4f,0xe2]
@ <MCInst #456 SUBri
@
@
@
@
@
@ >