[PATCH] D41119: [X86][SSE] MOVMSK only uses the sign bit from each vector element
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 03:44:17 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL320570: [X86][SSE] MOVMSK only uses the sign bit from each vector element (authored by RKSimon, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D41119?vs=126567&id=126716#toc
Repository:
rL LLVM
https://reviews.llvm.org/D41119
Files:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/setcc-lowering.ll
Index: llvm/trunk/test/CodeGen/X86/setcc-lowering.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/setcc-lowering.ll
+++ llvm/trunk/test/CodeGen/X86/setcc-lowering.ll
@@ -57,7 +57,6 @@
; AVX-NEXT: vpand %xmm0, %xmm3, %xmm3
; AVX-NEXT: vpsllw $7, %xmm3, %xmm3
; AVX-NEXT: vpand %xmm2, %xmm3, %xmm3
-; AVX-NEXT: vpcmpgtb %xmm3, %xmm1, %xmm3
; AVX-NEXT: vpmovmskb %xmm3, %eax
; AVX-NEXT: testw %ax, %ax
; AVX-NEXT: jne .LBB1_1
Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
@@ -36147,6 +36147,27 @@
return SDValue();
}
+static SDValue combineMOVMSK(SDNode *N, SelectionDAG &DAG,
+ TargetLowering::DAGCombinerInfo &DCI) {
+ SDValue Src = N->getOperand(0);
+ MVT SrcVT = Src.getSimpleValueType();
+
+ const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+ TargetLowering::TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(),
+ !DCI.isBeforeLegalizeOps());
+
+ // MOVMSK only uses the MSB from each vector element.
+ KnownBits Known;
+ APInt DemandedMask(APInt::getSignMask(SrcVT.getScalarSizeInBits()));
+ if (TLI.SimplifyDemandedBits(Src, DemandedMask, Known, TLO)) {
+ DCI.AddToWorklist(Src.getNode());
+ DCI.CommitTargetLoweringOpt(TLO);
+ return SDValue(N, 0);
+ }
+
+ return SDValue();
+}
+
static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
TargetLowering::DAGCombinerInfo &DCI,
const X86Subtarget &Subtarget) {
@@ -37318,6 +37339,7 @@
case X86ISD::FMSUBADD_RND:
case X86ISD::FMADDSUB:
case X86ISD::FMSUBADD: return combineFMADDSUB(N, DAG, Subtarget);
+ case X86ISD::MOVMSK: return combineMOVMSK(N, DAG, DCI);
case X86ISD::MGATHER:
case X86ISD::MSCATTER:
case ISD::MGATHER:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41119.126716.patch
Type: text/x-patch
Size: 2042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171213/3921b8d2/attachment.bin>
More information about the llvm-commits
mailing list