Fix PR10422 by adding the necessary AVX UCOMISD memory versions to
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 22 Jul 2011 20:53:20 +0000 (20:53 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 22 Jul 2011 20:53:20 +0000 (20:53 +0000)
load folding logic

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135801 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp
test/CodeGen/X86/avx-cmp-fp.ll [new file with mode: 0644]

index 8dc682255de9c3bd08439999861fd29bc0884c5b..990ceef25ca0cb837463db1db97c756f919fb5c2 100644 (file)
@@ -407,6 +407,8 @@ X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
     { X86::Int_CVTTSS2SIrr, X86::Int_CVTTSS2SIrm, 0 },
     { X86::Int_UCOMISDrr,   X86::Int_UCOMISDrm, 0 },
     { X86::Int_UCOMISSrr,   X86::Int_UCOMISSrm, 0 },
+    { X86::Int_VUCOMISDrr,  X86::Int_VUCOMISDrm, 0 },
+    { X86::Int_VUCOMISSrr,  X86::Int_VUCOMISSrm, 0 },
     { X86::MOV16rr,         X86::MOV16rm, 0 },
     { X86::MOV32rr,         X86::MOV32rm, 0 },
     { X86::MOV64rr,         X86::MOV64rm, 0 },
@@ -467,7 +469,9 @@ X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
     { X86::TEST8rr,         X86::TEST8rm, 0 },
     // FIXME: TEST*rr EAX,EAX ---> CMP [mem], 0
     { X86::UCOMISDrr,       X86::UCOMISDrm, 0 },
-    { X86::UCOMISSrr,       X86::UCOMISSrm, 0 }
+    { X86::UCOMISSrr,       X86::UCOMISSrm, 0 },
+    { X86::VUCOMISDrr,      X86::VUCOMISDrm, 0 },
+    { X86::VUCOMISSrr,      X86::VUCOMISSrm, 0 }
   };
 
   for (unsigned i = 0, e = array_lengthof(OpTbl1); i != e; ++i) {
@@ -2491,7 +2495,9 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
   case X86::AVX_SET0PSY:
   case X86::AVX_SET0PDY:
   case X86::FsFLD0SD:
-  case X86::FsFLD0SS: {
+  case X86::FsFLD0SS:
+  case X86::VFsFLD0SD:
+  case X86::VFsFLD0SS: {
     // Folding a V_SET0P? or V_SETALLONES as a load, to ease register pressure.
     // Create a constant-pool entry and operands to load from it.
 
diff --git a/test/CodeGen/X86/avx-cmp-fp.ll b/test/CodeGen/X86/avx-cmp-fp.ll
new file mode 100644 (file)
index 0000000..18d381b
--- /dev/null
@@ -0,0 +1,28 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
+
+declare void @scale() nounwind uwtable
+
+; CHECK: vucomisd .LCPI
+define void @render() nounwind uwtable {
+entry:
+  br i1 undef, label %for.cond5, label %for.end52
+
+for.cond5:
+  %or.cond = and i1 undef, false
+  br i1 %or.cond, label %for.body33, label %for.cond5
+
+for.cond30:
+  br i1 false, label %for.body33, label %for.cond5
+
+for.body33:
+  %tobool = fcmp une double undef, 0.000000e+00
+  br i1 %tobool, label %if.then, label %for.cond30
+
+if.then:
+  call void @scale()
+  br label %for.cond30
+
+for.end52:
+  ret void
+}
+