[llvm-commits] [llvm] r148455 - /llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp

Jim Grosbach grosbach at apple.com
Wed Jan 18 17:50:30 PST 2012


Author: grosbach
Date: Wed Jan 18 19:50:30 2012
New Revision: 148455

URL: http://llvm.org/viewvc/llvm-project?rev=148455&view=rev
Log:
Add comment and fix range check in condition.

Modified:
    llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=148455&r1=148454&r2=148455&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Wed Jan 18 19:50:30 2012
@@ -180,8 +180,10 @@
     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!?");





More information about the llvm-commits mailing list