[llvm-commits] [llvm] r47431 - /llvm/trunk/lib/Target/X86/README.txt

Chris Lattner sabre at nondot.org
Wed Feb 20 22:51:30 PST 2008


Author: lattner
Date: Thu Feb 21 00:51:29 2008
New Revision: 47431

URL: http://llvm.org/viewvc/llvm-project?rev=47431&view=rev
Log:
Dan implemented one multiply issue.  Replace it with another. :)

Modified:
    llvm/trunk/lib/Target/X86/README.txt

Modified: llvm/trunk/lib/Target/X86/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=47431&r1=47430&r2=47431&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Thu Feb 21 00:51:29 2008
@@ -1392,23 +1392,44 @@
 
 //===---------------------------------------------------------------------===//
 
-We're missing an obvious fold of a load into imul:
+We're codegen'ing multiply of long longs inefficiently:
 
-int test(long a, long b) { return a * b; } 
+unsigned long long LLM(unsigned long long arg1, unsigned long long arg2) {
+  return arg1 *  arg2;
+}
 
-LLVM produces:
-_test:
-        movl    4(%esp), %ecx
-        movl    8(%esp), %eax
-        imull   %ecx, %eax
-        ret
+We compile to (fomit-frame-pointer):
 
-vs:
-_test:
-        movl    8(%esp), %eax
-        imull   4(%esp), %eax
+_LLM:
+	pushl	%esi
+	movl	8(%esp), %ecx
+	movl	16(%esp), %esi
+	movl	%esi, %eax
+	mull	%ecx
+	imull	12(%esp), %esi
+	addl	%edx, %esi
+	imull	20(%esp), %ecx
+	movl	%esi, %edx
+	addl	%ecx, %edx
+	popl	%esi
+	ret
+
+This looks like a scheduling deficiency and lack of remat of the load from
+the argument area.  ICC apparently produces:
+
+        movl      8(%esp), %ecx
+        imull     12(%esp), %ecx
+        movl      16(%esp), %eax
+        imull     4(%esp), %eax 
+        addl      %eax, %ecx  
+        movl      4(%esp), %eax
+        mull      12(%esp) 
+        addl      %ecx, %edx
         ret
 
+Note that it remat'd loads from 4(esp) and 12(esp).  See this GCC PR:
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17236
+
 //===---------------------------------------------------------------------===//
 
 We can fold a store into "zeroing a reg".  Instead of:





More information about the llvm-commits mailing list