[llvm-branch-commits] [llvm-branch] r99925 - in /llvm/branches/Apple/Morbo: ./ include/llvm/IntrinsicsX86.td lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrSSE.td lib/Transforms/IPO/ArgumentPromotion.cpp lib/Transforms/IPO/FunctionAttrs.cpp lib/VMCore/AutoUpgrade.cpp test/Bitcode/sse41_pmulld.ll test/Bitcode/sse41_pmulld.ll.bc test/CodeGen/X86/pmul.ll test/CodeGen/X86/pmulld.ll

Eric Christopher echristo at apple.com
Tue Mar 30 13:45:16 PDT 2010


Author: echristo
Date: Tue Mar 30 15:45:16 2010
New Revision: 99925

URL: http://llvm.org/viewvc/llvm-project?rev=99925&view=rev
Log:
Merge 99699 and 99910 from mainline.

Partial fix for rdar://7661702.

Added:
    llvm/branches/Apple/Morbo/test/Bitcode/sse41_pmulld.ll
      - copied unchanged from r99910, llvm/trunk/test/Bitcode/sse41_pmulld.ll
    llvm/branches/Apple/Morbo/test/Bitcode/sse41_pmulld.ll.bc
      - copied unchanged from r99910, llvm/trunk/test/Bitcode/sse41_pmulld.ll.bc
    llvm/branches/Apple/Morbo/test/CodeGen/X86/pmulld.ll
      - copied unchanged from r99910, llvm/trunk/test/CodeGen/X86/pmulld.ll
Modified:
    llvm/branches/Apple/Morbo/   (props changed)
    llvm/branches/Apple/Morbo/include/llvm/IntrinsicsX86.td
    llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrSSE.td
    llvm/branches/Apple/Morbo/lib/Transforms/IPO/ArgumentPromotion.cpp
    llvm/branches/Apple/Morbo/lib/Transforms/IPO/FunctionAttrs.cpp   (props changed)
    llvm/branches/Apple/Morbo/lib/VMCore/AutoUpgrade.cpp
    llvm/branches/Apple/Morbo/test/CodeGen/X86/pmul.ll

Propchange: llvm/branches/Apple/Morbo/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 30 15:45:16 2010
@@ -1,2 +1,2 @@
 /llvm/branches/Apple/Hermes:96832,96835,96858,96870,96876,96879
-/llvm/trunk:98602,98604,98612,98615-98616,98675,98686,98743-98744,98773,98778,98780,98810,98835,98839,98845,98855,98862,98881,98920,98977,99032-99033,99043,99223,99263,99282-99284,99306,99319-99321,99324,99336,99378,99418,99423,99429,99455,99463,99465,99469,99484,99490,99492-99494,99537,99539,99544,99570,99575,99629-99630,99671,99692,99695,99697,99722,99846,99850
+/llvm/trunk:98602,98604,98612,98615-98616,98675,98686,98743-98744,98773,98778,98780,98810,98835,98839,98845,98855,98862,98881,98920,98977,99032-99033,99043,99223,99263,99282-99284,99306,99319-99321,99324,99336,99378,99418,99423,99429,99455,99463,99465,99469,99484,99490,99492-99494,99537,99539,99544,99570,99575,99629-99630,99671,99692,99695,99697,99699,99722,99846,99850,99910

Modified: llvm/branches/Apple/Morbo/include/llvm/IntrinsicsX86.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/include/llvm/IntrinsicsX86.td?rev=99925&r1=99924&r2=99925&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/include/llvm/IntrinsicsX86.td (original)
+++ llvm/branches/Apple/Morbo/include/llvm/IntrinsicsX86.td Tue Mar 30 15:45:16 2010
@@ -791,9 +791,6 @@
   def int_x86_sse41_pmuldq          : GCCBuiltin<"__builtin_ia32_pmuldq128">,
               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
                         [IntrNoMem, Commutative]>;
-  def int_x86_sse41_pmulld          : GCCBuiltin<"__builtin_ia32_pmulld128">,
-              Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
-                        [IntrNoMem, Commutative]>;
 }
 
 // Vector extract

Modified: llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrInfo.cpp?rev=99925&r1=99924&r2=99925&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrInfo.cpp Tue Mar 30 15:45:16 2010
@@ -597,7 +597,6 @@
     { X86::PMULHUWrr,       X86::PMULHUWrm, 16 },
     { X86::PMULHWrr,        X86::PMULHWrm, 16 },
     { X86::PMULLDrr,        X86::PMULLDrm, 16 },
-    { X86::PMULLDrr_int,    X86::PMULLDrm_int, 16 },
     { X86::PMULLWrr,        X86::PMULLWrm, 16 },
     { X86::PMULUDQrr,       X86::PMULUDQrm, 16 },
     { X86::PORrr,           X86::PORrm, 16 },

Modified: llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrSSE.td?rev=99925&r1=99924&r2=99925&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/branches/Apple/Morbo/lib/Target/X86/X86InstrSSE.td Tue Mar 30 15:45:16 2010
@@ -3443,8 +3443,28 @@
                        OpSize;
   }
 }
-defm PMULLD       : SS41I_binop_patint<0x40, "pmulld", v4i32, mul,
-                                       int_x86_sse41_pmulld, 1>;
+
+/// SS48I_binop_rm - Simple SSE41 binary operator.
+let Constraints = "$src1 = $dst" in {
+multiclass SS48I_binop_rm<bits<8> opc, string OpcodeStr, SDNode OpNode,
+                        ValueType OpVT, bit Commutable = 0> {
+  def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), 
+                                 (ins VR128:$src1, VR128:$src2),
+               !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"),
+               [(set VR128:$dst, (OpVT (OpNode VR128:$src1, VR128:$src2)))]>,
+               OpSize {
+    let isCommutable = Commutable;
+  }
+  def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), 
+                                 (ins VR128:$src1, i128mem:$src2),
+               !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"),
+               [(set VR128:$dst, (OpNode VR128:$src1,
+                                  (bc_v4i32 (memopv2i64 addr:$src2))))]>,
+               OpSize;
+}
+}
+
+defm PMULLD         : SS48I_binop_rm<0x40, "pmulld", mul, v4i32, 1>;
 
 /// SS41I_binop_rmi_int - SSE 4.1 binary operator with 8-bit immediate
 let Constraints = "$src1 = $dst" in {

Modified: llvm/branches/Apple/Morbo/lib/Transforms/IPO/ArgumentPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=99925&r1=99924&r2=99925&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Transforms/IPO/ArgumentPromotion.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Transforms/IPO/ArgumentPromotion.cpp Tue Mar 30 15:45:16 2010
@@ -686,7 +686,11 @@
             Ops.clear();
             AA.copyValue(OrigLoad->getOperand(0), V);
           }
-          Args.push_back(new LoadInst(V, V->getName()+".val", Call));
+          // Since we're replacing a load make sure we take the alignment
+          // of the previous load.
+          LoadInst *newLoad = new LoadInst(V, V->getName()+".val", Call);
+          newLoad->setAlignment(OrigLoad->getAlignment());
+          Args.push_back(newLoad);
           AA.copyValue(OrigLoad, Args.back());
         }
       }

Propchange: llvm/branches/Apple/Morbo/lib/Transforms/IPO/FunctionAttrs.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 30 15:45:16 2010
@@ -1 +1 @@
-/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp:99492,99539,99836,99846,99850
+/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp:99492,99539,99699,99836,99846,99850,99910

Modified: llvm/branches/Apple/Morbo/lib/VMCore/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/VMCore/AutoUpgrade.cpp?rev=99925&r1=99924&r2=99925&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/VMCore/AutoUpgrade.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/VMCore/AutoUpgrade.cpp Tue Mar 30 15:45:16 2010
@@ -225,7 +225,12 @@
       // Calls to these intrinsics are transformed into ShuffleVector's.
       NewFn = 0;
       return true;
+    } else if (Name.compare(5, 16, "x86.sse41.pmulld", 16) == 0) {
+      // Calls to these intrinsics are transformed into vector multiplies.
+      NewFn = 0;
+      return true;
     }
+    
 
     break;
   }
@@ -355,6 +360,18 @@
       
       //  Clean up the old call now that it has been completely upgraded.
       CI->eraseFromParent();
+    } else if (F->getName() == "llvm.x86.sse41.pmulld") {
+      // Upgrade this set of intrinsics into vector multiplies.
+      Instruction *Mul = BinaryOperator::CreateMul(CI->getOperand(1),
+                                                   CI->getOperand(2),
+                                                   CI->getName(),
+                                                   CI);
+      // Fix up all the uses with our new multiply.
+      if (!CI->use_empty())
+        CI->replaceAllUsesWith(Mul);
+        
+      // Remove upgraded multiply.
+      CI->eraseFromParent();
     } else {
       llvm_unreachable("Unknown function for CallInst upgrade.");
     }

Modified: llvm/branches/Apple/Morbo/test/CodeGen/X86/pmul.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/test/CodeGen/X86/pmul.ll?rev=99925&r1=99924&r2=99925&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/test/CodeGen/X86/pmul.ll (original)
+++ llvm/branches/Apple/Morbo/test/CodeGen/X86/pmul.ll Tue Mar 30 15:45:16 2010
@@ -1,6 +1,6 @@
 ; RUN: llc < %s -march=x86 -mattr=sse41 -stack-alignment=16 > %t
 ; RUN: grep pmul %t | count 12
-; RUN: grep mov %t | count 12
+; RUN: grep mov %t | count 11
 
 define <4 x i32> @a(<4 x i32> %i) nounwind  {
         %A = mul <4 x i32> %i, < i32 117, i32 117, i32 117, i32 117 >





More information about the llvm-branch-commits mailing list