mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-22 19:49:49 +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. llvm-svn: 176189
This commit is contained in:
parent
33d5dd0b08
commit
281992500a
@ -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