mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-16 17:38:14 +00:00
[X86][AVX512BWVL] Added support for combining target v16i16 shuffles to AVX512BWVL vpermw
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284860 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fcb8cd9f1b
commit
714d9ba4ef
@ -25532,14 +25532,14 @@ static bool combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
|
||||
|
||||
if (is128BitLaneCrossingShuffleMask(MaskVT, Mask)) {
|
||||
// If we have a single input lane-crossing shuffle then lower to VPERMV.
|
||||
// FIXME: Add AVX512BWVL support for v16i16.
|
||||
if (UnaryShuffle && (Depth >= 3 || HasVariableMask) && !MaskContainsZeros &&
|
||||
((Subtarget.hasAVX2() &&
|
||||
(MaskVT == MVT::v8f32 || MaskVT == MVT::v8i32)) ||
|
||||
(Subtarget.hasAVX512() &&
|
||||
(MaskVT == MVT::v8f64 || MaskVT == MVT::v8i64 ||
|
||||
MaskVT == MVT::v16f32 || MaskVT == MVT::v16i32)) ||
|
||||
(Subtarget.hasBWI() && MaskVT == MVT::v32i16))) {
|
||||
(Subtarget.hasBWI() && MaskVT == MVT::v32i16) ||
|
||||
(Subtarget.hasBWI() && Subtarget.hasVLX() && MaskVT == MVT::v16i16))) {
|
||||
MVT VPermMaskSVT = MVT::getIntegerVT(MaskEltSizeInBits);
|
||||
MVT VPermMaskVT = MVT::getVectorVT(VPermMaskSVT, NumMaskElts);
|
||||
SDValue VPermMask = getConstVector(Mask, VPermMaskVT, DAG, DL, true);
|
||||
|
@ -4218,16 +4218,13 @@ define <16 x i16> @PR24935(<16 x i16> %a, <16 x i16> %b) {
|
||||
;
|
||||
; AVX512VL-LABEL: PR24935:
|
||||
; AVX512VL: # BB#0:
|
||||
; AVX512VL-NEXT: vperm2i128 {{.*#+}} ymm2 = ymm1[2,3,0,1]
|
||||
; AVX512VL-NEXT: vpshufb {{.*#+}} ymm2 = ymm2[6,7,4,5,0,1,10,11,4,5,10,11,4,5,6,7,22,23,20,21,16,17,26,27,20,21,26,27,20,21,22,23]
|
||||
; AVX512VL-NEXT: vmovdqu16 {{.*#+}} ymm2 = [11,10,8,13,10,13,10,11,3,2,0,5,2,5,2,3]
|
||||
; AVX512VL-NEXT: vpermw %ymm1, %ymm2, %ymm2
|
||||
; AVX512VL-NEXT: vpshufb {{.*#+}} ymm1 = ymm1[8,9,10,11,4,5,8,9,0,1,14,15,12,13,0,1,24,25,26,27,20,21,24,25,16,17,30,31,28,29,16,17]
|
||||
; AVX512VL-NEXT: vmovdqu8 {{.*#+}} ymm3 = <255,255,255,255,u,u,255,255,255,255,0,0,u,u,0,0,u,u,u,u,255,255,0,0,u,u,u,u,u,u,0,0>
|
||||
; AVX512VL-NEXT: vpblendvb %ymm3, %ymm2, %ymm1, %ymm1
|
||||
; AVX512VL-NEXT: vperm2i128 {{.*#+}} ymm2 = ymm0[2,3,0,1]
|
||||
; AVX512VL-NEXT: vpshufb {{.*#+}} ymm2 = ymm2[u,u,u,u,u,u,u,u,u,u,u,u,6,7,u,u,18,19,u,u,u,u,u,u,u,u,24,25,16,17,u,u]
|
||||
; AVX512VL-NEXT: vpshuflw {{.*#+}} ymm0 = ymm0[0,1,1,3,4,5,6,7,8,9,9,11,12,13,14,15]
|
||||
; AVX512VL-NEXT: vpshufhw {{.*#+}} ymm0 = ymm0[0,1,2,3,5,5,6,7,8,9,10,11,13,13,14,15]
|
||||
; AVX512VL-NEXT: vpblendw {{.*#+}} ymm0 = ymm2[0],ymm0[1,2],ymm2[3],ymm0[4],ymm2[5,6,7,8],ymm0[9,10],ymm2[11],ymm0[12],ymm2[13,14,15]
|
||||
; AVX512VL-NEXT: vmovdqu16 {{.*#+}} ymm2 = <u,1,1,u,5,u,11,u,1,9,9,u,13,4,0,u>
|
||||
; AVX512VL-NEXT: vpermw %ymm0, %ymm2, %ymm0
|
||||
; AVX512VL-NEXT: vmovdqu8 {{.*#+}} ymm2 = [255,255,255,255,0,0,255,255,255,255,255,255,0,0,255,255,0,0,0,0,255,255,255,255,0,0,0,0,0,0,255,255]
|
||||
; AVX512VL-NEXT: vpblendvb %ymm2, %ymm1, %ymm0, %ymm0
|
||||
; AVX512VL-NEXT: retq
|
||||
|
59
test/CodeGen/X86/vector-shuffle-combining-avx512bwvl.ll
Normal file
59
test/CodeGen/X86/vector-shuffle-combining-avx512bwvl.ll
Normal file
@ -0,0 +1,59 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc < %s -mtriple=i686-unknown -mattr=+avx512bw,+avx512vl | FileCheck %s --check-prefix=X32
|
||||
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512bw,+avx512vl | FileCheck %s --check-prefix=X64
|
||||
|
||||
declare <16 x i16> @llvm.x86.avx512.mask.permvar.hi.256(<16 x i16>, <16 x i16>, <16 x i16>, i16)
|
||||
declare <16 x i16> @llvm.x86.avx512.maskz.vpermt2var.hi.256(<16 x i16>, <16 x i16>, <16 x i16>, i16)
|
||||
declare <16 x i16> @llvm.x86.avx512.mask.vpermi2var.hi.256(<16 x i16>, <16 x i16>, <16 x i16>, i16)
|
||||
|
||||
define <16 x i16> @combine_vpermt2var_16i16_identity(<16 x i16> %x0, <16 x i16> %x1) {
|
||||
; X32-LABEL: combine_vpermt2var_16i16_identity:
|
||||
; X32: # BB#0:
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: combine_vpermt2var_16i16_identity:
|
||||
; X64: # BB#0:
|
||||
; X64-NEXT: retq
|
||||
%res0 = call <16 x i16> @llvm.x86.avx512.maskz.vpermt2var.hi.256(<16 x i16> <i16 15, i16 14, i16 13, i16 12, i16 11, i16 10, i16 9, i16 8, i16 7, i16 6, i16 5, i16 4, i16 3, i16 2, i16 1, i16 0>, <16 x i16> %x0, <16 x i16> %x1, i16 -1)
|
||||
%res1 = call <16 x i16> @llvm.x86.avx512.maskz.vpermt2var.hi.256(<16 x i16> <i16 15, i16 30, i16 13, i16 28, i16 11, i16 26, i16 9, i16 24, i16 7, i16 22, i16 5, i16 20, i16 3, i16 18, i16 1, i16 16>, <16 x i16> %res0, <16 x i16> %res0, i16 -1)
|
||||
ret <16 x i16> %res1
|
||||
}
|
||||
define <16 x i16> @combine_vpermt2var_16i16_identity_mask(<16 x i16> %x0, <16 x i16> %x1, i16 %m) {
|
||||
; X32-LABEL: combine_vpermt2var_16i16_identity_mask:
|
||||
; X32: # BB#0:
|
||||
; X32-NEXT: kmovw {{[0-9]+}}(%esp), %k1
|
||||
; X32-NEXT: vmovdqu16 {{.*#+}} ymm2 = [15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]
|
||||
; X32-NEXT: vpermt2w %ymm1, %ymm2, %ymm0 {%k1} {z}
|
||||
; X32-NEXT: vmovdqu16 {{.*#+}} ymm1 = [15,30,13,28,11,26,9,24,7,22,5,20,3,18,1,16]
|
||||
; X32-NEXT: vpermt2w %ymm0, %ymm1, %ymm0 {%k1} {z}
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: combine_vpermt2var_16i16_identity_mask:
|
||||
; X64: # BB#0:
|
||||
; X64-NEXT: kmovw %edi, %k1
|
||||
; X64-NEXT: vmovdqu16 {{.*#+}} ymm2 = [15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]
|
||||
; X64-NEXT: vpermt2w %ymm1, %ymm2, %ymm0 {%k1} {z}
|
||||
; X64-NEXT: vmovdqu16 {{.*#+}} ymm1 = [15,30,13,28,11,26,9,24,7,22,5,20,3,18,1,16]
|
||||
; X64-NEXT: vpermt2w %ymm0, %ymm1, %ymm0 {%k1} {z}
|
||||
; X64-NEXT: retq
|
||||
%res0 = call <16 x i16> @llvm.x86.avx512.maskz.vpermt2var.hi.256(<16 x i16> <i16 15, i16 14, i16 13, i16 12, i16 11, i16 10, i16 9, i16 8, i16 7, i16 6, i16 5, i16 4, i16 3, i16 2, i16 1, i16 0>, <16 x i16> %x0, <16 x i16> %x1, i16 %m)
|
||||
%res1 = call <16 x i16> @llvm.x86.avx512.maskz.vpermt2var.hi.256(<16 x i16> <i16 15, i16 30, i16 13, i16 28, i16 11, i16 26, i16 9, i16 24, i16 7, i16 22, i16 5, i16 20, i16 3, i16 18, i16 1, i16 16>, <16 x i16> %res0, <16 x i16> %res0, i16 %m)
|
||||
ret <16 x i16> %res1
|
||||
}
|
||||
|
||||
define <16 x i16> @combine_vpermi2var_16i16_as_permw(<16 x i16> %x0, <16 x i16> %x1) {
|
||||
; X32-LABEL: combine_vpermi2var_16i16_as_permw:
|
||||
; X32: # BB#0:
|
||||
; X32-NEXT: vmovdqu16 {{.*#+}} ymm1 = [15,0,14,1,13,2,12,3,11,4,10,5,9,6,8,7]
|
||||
; X32-NEXT: vpermw %ymm0, %ymm1, %ymm0
|
||||
; X32-NEXT: retl
|
||||
;
|
||||
; X64-LABEL: combine_vpermi2var_16i16_as_permw:
|
||||
; X64: # BB#0:
|
||||
; X64-NEXT: vmovdqu16 {{.*#+}} ymm1 = [15,0,14,1,13,2,12,3,11,4,10,5,9,6,8,7]
|
||||
; X64-NEXT: vpermw %ymm0, %ymm1, %ymm0
|
||||
; X64-NEXT: retq
|
||||
%res0 = call <16 x i16> @llvm.x86.avx512.mask.vpermi2var.hi.256(<16 x i16> %x0, <16 x i16> <i16 15, i16 14, i16 13, i16 12, i16 11, i16 10, i16 9, i16 8, i16 7, i16 6, i16 5, i16 4, i16 3, i16 2, i16 1, i16 0>, <16 x i16> %x1, i16 -1)
|
||||
%res1 = call <16 x i16> @llvm.x86.avx512.mask.vpermi2var.hi.256(<16 x i16> %res0, <16 x i16> <i16 0, i16 15, i16 1, i16 14, i16 2, i16 13, i16 3, i16 12, i16 4, i16 11, i16 5, i16 10, i16 6, i16 9, i16 7, i16 8>, <16 x i16> %res0, i16 -1)
|
||||
ret <16 x i16> %res1
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user