[llvm] r188268 - Fix signed overflow in when computing encodings for ADR instructions
Mihai Popa
mihail.popa at gmail.com
Tue Aug 13 07:02:14 PDT 2013
Author: mpopa
Date: Tue Aug 13 09:02:13 2013
New Revision: 188268
URL: http://llvm.org/viewvc/llvm-project?rev=188268&view=rev
Log:
Fix signed overflow in when computing encodings for ADR instructions
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
llvm/trunk/test/MC/ARM/basic-arm-instructions.s
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp?rev=188268&r1=188267&r2=188268&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp Tue Aug 13 09:02:13 2013
@@ -671,7 +671,7 @@ getAdrLabelOpValue(const MCInst &MI, uns
if (MO.isExpr())
return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_adr_pcrel_12,
Fixups);
- int32_t offset = MO.getImm();
+ int64_t offset = MO.getImm();
uint32_t Val = 0x2000;
int SoImmVal;
Modified: llvm/trunk/test/MC/ARM/basic-arm-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/basic-arm-instructions.s?rev=188268&r1=188267&r2=188268&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/basic-arm-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/basic-arm-instructions.s Tue Aug 13 09:02:13 2013
@@ -153,7 +153,6 @@ Lforward:
@ CHECK: adr r1, #301989888 @ encoding: [0x12,0x14,0x8f,0xe2]
@ CHECK: adr r1, #-2147483647 @ encoding: [0x06,0x11,0x8f,0xe2]
-
@------------------------------------------------------------------------------
@ ADD
@------------------------------------------------------------------------------
@@ -187,6 +186,7 @@ Lforward:
add r0, #-4
add r4, r5, #-21
+ add r0, pc, #0xc0000000
@ CHECK: add r4, r5, #61440 @ encoding: [0x0f,0x4a,0x85,0xe2]
@ CHECK: add r4, r5, r6 @ encoding: [0x06,0x40,0x85,0xe0]
@@ -217,6 +217,7 @@ Lforward:
@ CHECK: sub r0, r0, #4 @ encoding: [0x04,0x00,0x40,0xe2]
@ CHECK: sub r4, r5, #21 @ encoding: [0x15,0x40,0x45,0xe2]
+@ CHECK: adr r0, #-1073741824 @ encoding: [0x03,0x01,0x8f,0xe2]
@ Test right shift by 32, which is encoded as 0
add r3, r1, r2, lsr #32
More information about the llvm-commits
mailing list