diff options
| author | Craig Topper <craig.topper@gmail.com> | 2016-12-11 01:59:36 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2016-12-11 01:59:36 +0000 |
| commit | 58917f35082ba3c0692609caad304a9c932e5f7d (patch) | |
| tree | bd4ba04c3a036edb470ed98f9af09ab0e5e7e0bf /llvm/test | |
| parent | 58f4a5973168601467b52606d53a41b356bbab6c (diff) | |
| download | bcm5719-llvm-58917f35082ba3c0692609caad304a9c932e5f7d.tar.gz bcm5719-llvm-58917f35082ba3c0692609caad304a9c932e5f7d.zip | |
[AVX-512][InstCombine] Add 512-bit vpermilvar intrinsics to InstCombineCalls to match 128 and 256-bit.
llvm-svn: 289354
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/x86-vpermil.ll (renamed from llvm/test/Transforms/InstCombine/x86-avx.ll) | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/x86-avx.ll b/llvm/test/Transforms/InstCombine/x86-vpermil.ll index 12dc2251316..fad10d7ad5c 100644 --- a/llvm/test/Transforms/InstCombine/x86-avx.ll +++ b/llvm/test/Transforms/InstCombine/x86-vpermil.ll @@ -20,6 +20,14 @@ define <8 x float> @identity_test_vpermilvar_ps_256(<8 x float> %v) { ret <8 x float> %a } +define <16 x float> @identity_test_vpermilvar_ps_512(<16 x float> %v) { +; CHECK-LABEL: @identity_test_vpermilvar_ps_512( +; CHECK-NEXT: ret <16 x float> %v +; + %a = tail call <16 x float> @llvm.x86.avx512.vpermilvar.ps.512(<16 x float> %v, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>) + ret <16 x float> %a +} + define <2 x double> @identity_test_vpermilvar_pd(<2 x double> %v) { ; CHECK-LABEL: @identity_test_vpermilvar_pd( ; CHECK-NEXT: ret <2 x double> %v @@ -36,6 +44,14 @@ define <4 x double> @identity_test_vpermilvar_pd_256(<4 x double> %v) { ret <4 x double> %a } +define <8 x double> @identity_test_vpermilvar_pd_512(<8 x double> %v) { +; CHECK-LABEL: @identity_test_vpermilvar_pd_512( +; CHECK-NEXT: ret <8 x double> %v +; + %a = tail call <8 x double> @llvm.x86.avx512.vpermilvar.pd.512(<8 x double> %v, <8 x i64> <i64 0, i64 2, i64 0, i64 2, i64 0, i64 2, i64 0, i64 2>) + ret <8 x double> %a +} + ; Instcombine should be able to fold the following byte shuffle to a builtin shufflevector ; with a shuffle mask of all zeroes. @@ -57,6 +73,15 @@ define <8 x float> @zero_test_vpermilvar_ps_256_zero(<8 x float> %v) { ret <8 x float> %a } +define <16 x float> @zero_test_vpermilvar_ps_512_zero(<16 x float> %v) { +; CHECK-LABEL: @zero_test_vpermilvar_ps_512_zero( +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <16 x float> %v, <16 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 4, i32 4, i32 4, i32 4, i32 8, i32 8, i32 8, i32 8, i32 12, i32 12, i32 12, i32 12> +; CHECK-NEXT: ret <16 x float> [[TMP1]] +; + %a = tail call <16 x float> @llvm.x86.avx512.vpermilvar.ps.512(<16 x float> %v, <16 x i32> zeroinitializer) + ret <16 x float> %a +} + define <2 x double> @zero_test_vpermilvar_pd_zero(<2 x double> %v) { ; CHECK-LABEL: @zero_test_vpermilvar_pd_zero( ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x double> %v, <2 x double> undef, <2 x i32> zeroinitializer @@ -75,6 +100,15 @@ define <4 x double> @zero_test_vpermilvar_pd_256_zero(<4 x double> %v) { ret <4 x double> %a } +define <8 x double> @zero_test_vpermilvar_pd_512_zero(<8 x double> %v) { +; CHECK-LABEL: @zero_test_vpermilvar_pd_512_zero( +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x double> %v, <8 x double> undef, <8 x i32> <i32 0, i32 0, i32 2, i32 2, i32 4, i32 4, i32 6, i32 6> +; CHECK-NEXT: ret <8 x double> [[TMP1]] +; + %a = tail call <8 x double> @llvm.x86.avx512.vpermilvar.pd.512(<8 x double> %v, <8 x i64> zeroinitializer) + ret <8 x double> %a +} + ; Verify that instcombine is able to fold constant shuffles. define <4 x float> @test_vpermilvar_ps(<4 x float> %v) { @@ -95,6 +129,15 @@ define <8 x float> @test_vpermilvar_ps_256(<8 x float> %v) { ret <8 x float> %a } +define <16 x float> @test_vpermilvar_ps_512(<16 x float> %v) { +; CHECK-LABEL: @test_vpermilvar_ps_512( +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <16 x float> %v, <16 x float> undef, <16 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4, i32 11, i32 10, i32 9, i32 8, i32 15, i32 14, i32 13, i32 12> +; CHECK-NEXT: ret <16 x float> [[TMP1]] +; + %a = tail call <16 x float> @llvm.x86.avx512.vpermilvar.ps.512(<16 x float> %v, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>) + ret <16 x float> %a +} + define <2 x double> @test_vpermilvar_pd(<2 x double> %v) { ; CHECK-LABEL: @test_vpermilvar_pd( ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x double> %v, <2 x double> undef, <2 x i32> <i32 1, i32 0> @@ -113,6 +156,15 @@ define <4 x double> @test_vpermilvar_pd_256(<4 x double> %v) { ret <4 x double> %a } +define <8 x double> @test_vpermilvar_pd_512(<8 x double> %v) { +; CHECK-LABEL: @test_vpermilvar_pd_512( +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x double> %v, <8 x double> undef, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6> +; CHECK-NEXT: ret <8 x double> [[TMP1]] +; + %a = tail call <8 x double> @llvm.x86.avx512.vpermilvar.pd.512(<8 x double> %v, <8 x i64> <i64 3, i64 1, i64 2, i64 0, i64 7, i64 5, i64 6, i64 4>) + ret <8 x double> %a +} + ; Verify that instcombine is able to fold constant shuffles with undef mask elements. define <4 x float> @undef_test_vpermilvar_ps(<4 x float> %v) { @@ -133,6 +185,15 @@ define <8 x float> @undef_test_vpermilvar_ps_256(<8 x float> %v) { ret <8 x float> %a } +define <16 x float> @undef_test_vpermilvar_ps_512(<16 x float> %v) { +; CHECK-LABEL: @undef_test_vpermilvar_ps_512( +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <16 x float> %v, <16 x float> undef, <16 x i32> <i32 undef, i32 2, i32 1, i32 undef, i32 7, i32 6, i32 5, i32 4, i32 undef, i32 10, i32 9, i32 undef, i32 15, i32 14, i32 13, i32 12> +; CHECK-NEXT: ret <16 x float> [[TMP1]] +; + %a = tail call <16 x float> @llvm.x86.avx512.vpermilvar.ps.512(<16 x float> %v, <16 x i32> <i32 undef, i32 6, i32 5, i32 undef, i32 3, i32 2, i32 1, i32 0, i32 undef, i32 6, i32 5, i32 undef, i32 3, i32 2, i32 1, i32 0>) + ret <16 x float> %a +} + define <2 x double> @undef_test_vpermilvar_pd(<2 x double> %v) { ; CHECK-LABEL: @undef_test_vpermilvar_pd( ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x double> %v, <2 x double> undef, <2 x i32> <i32 undef, i32 0> @@ -151,8 +212,19 @@ define <4 x double> @undef_test_vpermilvar_pd_256(<4 x double> %v) { ret <4 x double> %a } +define <8 x double> @undef_test_vpermilvar_pd_512(<8 x double> %v) { +; CHECK-LABEL: @undef_test_vpermilvar_pd_512( +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x double> %v, <8 x double> undef, <8 x i32> <i32 undef, i32 0, i32 3, i32 undef, i32 undef, i32 4, i32 7, i32 undef> +; CHECK-NEXT: ret <8 x double> [[TMP1]] +; + %a = tail call <8 x double> @llvm.x86.avx512.vpermilvar.pd.512(<8 x double> %v, <8 x i64> <i64 undef, i64 1, i64 2, i64 undef, i64 undef, i64 1, i64 2, i64 undef>) + ret <8 x double> %a +} + declare <2 x double> @llvm.x86.avx.vpermilvar.pd(<2 x double>, <2 x i64>) declare <4 x double> @llvm.x86.avx.vpermilvar.pd.256(<4 x double>, <4 x i64>) +declare <8 x double> @llvm.x86.avx512.vpermilvar.pd.512(<8 x double>, <8 x i64>) declare <4 x float> @llvm.x86.avx.vpermilvar.ps(<4 x float>, <4 x i32>) declare <8 x float> @llvm.x86.avx.vpermilvar.ps.256(<8 x float>, <8 x i32>) +declare <16 x float> @llvm.x86.avx512.vpermilvar.ps.512(<16 x float>, <16 x i32>) |

