[llvm-commits] [llvm] r58874 - /llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Dale Johannesen dalej at apple.com
Fri Nov 7 16:01:16 PST 2008


Author: johannes
Date: Fri Nov  7 18:01:16 2008
New Revision: 58874

URL: http://llvm.org/viewvc/llvm-project?rev=58874&view=rev
Log:
Make testb optimization work on big-endian targets.


Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=58874&r1=58873&r2=58874&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Nov  7 18:01:16 2008
@@ -1370,7 +1370,10 @@
             uint64_t newMask = (1ULL << width) - 1;
             for (unsigned offset=0; offset<origWidth/width; offset++) {
               if ((newMask & Mask)==Mask) {
-                bestOffset = (uint64_t)offset * (width/8);
+                if (!TD->isLittleEndian())
+                  bestOffset = (origWidth/width - offset - 1) * (width/8);
+                else 
+                  bestOffset = (uint64_t)offset * (width/8);
                 bestWidth = width;
                 break;
               }





More information about the llvm-commits mailing list