diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-12-09 00:44:33 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-12-09 00:44:33 +0000 |
commit | 797b7aab35d815a48f58ce7f7b0b8d0fe06c92af (patch) | |
tree | 7c72b0a7e1e2e961aa2a49d9e0e6bf4944f33705 /lib | |
parent | 09aa3f0ef35d9241c92439d74b8d5e9a81d814c2 (diff) | |
download | external_llvm-797b7aab35d815a48f58ce7f7b0b8d0fe06c92af.zip external_llvm-797b7aab35d815a48f58ce7f7b0b8d0fe06c92af.tar.gz external_llvm-797b7aab35d815a48f58ce7f7b0b8d0fe06c92af.tar.bz2 |
Attempt to make the bit-twiddling readable resulted in the binary value being
overwritten.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMAsmBackend.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Target/ARM/ARMAsmBackend.cpp b/lib/Target/ARM/ARMAsmBackend.cpp index 8e809f0..581ac91 100644 --- a/lib/Target/ARM/ARMAsmBackend.cpp +++ b/lib/Target/ARM/ARMAsmBackend.cpp @@ -152,10 +152,11 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) { // Note that the halfwords are stored high first, low second; so we need // to transpose the fixup value here to map properly. unsigned isNeg = (int64_t(Value) < 0) ? 1 : 0; - uint32_t Binary = 0x3fffff & ((Value - 4) >> 1); - Binary = (Binary & 0x7ff) << 16; // Low imm11 value. - Binary |= (Binary & 0x1ffc00) >> 11; // High imm10 value. - Binary |= isNeg << 10; // Sign bit. + uint32_t Binary = 0; + Value = 0x3fffff & ((Value - 4) >> 1); + Binary = (Value & 0x7ff) << 16; // Low imm11 value. + Binary |= (Value & 0x1ffc00) >> 11; // High imm10 value. + Binary |= isNeg << 10; // Sign bit. return Binary; } case ARM::fixup_arm_thumb_blx: { @@ -169,10 +170,11 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) { // Note that the halfwords are stored high first, low second; so we need // to transpose the fixup value here to map properly. unsigned isNeg = (int64_t(Value) < 0) ? 1 : 0; - uint32_t Binary = 0xfffff & ((Value - 2) >> 2); - Binary = (Binary & 0x3ff) << 17; // Low imm10L value. - Binary |= (Binary & 0xffc00) >> 10; // High imm10H value. - Binary |= isNeg << 10; // Sign bit. + uint32_t Binary = 0; + Value = 0xfffff & ((Value - 2) >> 2); + Binary = (Value & 0x3ff) << 17; // Low imm10L value. + Binary |= (Value & 0xffc00) >> 10; // High imm10H value. + Binary |= isNeg << 10; // Sign bit. return Binary; } case ARM::fixup_arm_thumb_cp: |