diff options
author | Craig Topper <craig.topper@gmail.com> | 2016-07-10 05:55:53 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2016-07-10 05:55:53 +0000 |
commit | 0b0954570a83fc47d72db86db529d4b5b70ab05c (patch) | |
tree | b557e8b7a1a3f23c9199b2209600129b64e8a290 | |
parent | 1b79e9a5b916c7c3684e82a1cec29bd6ac91bd3e (diff) | |
download | bcm5719-llvm-0b0954570a83fc47d72db86db529d4b5b70ab05c.tar.gz bcm5719-llvm-0b0954570a83fc47d72db86db529d4b5b70ab05c.zip |
[AVX512] Add support for lowering to 512-bit SHUFPS.
llvm-svn: 275011
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 12 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/sse3-avx-addsub.ll | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll | 9 |
3 files changed, 19 insertions, 6 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 83e910d4f14..1bdb762a4b7 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -11821,11 +11821,15 @@ static SDValue lowerV16F32VectorShuffle(SDLoc DL, ArrayRef<int> Mask, if (V2.isUndef()) return DAG.getNode(X86ISD::VPERMILPI, DL, MVT::v16f32, V1, getV4X86ShuffleImm8ForMask(RepeatedMask, DL, DAG)); - } - if (SDValue Unpck = - lowerVectorShuffleWithUNPCK(DL, MVT::v16f32, Mask, V1, V2, DAG)) - return Unpck; + // Use dedicated unpack instructions for masks that match their pattern. + if (SDValue Unpck = + lowerVectorShuffleWithUNPCK(DL, MVT::v16f32, Mask, V1, V2, DAG)) + return Unpck; + + // Otherwise, fall back to a SHUFPS sequence. + return lowerVectorShuffleWithSHUFPS(DL, MVT::v16f32, RepeatedMask, V1, V2, DAG); + } return lowerVectorShuffleWithPERMV(DL, MVT::v16f32, Mask, V1, V2, DAG); } diff --git a/llvm/test/CodeGen/X86/sse3-avx-addsub.ll b/llvm/test/CodeGen/X86/sse3-avx-addsub.ll index ea59232a7ec..17586a811f4 100644 --- a/llvm/test/CodeGen/X86/sse3-avx-addsub.ll +++ b/llvm/test/CodeGen/X86/sse3-avx-addsub.ll @@ -121,8 +121,8 @@ define <16 x float> @test5(<16 x float> %A, <16 x float> %B) { ; AVX512: # BB#0: ; AVX512-NEXT: vaddps %zmm1, %zmm0, %zmm2 ; AVX512-NEXT: vsubps %zmm1, %zmm0, %zmm0 -; AVX512-NEXT: vmovdqa32 {{.*#+}} zmm1 = [0,17,2,19,4,21,6,23,8,25,10,27,12,29,14,31] -; AVX512-NEXT: vpermt2ps %zmm2, %zmm1, %zmm0 +; AVX512-NEXT: vshufps {{.*#+}} zmm0 = zmm0[0,2],zmm2[1,3],zmm0[4,6],zmm2[5,7],zmm0[8,10],zmm2[9,11],zmm0[12,14],zmm2[13,15] +; AVX512-NEXT: vpermilps {{.*#+}} zmm0 = zmm0[0,2,1,3,4,6,5,7,8,10,9,11,12,14,13,15] ; AVX512-NEXT: retq %add = fadd <16 x float> %A, %B %sub = fsub <16 x float> %A, %B diff --git a/llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll b/llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll index 1f242fef117..d7518495134 100644 --- a/llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll +++ b/llvm/test/CodeGen/X86/vector-shuffle-512-v16.ll @@ -288,3 +288,12 @@ define <16 x i32> @shuffle_v16i16_3_3_0_0_7_7_4_4_11_11_8_8_15_15_12_12(<16 x i3 %c = shufflevector <16 x i32> %a, <16 x i32> %b, <16 x i32> <i32 2, i32 3, i32 0, i32 1, i32 6, i32 7, i32 4, i32 5, i32 10, i32 11, i32 8, i32 9, i32 14, i32 15, i32 12, i32 13> ret <16 x i32> %c } + +define <16 x float> @shuffle_v16f32_00_01_10_10_04_05_14_14_08_09_18_18_0c_0d_1c_1c(<16 x float> %a, <16 x float> %b) { +; ALL-LABEL: shuffle_v16f32_00_01_10_10_04_05_14_14_08_09_18_18_0c_0d_1c_1c: +; ALL: # BB#0: +; ALL-NEXT: vshufps {{.*#+}} zmm0 = zmm0[0,1],zmm1[0,0],zmm0[4,5],zmm1[4,4],zmm0[8,9],zmm1[8,8],zmm0[12,13],zmm1[12,12] +; ALL-NEXT: retq + %shuffle = shufflevector <16 x float> %a, <16 x float> %b, <16 x i32> <i32 0, i32 1, i32 16, i32 16, i32 4, i32 5, i32 20, i32 20, i32 8, i32 9, i32 24, i32 24, i32 12, i32 13, i32 28, i32 28> + ret <16 x float> %shuffle +} |