diff options
author | Owen Anderson <resistor@mac.com> | 2010-12-09 00:27:41 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-12-09 00:27:41 +0000 |
commit | fb20d890756b75d6ccfa7ab17f170a877d425dc6 (patch) | |
tree | 974d304ad5a0ff00a95ae36abfdc431ee3caac94 /lib/Target/ARM/ARMAsmBackend.cpp | |
parent | 2871768f4031b2a17a639caee68f693214c030f2 (diff) |
Fix Thumb2 BCC encoding and fixups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121329 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMAsmBackend.cpp')
-rw-r--r-- | lib/Target/ARM/ARMAsmBackend.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMAsmBackend.cpp b/lib/Target/ARM/ARMAsmBackend.cpp index 1754870b95..00cd4e79de 100644 --- a/lib/Target/ARM/ARMAsmBackend.cpp +++ b/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; |