[PATCH] D66527: [X86][AVX] Add SimplifyDemandedVectorElts support for KSHIFTL/KSHIFTR
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 06:23:58 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370055: [X86][AVX] Add SimplifyDemandedVectorElts support for KSHIFTL/KSHIFTR (authored by RKSimon, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D66527?vs=216798&id=217386#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66527/new/
https://reviews.llvm.org/D66527
Files:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/prefer-avx256-mask-shuffle.ll
Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
@@ -34273,6 +34273,31 @@
// TODO convert SrcUndef to KnownUndef.
break;
}
+ case X86ISD::KSHIFTL:
+ case X86ISD::KSHIFTR: {
+ SDValue Src = Op.getOperand(0);
+ auto *Amt = cast<ConstantSDNode>(Op.getOperand(1));
+ assert(Amt->getAPIntValue().ult(NumElts) && "Out of range shift amount");
+ unsigned ShiftAmt = Amt->getZExtValue();
+ bool ShiftLeft = (X86ISD::KSHIFTL == Opc);
+
+ APInt DemandedSrc =
+ ShiftLeft ? DemandedElts.lshr(ShiftAmt) : DemandedElts.shl(ShiftAmt);
+ if (SimplifyDemandedVectorElts(Src, DemandedSrc, KnownUndef, KnownZero, TLO,
+ Depth + 1))
+ return true;
+
+ if (ShiftLeft) {
+ KnownUndef = KnownUndef.shl(ShiftAmt);
+ KnownZero = KnownZero.shl(ShiftAmt);
+ KnownZero.setLowBits(ShiftAmt);
+ } else {
+ KnownUndef = KnownUndef.lshr(ShiftAmt);
+ KnownZero = KnownZero.lshr(ShiftAmt);
+ KnownZero.setHighBits(ShiftAmt);
+ }
+ break;
+ }
case X86ISD::CVTSI2P:
case X86ISD::CVTUI2P: {
SDValue Src = Op.getOperand(0);
Index: llvm/trunk/test/CodeGen/X86/prefer-avx256-mask-shuffle.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/prefer-avx256-mask-shuffle.ll
+++ llvm/trunk/test/CodeGen/X86/prefer-avx256-mask-shuffle.ll
@@ -153,9 +153,7 @@
; AVX256VL-NEXT: vpshufb {{.*#+}} ymm1 = ymm1[6,7,12,13,u,u,8,9,6,7,14,15,14,15,0,1,22,23,28,29,18,19,26,27,22,23,u,u,30,31,16,17]
; AVX256VL-NEXT: vmovdqa32 %ymm0, %ymm2 {%k1} {z}
; AVX256VL-NEXT: vpmovdw %ymm2, %xmm2
-; AVX256VL-NEXT: kshiftrw $8, %k1, %k1
-; AVX256VL-NEXT: vmovdqa32 %ymm0, %ymm3 {%k1} {z}
-; AVX256VL-NEXT: vpmovdw %ymm3, %xmm3
+; AVX256VL-NEXT: vpcmpeqd %xmm3, %xmm3, %xmm3
; AVX256VL-NEXT: vinserti128 $1, %xmm3, %ymm2, %ymm2
; AVX256VL-NEXT: vpermq {{.*#+}} ymm2 = ymm2[1,1,2,1]
; AVX256VL-NEXT: vmovdqa {{.*#+}} ymm3 = [255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66527.217386.patch
Type: text/x-patch
Size: 2274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190827/9bc782c3/attachment.bin>
More information about the llvm-commits
mailing list