[llvm] r345484 - [X86] Recognize constant splats in LowerFCOPYSIGN.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 28 16:51:35 PDT 2018


Author: ctopper
Date: Sun Oct 28 16:51:35 2018
New Revision: 345484

URL: http://llvm.org/viewvc/llvm-project?rev=345484&view=rev
Log:
[X86] Recognize constant splats in LowerFCOPYSIGN.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
    llvm/trunk/test/CodeGen/X86/sse1-fcopysign.ll

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=345484&r1=345483&r2=345484&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Oct 28 16:51:35 2018
@@ -18060,7 +18060,7 @@ static SDValue LowerFCOPYSIGN(SDValue Op
   // TODO: If we had general constant folding for FP logic ops, this check
   // wouldn't be necessary.
   SDValue MagBits;
-  if (ConstantFPSDNode *Op0CN = dyn_cast<ConstantFPSDNode>(Mag)) {
+  if (ConstantFPSDNode *Op0CN = isConstOrConstSplatFP(Mag)) {
     APFloat APF = Op0CN->getValueAPF();
     APF.clearSign();
     MagBits = DAG.getConstantFP(APF, dl, LogicVT);

Modified: llvm/trunk/test/CodeGen/X86/sse1-fcopysign.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse1-fcopysign.ll?rev=345484&r1=345483&r2=345484&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/sse1-fcopysign.ll (original)
+++ llvm/trunk/test/CodeGen/X86/sse1-fcopysign.ll Sun Oct 28 16:51:35 2018
@@ -71,18 +71,16 @@ define <4 x float> @v4f32_neg(<4 x float
 define <4 x float> @v4f32_const_mag(<4 x float> %a, <4 x float> %b) nounwind {
 ; X86-LABEL: v4f32_const_mag:
 ; X86:       # %bb.0:
-; X86-NEXT:    andps {{\.LCPI.*}}, %xmm1
-; X86-NEXT:    movaps {{.*#+}} xmm0 = [1,1,1,1]
+; X86-NEXT:    movaps %xmm1, %xmm0
 ; X86-NEXT:    andps {{\.LCPI.*}}, %xmm0
-; X86-NEXT:    orps %xmm1, %xmm0
+; X86-NEXT:    orps {{\.LCPI.*}}, %xmm0
 ; X86-NEXT:    retl
 ;
 ; X64-LABEL: v4f32_const_mag:
 ; X64:       # %bb.0:
-; X64-NEXT:    andps {{.*}}(%rip), %xmm1
-; X64-NEXT:    movaps {{.*#+}} xmm0 = [1,1,1,1]
+; X64-NEXT:    movaps %xmm1, %xmm0
 ; X64-NEXT:    andps {{.*}}(%rip), %xmm0
-; X64-NEXT:    orps %xmm1, %xmm0
+; X64-NEXT:    orps {{.*}}(%rip), %xmm0
 ; X64-NEXT:    retq
   %tmp = tail call <4 x float> @llvm.copysign.v4f32(<4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>, <4 x float> %b )
   ret <4 x float> %tmp




More information about the llvm-commits mailing list