diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2016-07-12 20:27:32 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2016-07-12 20:27:32 +0000 |
| commit | 6fa71da4a40918dcf73dec5d7fa3f64ec150a2fb (patch) | |
| tree | a85f0c9ac82d99df75d3bee09b238b00a29ac4ae /llvm/test | |
| parent | 10e8bef1d4c1a982979a2104c18421eeee632a5c (diff) | |
| download | bcm5719-llvm-6fa71da4a40918dcf73dec5d7fa3f64ec150a2fb.tar.gz bcm5719-llvm-6fa71da4a40918dcf73dec5d7fa3f64ec150a2fb.zip | |
[X86][AVX] Add support for target shuffle combining to VPERM2F128/VPERM2I128
llvm-svn: 275212
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll | 22 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll | 13 |
2 files changed, 29 insertions, 6 deletions
diff --git a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll index ea6535d390e..c1e60a73dbf 100644 --- a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll +++ b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx.ll @@ -91,6 +91,28 @@ define <8 x float> @combine_vpermilvar_8f32_identity(<8 x float> %a0) { ret <8 x float> %2 } +define <8 x float> @combine_vpermilvar_vperm2f128_8f32(<8 x float> %a0) { +; ALL-LABEL: combine_vpermilvar_vperm2f128_8f32: +; ALL: # BB#0: +; ALL-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1] +; ALL-NEXT: retq + %1 = tail call <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float> %a0, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 3, i32 2, i32 1, i32 0>) + %2 = shufflevector <8 x float> %1, <8 x float> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3> + %3 = tail call <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float> %2, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 3, i32 2, i32 1, i32 0>) + ret <8 x float> %3 +} + +define <8 x float> @combine_vpermilvar_vperm2f128_zero_8f32(<8 x float> %a0) { +; ALL-LABEL: combine_vpermilvar_vperm2f128_zero_8f32: +; ALL: # BB#0: +; ALL-NEXT: vperm2f128 {{.*#+}} ymm0 = zero,zero,ymm0[0,1] +; ALL-NEXT: retq + %1 = tail call <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float> %a0, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 3, i32 2, i32 1, i32 0>) + %2 = shufflevector <8 x float> %1, <8 x float> zeroinitializer, <8 x i32> <i32 8, i32 8, i32 8, i32 8, i32 0, i32 1, i32 2, i32 3> + %3 = tail call <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float> %2, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 3, i32 2, i32 1, i32 0>) + ret <8 x float> %3 +} + define <8 x float> @combine_vpermilvar_8f32_movddup(<8 x float> %a0) { ; ALL-LABEL: combine_vpermilvar_8f32_movddup: ; ALL: # BB#0: diff --git a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll index 1a77785ab66..b087fc43ae3 100644 --- a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll +++ b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx2.ll @@ -48,17 +48,18 @@ define <32 x i8> @combine_pshufb_vpermps(<8 x float> %a) { ret <32 x i8> %tmp2 } -define <4 x i64> @combine_permq_pshufb(<4 x i64> %a0) { -; CHECK-LABEL: combine_permq_pshufb: +define <4 x i64> @combine_permq_pshufb_as_vperm2i128(<4 x i64> %a0) { +; CHECK-LABEL: combine_permq_pshufb_as_vperm2i128: ; CHECK: # BB#0: -; CHECK-NEXT: vpermq {{.*#+}} ymm0 = ymm0[3,2,1,0] -; CHECK-NEXT: vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5] +; CHECK-NEXT: vperm2i128 {{.*#+}} ymm0 = ymm0[2,3],zero,zero +; CHECK-NEXT: vpaddq {{.*}}(%rip), %ymm0, %ymm0 ; CHECK-NEXT: retq %1 = shufflevector <4 x i64> %a0, <4 x i64> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0> %2 = bitcast <4 x i64> %1 to <32 x i8> - %3 = call <32 x i8> @llvm.x86.avx2.pshuf.b(<32 x i8> %2, <32 x i8> <i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>) + %3 = call <32 x i8> @llvm.x86.avx2.pshuf.b(<32 x i8> %2, <32 x i8> <i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255, i8 255>) %4 = bitcast <32 x i8> %3 to <4 x i64> - ret <4 x i64> %4 + %5 = add <4 x i64> %4, <i64 1, i64 1, i64 3, i64 3> + ret <4 x i64> %5 } define <16 x i8> @combine_pshufb_as_vpbroadcastb128(<16 x i8> %a) { |

