summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-12-06 01:08:19 +0000
committerJim Grosbach <grosbach@apple.com>2011-12-06 01:08:19 +0000
commit9105085b4a332b7b96013936fba11a8a991daf87 (patch)
treee5f7c0cd11fb84a5fc43c7cee3ed6ee317347457 /llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
parent7d1c115d2e29bfaec54fcab9f32cb6f72eaf036d (diff)
downloadbcm5719-llvm-9105085b4a332b7b96013936fba11a8a991daf87.tar.gz
bcm5719-llvm-9105085b4a332b7b96013936fba11a8a991daf87.zip
Fix ARM handling of tBcc branch relaxation.
rdar://10069056 llvm-svn: 145885
Diffstat (limited to 'llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp')
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
index 59fae27a081..502a48b8bb2 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
@@ -146,11 +146,13 @@ bool ARMAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
uint64_t Value,
const MCInstFragment *DF,
const MCAsmLayout &Layout) const {
- // FIXME: This isn't correct for ARM. Just moving the "generic" logic
- // into the targets for now.
+ // Relaxing tBcc to t2Bcc. tBcc has a signed 9-bit displacement with the
+ // low bit being an implied zero. There's an implied +4 offset for the
+ // branch, so we adjust the other way here to determine what's
+ // encodable.
//
// Relax if the value is too big for a (signed) i8.
- return int64_t(Value) != int64_t(int8_t(Value));
+ return int64_t((Value - 4)>>1) != int64_t(int8_t((Value - 4)>>1));
}
void ARMAsmBackend::RelaxInstruction(const MCInst &Inst, MCInst &Res) const {
OpenPOWER on IntegriCloud