[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Jan 12 10:09:08 PST 2005



Changes in directory llvm/lib/Target/X86:

X86ISelPattern.cpp updated: 1.48 -> 1.49
---
Log message:

Try both ways to fold an add together.  This allows us to generate this code

        imul %EAX, %EAX, 400
        add %ECX, %EAX
        add %ESI, DWORD PTR [%ECX + 4*%EDX]
        inc %EDX
        cmp %EDX, 100

instead of this:

        imul %EAX, %EAX, 400
        add %ECX, %EAX
        mov %EAX, %EDX
        shl %EAX, 2
        add %ECX, %EAX
        add %ESI, DWORD PTR [%ECX]
        inc %EDX
        cmp %EDX, 100




---
Diffs of the changes:  (+4 -0)

Index: llvm/lib/Target/X86/X86ISelPattern.cpp
diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.48 llvm/lib/Target/X86/X86ISelPattern.cpp:1.49
--- llvm/lib/Target/X86/X86ISelPattern.cpp:1.48	Wed Jan 12 01:33:20 2005
+++ llvm/lib/Target/X86/X86ISelPattern.cpp	Wed Jan 12 12:08:53 2005
@@ -527,6 +527,10 @@
         !SelectAddress(N.Val->getOperand(1), AM))
       return false;
     AM = Backup;
+    if (!SelectAddress(N.Val->getOperand(1), AM) &&
+        !SelectAddress(N.Val->getOperand(0), AM))
+      return false;
+    AM = Backup;
     break;
   }
   }






More information about the llvm-commits mailing list