mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
ARM: permit full range of valid ADR immediates.
This fixes an issue where trying to assemlbe valid ADR instructions would cause LLVM to hit a failed assertion. Patch by Keith Walker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2fe71f8f7e
commit
d65dfd8342
@ -655,15 +655,28 @@ getAdrLabelOpValue(const MCInst &MI, unsigned OpIdx,
|
||||
int32_t offset = MO.getImm();
|
||||
uint32_t Val = 0x2000;
|
||||
|
||||
int SoImmVal;
|
||||
if (offset == INT32_MIN) {
|
||||
Val = 0x1000;
|
||||
offset = 0;
|
||||
SoImmVal = 0;
|
||||
} else if (offset < 0) {
|
||||
Val = 0x1000;
|
||||
offset *= -1;
|
||||
SoImmVal = ARM_AM::getSOImmVal(offset);
|
||||
if(SoImmVal == -1) {
|
||||
Val = 0x2000;
|
||||
offset *= -1;
|
||||
SoImmVal = ARM_AM::getSOImmVal(offset);
|
||||
}
|
||||
} else {
|
||||
SoImmVal = ARM_AM::getSOImmVal(offset);
|
||||
if(SoImmVal == -1) {
|
||||
Val = 0x1000;
|
||||
offset *= -1;
|
||||
SoImmVal = ARM_AM::getSOImmVal(offset);
|
||||
}
|
||||
}
|
||||
|
||||
int SoImmVal = ARM_AM::getSOImmVal(offset);
|
||||
assert(SoImmVal != -1 && "Not a valid so_imm value!");
|
||||
|
||||
Val |= SoImmVal;
|
||||
|
@ -143,11 +143,15 @@ Lforward:
|
||||
|
||||
adr r1, #-0x0
|
||||
adr r1, #-0x12000000
|
||||
adr r1, #-0x80000001
|
||||
adr r1, #0x12000000
|
||||
adr r1, #0x80000001
|
||||
|
||||
@ CHECK: adr r1, #-0 @ encoding: [0x00,0x10,0x4f,0xe2]
|
||||
@ CHECK: adr r1, #-301989888 @ encoding: [0x12,0x14,0x4f,0xe2]
|
||||
@ CHECK: adr r1, #2147483647 @ encoding: [0x06,0x11,0x4f,0xe2]
|
||||
@ CHECK: adr r1, #301989888 @ encoding: [0x12,0x14,0x8f,0xe2]
|
||||
@ CHECK: adr r1, #-2147483647 @ encoding: [0x06,0x11,0x8f,0xe2]
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user