summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-01-19 01:50:30 +0000
committerJim Grosbach <grosbach@apple.com>2012-01-19 01:50:30 +0000
commitb008df40d3549249cd65ea08b4d915ee3b0bd126 (patch)
tree3cc1913e7b02e6ba9611ac59ab1fcbfd0ebd78c7
parent29ecaa944db8c99fcbeae02312b6ea9c8f0e3916 (diff)
downloadbcm5719-llvm-b008df40d3549249cd65ea08b4d915ee3b0bd126.tar.gz
bcm5719-llvm-b008df40d3549249cd65ea08b4d915ee3b0bd126.zip
Add comment and fix range check in condition.
llvm-svn: 148455
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
index adedc208d0e..2a8f7c6dc4e 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
@@ -180,8 +180,10 @@ bool ARMAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
return Offset > 254 || Offset < -256;
}
case ARM::fixup_arm_thumb_cp: {
+ // If the immediate is negative, greater than 1020, or not a multiple
+ // of four, the wide version of the instruction must be used.
int64_t Offset = int64_t(Value) - 4;
- return Offset > 4095 || Offset < 0;
+ return Offset > 1020 || Offset < 0 || Offset & 3;
}
}
llvm_unreachable("Invalid switch/cash!?");
OpenPOWER on IntegriCloud