[llvm] r353546 - [TargetLowering] Use ISD::FSHR in expandFixedPointMul
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 8 10:57:38 PST 2019
Author: rksimon
Date: Fri Feb 8 10:57:38 2019
New Revision: 353546
URL: http://llvm.org/viewvc/llvm-project?rev=353546&view=rev
Log:
[TargetLowering] Use ISD::FSHR in expandFixedPointMul
Replace OR(SHL,SRL) pattern with ISD::FSHR (legalization expands this later if necessary) - this helps with the scale == 0 'undefined' drop-through case that was discussed on D55720.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/trunk/test/CodeGen/X86/umul_fix.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=353546&r1=353545&r2=353546&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Feb 8 10:57:38 2019
@@ -5512,9 +5512,6 @@ TargetLowering::expandFixedPointMul(SDNo
// are scaled. The result is given to us in 2 halves, so we only want part of
// both in the result.
EVT ShiftTy = getShiftAmountTy(VT, DAG.getDataLayout());
- Lo = DAG.getNode(ISD::SRL, dl, VT, Lo, DAG.getConstant(Scale, dl, ShiftTy));
- Hi = DAG.getNode(
- ISD::SHL, dl, VT, Hi,
- DAG.getConstant(VT.getScalarSizeInBits() - Scale, dl, ShiftTy));
- return DAG.getNode(ISD::OR, dl, VT, Lo, Hi);
+ return DAG.getNode(ISD::FSHR, dl, VT, Hi, Lo,
+ DAG.getConstant(Scale, dl, ShiftTy));
}
Modified: llvm/trunk/test/CodeGen/X86/umul_fix.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/umul_fix.ll?rev=353546&r1=353545&r2=353546&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/umul_fix.ll (original)
+++ llvm/trunk/test/CodeGen/X86/umul_fix.ll Fri Feb 8 10:57:38 2019
@@ -104,16 +104,16 @@ define <4 x i32> @vec(<4 x i32> %x, <4 x
; X64: # %bb.0:
; X64-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
; X64-NEXT: pmuludq %xmm1, %xmm0
-; X64-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,3,2,3]
+; X64-NEXT: pshufd {{.*#+}} xmm3 = xmm0[0,2,2,3]
; X64-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
; X64-NEXT: pmuludq %xmm2, %xmm1
-; X64-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,3,2,3]
+; X64-NEXT: pshufd {{.*#+}} xmm2 = xmm1[0,2,2,3]
; X64-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
-; X64-NEXT: pslld $30, %xmm3
-; X64-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
-; X64-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
+; X64-NEXT: psrld $2, %xmm3
+; X64-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
+; X64-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
; X64-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
-; X64-NEXT: psrld $2, %xmm0
+; X64-NEXT: pslld $30, %xmm0
; X64-NEXT: por %xmm3, %xmm0
; X64-NEXT: retq
;
More information about the llvm-commits
mailing list