summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMAsmBackend.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-12-09 00:27:41 +0000
committerOwen Anderson <resistor@mac.com>2010-12-09 00:27:41 +0000
commit302d5fd0d870d9fc45816cc03d63d7fc75d06bf5 (patch)
tree295a099729b747a7025cfbee6625b72d32b37ca4 /llvm/lib/Target/ARM/ARMAsmBackend.cpp
parentc2dc95ae00e0972d673a1ed220a20038571259e4 (diff)
downloadbcm5719-llvm-302d5fd0d870d9fc45816cc03d63d7fc75d06bf5.tar.gz
bcm5719-llvm-302d5fd0d870d9fc45816cc03d63d7fc75d06bf5.zip
Fix Thumb2 BCC encoding and fixups.
llvm-svn: 121329
Diffstat (limited to 'llvm/lib/Target/ARM/ARMAsmBackend.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMAsmBackend.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/ARMAsmBackend.cpp
index 1754870b95c..00cd4e79de9 100644
--- a/llvm/lib/Target/ARM/ARMAsmBackend.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmBackend.cpp
@@ -127,6 +127,21 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) {
// These values don't encode the low two bits since they're always zero.
// Offset by 8 just as above.
return 0xffffff & ((Value - 8) >> 2);
+ case ARM::fixup_t2_branch: {
+ Value = Value - 6;
+ Value >>= 1; // Low bit is not encoded.
+
+ uint64_t out = 0;
+ Value |= (Value & 0x80000) << 7; // S bit
+ Value |= (Value & 0x40000) >> 7; // J2 bit
+ Value |= (Value & 0x20000) >> 4; // J1 bit
+ Value |= (Value & 0x1F800) << 5; // imm6 field
+ Value |= (Value & 0x007FF); // imm11 field
+
+ uint64_t swapped = (out & 0xFFFF0000) >> 16;
+ swapped |= (out & 0x0000FFFF) << 16;
+ return swapped;
+ }
case ARM::fixup_arm_thumb_bl: {
// The value doesn't encode the low bit (always zero) and is offset by
// four. The value is encoded into disjoint bit positions in the destination
@@ -273,6 +288,7 @@ static unsigned getFixupKindNumBytes(unsigned Kind) {
return 3;
case FK_Data_4:
+ case ARM::fixup_t2_branch:
case ARM::fixup_t2_pcrel_10:
case ARM::fixup_arm_thumb_bl:
return 4;
OpenPOWER on IntegriCloud