From: Simon Pilgrim Date: Thu, 10 Aug 2017 18:29:34 +0000 (+0000) Subject: [CostModel][X86] Add avx2 two-src shuffle costs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=572897038a8804c58dd91b8264325179e758b385;p=llvm [CostModel][X86] Add avx2 two-src shuffle costs git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310645 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86TargetTransformInfo.cpp b/lib/Target/X86/X86TargetTransformInfo.cpp index fcacef84a66..54074f970f5 100644 --- a/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/lib/Target/X86/X86TargetTransformInfo.cpp @@ -842,9 +842,18 @@ int X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, { TTI::SK_PermuteSingleSrc, MVT::v8f32, 1 }, // vpermps { TTI::SK_PermuteSingleSrc, MVT::v4i64, 1 }, // vpermq { TTI::SK_PermuteSingleSrc, MVT::v8i32, 1 }, // vpermd - { TTI::SK_PermuteSingleSrc, MVT::v16i16, 4 }, // vperm2i128 + 2 * vpshufb + { TTI::SK_PermuteSingleSrc, MVT::v16i16, 4 }, // vperm2i128 + 2*vpshufb // + vpblendvb - { TTI::SK_PermuteSingleSrc, MVT::v32i8, 4 } // vperm2i128 + 2 * vpshufb + { TTI::SK_PermuteSingleSrc, MVT::v32i8, 4 }, // vperm2i128 + 2*vpshufb + // + vpblendvb + + { TTI::SK_PermuteTwoSrc, MVT::v4f64, 3 }, // 2*vpermpd + vblendpd + { TTI::SK_PermuteTwoSrc, MVT::v8f32, 3 }, // 2*vpermps + vblendps + { TTI::SK_PermuteTwoSrc, MVT::v4i64, 3 }, // 2*vpermq + vpblendd + { TTI::SK_PermuteTwoSrc, MVT::v8i32, 3 }, // 2*vpermd + vpblendd + { TTI::SK_PermuteTwoSrc, MVT::v16i16, 7 }, // 2*vperm2i128 + 4*vpshufb + // + vpblendvb + { TTI::SK_PermuteTwoSrc, MVT::v32i8, 7 }, // 2*vperm2i128 + 4*vpshufb // + vpblendvb }; diff --git a/test/Analysis/CostModel/X86/shuffle-single-src.ll b/test/Analysis/CostModel/X86/shuffle-single-src.ll index 69e8e886a88..15aa3f7aabf 100644 --- a/test/Analysis/CostModel/X86/shuffle-single-src.ll +++ b/test/Analysis/CostModel/X86/shuffle-single-src.ll @@ -34,7 +34,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSSE3: cost of 12 {{.*}} %V512 = shufflevector ; SSE42: cost of 12 {{.*}} %V512 = shufflevector ; AVX1: cost of 12 {{.*}} %V512 = shufflevector - ; AVX2: cost of 12 {{.*}} %V512 = shufflevector + ; AVX2: cost of 6 {{.*}} %V512 = shufflevector ; AVX512: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <8 x double> %src512, <8 x double> undef, <8 x i32> @@ -42,7 +42,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSSE3: cost of 56 {{.*}} %V1024 = shufflevector ; SSE42: cost of 56 {{.*}} %V1024 = shufflevector ; AVX1: cost of 72 {{.*}} %V1024 = shufflevector - ; AVX2: cost of 72 {{.*}} %V1024 = shufflevector + ; AVX2: cost of 36 {{.*}} %V1024 = shufflevector ; AVX512: cost of 2 {{.*}} %V1024 = shufflevector %V1024 = shufflevector <16 x double> %src1024, <16 x double> undef, <16 x i32> @@ -72,7 +72,7 @@ define void @test_vXi64(<2 x i64> %src128, <4 x i64> %src256, <8 x i64> %src512) ; SSSE3: cost of 12 {{.*}} %V512 = shufflevector ; SSE42: cost of 12 {{.*}} %V512 = shufflevector ; AVX1: cost of 16 {{.*}} %V512 = shufflevector - ; AVX2: cost of 16 {{.*}} %V512 = shufflevector + ; AVX2: cost of 6 {{.*}} %V512 = shufflevector ; AVX512: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <8 x i64> %src512, <8 x i64> undef, <8 x i32> @@ -102,7 +102,7 @@ define void @test_vXf32(<4 x float> %src128, <8 x float> %src256, <16 x float> % ; SSSE3: cost of 24 {{.*}} %V512 = shufflevector ; SSE42: cost of 24 {{.*}} %V512 = shufflevector ; AVX1: cost of 28 {{.*}} %V512 = shufflevector - ; AVX2: cost of 28 {{.*}} %V512 = shufflevector + ; AVX2: cost of 6 {{.*}} %V512 = shufflevector ; AVX512: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <16 x float> %src512, <16 x float> undef, <16 x i32> @@ -132,7 +132,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSSE3: cost of 24 {{.*}} %V512 = shufflevector ; SSE42: cost of 24 {{.*}} %V512 = shufflevector ; AVX1: cost of 32 {{.*}} %V512 = shufflevector - ; AVX2: cost of 32 {{.*}} %V512 = shufflevector + ; AVX2: cost of 6 {{.*}} %V512 = shufflevector ; AVX512: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <16 x i32> %src512, <16 x i32> undef, <16 x i32> @@ -140,7 +140,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSSE3: cost of 112 {{.*}} %V1024 = shufflevector ; SSE42: cost of 112 {{.*}} %V1024 = shufflevector ; AVX1: cost of 192 {{.*}} %V1024 = shufflevector - ; AVX2: cost of 192 {{.*}} %V1024 = shufflevector + ; AVX2: cost of 36 {{.*}} %V1024 = shufflevector ; AVX512: cost of 2 {{.*}} %V1024 = shufflevector %V1024 = shufflevector <32 x i32> %src1024, <32 x i32> undef, <32 x i32> ret void @@ -173,8 +173,8 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSSE3: cost of 36 {{.*}} %V512 = shufflevector ; SSE42: cost of 36 {{.*}} %V512 = shufflevector ; AVX1: cost of 64 {{.*}} %V512 = shufflevector - ; AVX2: cost of 64 {{.*}} %V512 = shufflevector - ; AVX512F: cost of 64 {{.*}} %V512 = shufflevector + ; AVX2: cost of 14 {{.*}} %V512 = shufflevector + ; AVX512F: cost of 14 {{.*}} %V512 = shufflevector ; AVX512BW: cost of 1 {{.*}} %V512 = shufflevector ; AVX512VBMI: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <32 x i16> %src512, <32 x i16> undef, <32 x i32> @@ -183,8 +183,8 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSSE3: cost of 168 {{.*}} %V1024 = shufflevector ; SSE42: cost of 168 {{.*}} %V1024 = shufflevector ; AVX1: cost of 384 {{.*}} %V1024 = shufflevector - ; AVX2: cost of 384 {{.*}} %V1024 = shufflevector - ; AVX512F: cost of 384 {{.*}} %V1024 = shufflevector + ; AVX2: cost of 84 {{.*}} %V1024 = shufflevector + ; AVX512F: cost of 84 {{.*}} %V1024 = shufflevector ; AVX512BW: cost of 2 {{.*}} %V1024 = shufflevector ; AVX512VBMI: cost of 2 {{.*}} %V1024 = shufflevector %V1024 = shufflevector <64 x i16> %src1024, <64 x i16> undef, <64 x i32> @@ -215,8 +215,8 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512) ; SSSE3: cost of 36 {{.*}} %V512 = shufflevector ; SSE42: cost of 36 {{.*}} %V512 = shufflevector ; AVX1: cost of 128 {{.*}} %V512 = shufflevector - ; AVX2: cost of 128 {{.*}} %V512 = shufflevector - ; AVX512F: cost of 128 {{.*}} %V512 = shufflevector + ; AVX2: cost of 14 {{.*}} %V512 = shufflevector + ; AVX512F: cost of 14 {{.*}} %V512 = shufflevector ; AVX512BW: cost of 8 {{.*}} %V512 = shufflevector ; AVX512VBMI: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <64 x i8> %src512, <64 x i8> undef, <64 x i32> diff --git a/test/Analysis/CostModel/X86/shuffle-two-src.ll b/test/Analysis/CostModel/X86/shuffle-two-src.ll index 17883cb3121..33e08dcb9f4 100644 --- a/test/Analysis/CostModel/X86/shuffle-two-src.ll +++ b/test/Analysis/CostModel/X86/shuffle-two-src.ll @@ -26,7 +26,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSSE3: cost of 6 {{.*}} %V256 = shufflevector ; SSE42: cost of 6 {{.*}} %V256 = shufflevector ; AVX1: cost of 6 {{.*}} %V256 = shufflevector - ; AVX2: cost of 6 {{.*}} %V256 = shufflevector + ; AVX2: cost of 3 {{.*}} %V256 = shufflevector ; AVX512: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <4 x double> %src256, <4 x double> %src256_1, <4 x i32> @@ -34,7 +34,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSSE3: cost of 28 {{.*}} %V512 = shufflevector ; SSE42: cost of 28 {{.*}} %V512 = shufflevector ; AVX1: cost of 12 {{.*}} %V512 = shufflevector - ; AVX2: cost of 12 {{.*}} %V512 = shufflevector + ; AVX2: cost of 18 {{.*}} %V512 = shufflevector ; AVX512: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <8 x double> %src512, <8 x double> %src512_1, <8 x i32> @@ -42,7 +42,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSSE3: cost of 120 {{.*}} %V1024 = shufflevector ; SSE42: cost of 120 {{.*}} %V1024 = shufflevector ; AVX1: cost of 24 {{.*}} %V1024 = shufflevector - ; AVX2: cost of 24 {{.*}} %V1024 = shufflevector + ; AVX2: cost of 84 {{.*}} %V1024 = shufflevector ; AVX512: cost of 6 {{.*}} %V1024 = shufflevector %V1024 = shufflevector <16 x double> %src1024, <16 x double> %src1024_1, <16 x i32> @@ -64,7 +64,7 @@ define void @test_vXi64(<2 x i64> %src128, <4 x i64> %src256, <8 x i64> %src512, ; SSSE3: cost of 6 {{.*}} %V256 = shufflevector ; SSE42: cost of 6 {{.*}} %V256 = shufflevector ; AVX1: cost of 8 {{.*}} %V256 = shufflevector - ; AVX2: cost of 8 {{.*}} %V256 = shufflevector + ; AVX2: cost of 3 {{.*}} %V256 = shufflevector ; AVX512: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <4 x i64> %src256, <4 x i64> %src256_1, <4 x i32> @@ -72,7 +72,7 @@ define void @test_vXi64(<2 x i64> %src128, <4 x i64> %src256, <8 x i64> %src512, ; SSSE3: cost of 28 {{.*}} %V512 = shufflevector ; SSE42: cost of 28 {{.*}} %V512 = shufflevector ; AVX1: cost of 16 {{.*}} %V512 = shufflevector - ; AVX2: cost of 16 {{.*}} %V512 = shufflevector + ; AVX2: cost of 18 {{.*}} %V512 = shufflevector ; AVX512: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <8 x i64> %src512, <8 x i64> %src512_1, <8 x i32> @@ -80,7 +80,7 @@ define void @test_vXi64(<2 x i64> %src128, <4 x i64> %src256, <8 x i64> %src512, ; SSSE3: cost of 120 {{.*}} %V1024 = shufflevector ; SSE42: cost of 120 {{.*}} %V1024 = shufflevector ; AVX1: cost of 32 {{.*}} %V1024 = shufflevector - ; AVX2: cost of 32 {{.*}} %V1024 = shufflevector + ; AVX2: cost of 84 {{.*}} %V1024 = shufflevector ; AVX512: cost of 6 {{.*}} %V1024 = shufflevector %V1024 = shufflevector <16 x i64> %src1024, <16 x i64> %src1024_1, <16 x i32> @@ -102,7 +102,7 @@ define void @test_vXf32(<4 x float> %src128, <8 x float> %src256, <16 x float> % ; SSSE3: cost of 12 {{.*}} %V256 = shufflevector ; SSE42: cost of 12 {{.*}} %V256 = shufflevector ; AVX1: cost of 14 {{.*}} %V256 = shufflevector - ; AVX2: cost of 14 {{.*}} %V256 = shufflevector + ; AVX2: cost of 3 {{.*}} %V256 = shufflevector ; AVX512: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <8 x float> %src256, <8 x float> %src256_1, <8 x i32> @@ -110,7 +110,7 @@ define void @test_vXf32(<4 x float> %src128, <8 x float> %src256, <16 x float> % ; SSSE3: cost of 56 {{.*}} %V512 = shufflevector ; SSE42: cost of 56 {{.*}} %V512 = shufflevector ; AVX1: cost of 28 {{.*}} %V512 = shufflevector - ; AVX2: cost of 28 {{.*}} %V512 = shufflevector + ; AVX2: cost of 18 {{.*}} %V512 = shufflevector ; AVX512: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <16 x float> %src512, <16 x float> %src512_1, <16 x i32> @@ -118,7 +118,7 @@ define void @test_vXf32(<4 x float> %src128, <8 x float> %src256, <16 x float> % ; SSSE3: cost of 240 {{.*}} %V1024 = shufflevector ; SSE42: cost of 240 {{.*}} %V1024 = shufflevector ; AVX1: cost of 56 {{.*}} %V1024 = shufflevector - ; AVX2: cost of 56 {{.*}} %V1024 = shufflevector + ; AVX2: cost of 84 {{.*}} %V1024 = shufflevector ; AVX512: cost of 6 {{.*}} %V1024 = shufflevector %V1024 = shufflevector <32 x float> %src1024, <32 x float> %src1024_1, <32 x i32> @@ -140,7 +140,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSSE3: cost of 12 {{.*}} %V256 = shufflevector ; SSE42: cost of 12 {{.*}} %V256 = shufflevector ; AVX1: cost of 16 {{.*}} %V256 = shufflevector - ; AVX2: cost of 16 {{.*}} %V256 = shufflevector + ; AVX2: cost of 3 {{.*}} %V256 = shufflevector ; AVX512: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <8 x i32> %src256, <8 x i32> %src256_1, <8 x i32> @@ -148,7 +148,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSSE3: cost of 56 {{.*}} %V512 = shufflevector ; SSE42: cost of 56 {{.*}} %V512 = shufflevector ; AVX1: cost of 32 {{.*}} %V512 = shufflevector - ; AVX2: cost of 32 {{.*}} %V512 = shufflevector + ; AVX2: cost of 18 {{.*}} %V512 = shufflevector ; AVX512: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <16 x i32> %src512, <16 x i32> %src512_1, <16 x i32> @@ -156,7 +156,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSSE3: cost of 240 {{.*}} %V1024 = shufflevector ; SSE42: cost of 240 {{.*}} %V1024 = shufflevector ; AVX1: cost of 64 {{.*}} %V1024 = shufflevector - ; AVX2: cost of 64 {{.*}} %V1024 = shufflevector + ; AVX2: cost of 84 {{.*}} %V1024 = shufflevector ; AVX512: cost of 6 {{.*}} %V1024 = shufflevector %V1024 = shufflevector <32 x i32> %src1024, <32 x i32> %src1024_1, <32 x i32> @@ -180,8 +180,8 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSSE3: cost of 18 {{.*}} %V256 = shufflevector ; SSE42: cost of 18 {{.*}} %V256 = shufflevector ; AVX1: cost of 32 {{.*}} %V256 = shufflevector - ; AVX2: cost of 32 {{.*}} %V256 = shufflevector - ; AVX512F: cost of 32 {{.*}} %V256 = shufflevector + ; AVX2: cost of 7 {{.*}} %V256 = shufflevector + ; AVX512F: cost of 7 {{.*}} %V256 = shufflevector ; AVX512BW: cost of 1 {{.*}} %V256 = shufflevector ; AVX512VBMI: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <16 x i16> %src256, <16 x i16> %src256_1, <16 x i32> @@ -190,8 +190,8 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSSE3: cost of 84 {{.*}} %V512 = shufflevector ; SSE42: cost of 84 {{.*}} %V512 = shufflevector ; AVX1: cost of 64 {{.*}} %V512 = shufflevector - ; AVX2: cost of 64 {{.*}} %V512 = shufflevector - ; AVX512F: cost of 64 {{.*}} %V512 = shufflevector + ; AVX2: cost of 42 {{.*}} %V512 = shufflevector + ; AVX512F: cost of 42 {{.*}} %V512 = shufflevector ; AVX512BW: cost of 1 {{.*}} %V512 = shufflevector ; AVX512VBMI: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <32 x i16> %src512, <32 x i16> %src512_1, <32 x i32> @@ -200,8 +200,8 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSSE3: cost of 360 {{.*}} %V1024 = shufflevector ; SSE42: cost of 360 {{.*}} %V1024 = shufflevector ; AVX1: cost of 128 {{.*}} %V1024 = shufflevector - ; AVX2: cost of 128 {{.*}} %V1024 = shufflevector - ; AVX512F: cost of 128 {{.*}} %V1024 = shufflevector + ; AVX2: cost of 196 {{.*}} %V1024 = shufflevector + ; AVX512F: cost of 196 {{.*}} %V1024 = shufflevector ; AVX512BW: cost of 6 {{.*}} %V1024 = shufflevector ; AVX512VBMI: cost of 6 {{.*}} %V1024 = shufflevector %V1024 = shufflevector <64 x i16> %src1024, <64 x i16> %src1024_1, <64 x i32> @@ -226,8 +226,8 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512, ; SSSE3: cost of 18 {{.*}} %V256 = shufflevector ; SSE42: cost of 18 {{.*}} %V256 = shufflevector ; AVX1: cost of 64 {{.*}} %V256 = shufflevector - ; AVX2: cost of 64 {{.*}} %V256 = shufflevector - ; AVX512F: cost of 64 {{.*}} %V256 = shufflevector + ; AVX2: cost of 7 {{.*}} %V256 = shufflevector + ; AVX512F: cost of 7 {{.*}} %V256 = shufflevector ; AVX512BW: cost of 3 {{.*}} %V256 = shufflevector ; AVX512VBMI: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <32 x i8> %src256, <32 x i8> %src256_1, <32 x i32> @@ -236,8 +236,8 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512, ; SSSE3: cost of 84 {{.*}} %V512 = shufflevector ; SSE42: cost of 84 {{.*}} %V512 = shufflevector ; AVX1: cost of 128 {{.*}} %V512 = shufflevector - ; AVX2: cost of 128 {{.*}} %V512 = shufflevector - ; AVX512F: cost of 128 {{.*}} %V512 = shufflevector + ; AVX2: cost of 42 {{.*}} %V512 = shufflevector + ; AVX512F: cost of 42 {{.*}} %V512 = shufflevector ; AVX512BW: cost of 19 {{.*}} %V512 = shufflevector ; AVX512VBMI: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <64 x i8> %src512, <64 x i8> %src512_1, <64 x i32>