From 9a17eb199cdc853ef3803f9d93260e6d0c328254 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 10 Aug 2017 19:02:51 +0000 Subject: [PATCH] [CostModel][X86] Add avx1 two-src shuffle costs git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310650 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86TargetTransformInfo.cpp | 9 +++++ .../CostModel/X86/shuffle-single-src.ll | 18 +++++----- .../Analysis/CostModel/X86/shuffle-two-src.ll | 34 +++++++++---------- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/lib/Target/X86/X86TargetTransformInfo.cpp b/lib/Target/X86/X86TargetTransformInfo.cpp index 54074f970f5..03dff0fb895 100644 --- a/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/lib/Target/X86/X86TargetTransformInfo.cpp @@ -893,6 +893,15 @@ int X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, // + 2*por + vinsertf128 { TTI::SK_PermuteSingleSrc, MVT::v32i8, 8 }, // vextractf128 + 4*pshufb // + 2*por + vinsertf128 + + { TTI::SK_PermuteTwoSrc, MVT::v4f64, 4 }, // 2*vperm2f128 + 2*vshufpd + { TTI::SK_PermuteTwoSrc, MVT::v8f32, 4 }, // 2*vperm2f128 + 2*vshufps + { TTI::SK_PermuteTwoSrc, MVT::v4i64, 4 }, // 2*vperm2f128 + 2*vshufpd + { TTI::SK_PermuteTwoSrc, MVT::v8i32, 4 }, // 2*vperm2f128 + 2*vshufps + { TTI::SK_PermuteTwoSrc, MVT::v16i16, 15 }, // 2*vextractf128 + 8*pshufb + // + 4*por + vinsertf128 + { TTI::SK_PermuteTwoSrc, MVT::v32i8, 15 }, // 2*vextractf128 + 8*pshufb + // + 4*por + vinsertf128 }; if (ST->hasAVX()) diff --git a/test/Analysis/CostModel/X86/shuffle-single-src.ll b/test/Analysis/CostModel/X86/shuffle-single-src.ll index 15aa3f7aabf..842c72a335a 100644 --- a/test/Analysis/CostModel/X86/shuffle-single-src.ll +++ b/test/Analysis/CostModel/X86/shuffle-single-src.ll @@ -33,7 +33,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSE2: cost of 12 {{.*}} %V512 = shufflevector ; SSSE3: cost of 12 {{.*}} %V512 = shufflevector ; SSE42: cost of 12 {{.*}} %V512 = shufflevector - ; AVX1: cost of 12 {{.*}} %V512 = shufflevector + ; AVX1: cost of 8 {{.*}} %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> @@ -41,7 +41,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSE2: cost of 56 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 56 {{.*}} %V1024 = shufflevector ; SSE42: cost of 56 {{.*}} %V1024 = shufflevector - ; AVX1: cost of 72 {{.*}} %V1024 = shufflevector + ; AVX1: cost of 48 {{.*}} %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> @@ -71,7 +71,7 @@ define void @test_vXi64(<2 x i64> %src128, <4 x i64> %src256, <8 x i64> %src512) ; SSE2: cost of 12 {{.*}} %V512 = shufflevector ; SSSE3: cost of 12 {{.*}} %V512 = shufflevector ; SSE42: cost of 12 {{.*}} %V512 = shufflevector - ; AVX1: cost of 16 {{.*}} %V512 = shufflevector + ; AVX1: cost of 8 {{.*}} %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> @@ -101,7 +101,7 @@ define void @test_vXf32(<4 x float> %src128, <8 x float> %src256, <16 x float> % ; SSE2: cost of 24 {{.*}} %V512 = shufflevector ; SSSE3: cost of 24 {{.*}} %V512 = shufflevector ; SSE42: cost of 24 {{.*}} %V512 = shufflevector - ; AVX1: cost of 28 {{.*}} %V512 = shufflevector + ; AVX1: cost of 8 {{.*}} %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> @@ -131,7 +131,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSE2: cost of 24 {{.*}} %V512 = shufflevector ; SSSE3: cost of 24 {{.*}} %V512 = shufflevector ; SSE42: cost of 24 {{.*}} %V512 = shufflevector - ; AVX1: cost of 32 {{.*}} %V512 = shufflevector + ; AVX1: cost of 8 {{.*}} %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> @@ -139,7 +139,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSE2: cost of 112 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 112 {{.*}} %V1024 = shufflevector ; SSE42: cost of 112 {{.*}} %V1024 = shufflevector - ; AVX1: cost of 192 {{.*}} %V1024 = shufflevector + ; AVX1: cost of 48 {{.*}} %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> @@ -172,7 +172,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSE2: cost of 192 {{.*}} %V512 = shufflevector ; SSSE3: cost of 36 {{.*}} %V512 = shufflevector ; SSE42: cost of 36 {{.*}} %V512 = shufflevector - ; AVX1: cost of 64 {{.*}} %V512 = shufflevector + ; AVX1: cost of 30 {{.*}} %V512 = shufflevector ; AVX2: cost of 14 {{.*}} %V512 = shufflevector ; AVX512F: cost of 14 {{.*}} %V512 = shufflevector ; AVX512BW: cost of 1 {{.*}} %V512 = shufflevector @@ -182,7 +182,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSE2: cost of 896 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 168 {{.*}} %V1024 = shufflevector ; SSE42: cost of 168 {{.*}} %V1024 = shufflevector - ; AVX1: cost of 384 {{.*}} %V1024 = shufflevector + ; AVX1: cost of 180 {{.*}} %V1024 = shufflevector ; AVX2: cost of 84 {{.*}} %V1024 = shufflevector ; AVX512F: cost of 84 {{.*}} %V1024 = shufflevector ; AVX512BW: cost of 2 {{.*}} %V1024 = shufflevector @@ -214,7 +214,7 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512) ; SSE2: cost of 384 {{.*}} %V512 = shufflevector ; SSSE3: cost of 36 {{.*}} %V512 = shufflevector ; SSE42: cost of 36 {{.*}} %V512 = shufflevector - ; AVX1: cost of 128 {{.*}} %V512 = shufflevector + ; AVX1: cost of 30 {{.*}} %V512 = shufflevector ; AVX2: cost of 14 {{.*}} %V512 = shufflevector ; AVX512F: cost of 14 {{.*}} %V512 = shufflevector ; AVX512BW: cost of 8 {{.*}} %V512 = shufflevector diff --git a/test/Analysis/CostModel/X86/shuffle-two-src.ll b/test/Analysis/CostModel/X86/shuffle-two-src.ll index 33e08dcb9f4..dc6f5ceff50 100644 --- a/test/Analysis/CostModel/X86/shuffle-two-src.ll +++ b/test/Analysis/CostModel/X86/shuffle-two-src.ll @@ -25,7 +25,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSE2: cost of 6 {{.*}} %V256 = shufflevector ; SSSE3: cost of 6 {{.*}} %V256 = shufflevector ; SSE42: cost of 6 {{.*}} %V256 = shufflevector - ; AVX1: cost of 6 {{.*}} %V256 = shufflevector + ; AVX1: cost of 4 {{.*}} %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> @@ -33,7 +33,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSE2: cost of 28 {{.*}} %V512 = shufflevector ; SSSE3: cost of 28 {{.*}} %V512 = shufflevector ; SSE42: cost of 28 {{.*}} %V512 = shufflevector - ; AVX1: cost of 12 {{.*}} %V512 = shufflevector + ; AVX1: cost of 24 {{.*}} %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> @@ -41,7 +41,7 @@ define void @test_vXf64(<2 x double> %src128, <4 x double> %src256, <8 x double> ; SSE2: cost of 120 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 120 {{.*}} %V1024 = shufflevector ; SSE42: cost of 120 {{.*}} %V1024 = shufflevector - ; AVX1: cost of 24 {{.*}} %V1024 = shufflevector + ; AVX1: cost of 112 {{.*}} %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> @@ -63,7 +63,7 @@ define void @test_vXi64(<2 x i64> %src128, <4 x i64> %src256, <8 x i64> %src512, ; SSE2: cost of 6 {{.*}} %V256 = shufflevector ; SSSE3: cost of 6 {{.*}} %V256 = shufflevector ; SSE42: cost of 6 {{.*}} %V256 = shufflevector - ; AVX1: cost of 8 {{.*}} %V256 = shufflevector + ; AVX1: cost of 4 {{.*}} %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> @@ -71,7 +71,7 @@ define void @test_vXi64(<2 x i64> %src128, <4 x i64> %src256, <8 x i64> %src512, ; SSE2: cost of 28 {{.*}} %V512 = shufflevector ; SSSE3: cost of 28 {{.*}} %V512 = shufflevector ; SSE42: cost of 28 {{.*}} %V512 = shufflevector - ; AVX1: cost of 16 {{.*}} %V512 = shufflevector + ; AVX1: cost of 24 {{.*}} %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> @@ -79,7 +79,7 @@ define void @test_vXi64(<2 x i64> %src128, <4 x i64> %src256, <8 x i64> %src512, ; SSE2: cost of 120 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 120 {{.*}} %V1024 = shufflevector ; SSE42: cost of 120 {{.*}} %V1024 = shufflevector - ; AVX1: cost of 32 {{.*}} %V1024 = shufflevector + ; AVX1: cost of 112 {{.*}} %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> @@ -101,7 +101,7 @@ define void @test_vXf32(<4 x float> %src128, <8 x float> %src256, <16 x float> % ; SSE2: cost of 12 {{.*}} %V256 = shufflevector ; SSSE3: cost of 12 {{.*}} %V256 = shufflevector ; SSE42: cost of 12 {{.*}} %V256 = shufflevector - ; AVX1: cost of 14 {{.*}} %V256 = shufflevector + ; AVX1: cost of 4 {{.*}} %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> @@ -109,7 +109,7 @@ define void @test_vXf32(<4 x float> %src128, <8 x float> %src256, <16 x float> % ; SSE2: cost of 56 {{.*}} %V512 = shufflevector ; SSSE3: cost of 56 {{.*}} %V512 = shufflevector ; SSE42: cost of 56 {{.*}} %V512 = shufflevector - ; AVX1: cost of 28 {{.*}} %V512 = shufflevector + ; AVX1: cost of 24 {{.*}} %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> @@ -117,7 +117,7 @@ define void @test_vXf32(<4 x float> %src128, <8 x float> %src256, <16 x float> % ; SSE2: cost of 240 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 240 {{.*}} %V1024 = shufflevector ; SSE42: cost of 240 {{.*}} %V1024 = shufflevector - ; AVX1: cost of 56 {{.*}} %V1024 = shufflevector + ; AVX1: cost of 112 {{.*}} %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> @@ -139,7 +139,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSE2: cost of 12 {{.*}} %V256 = shufflevector ; SSSE3: cost of 12 {{.*}} %V256 = shufflevector ; SSE42: cost of 12 {{.*}} %V256 = shufflevector - ; AVX1: cost of 16 {{.*}} %V256 = shufflevector + ; AVX1: cost of 4 {{.*}} %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> @@ -147,7 +147,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSE2: cost of 56 {{.*}} %V512 = shufflevector ; SSSE3: cost of 56 {{.*}} %V512 = shufflevector ; SSE42: cost of 56 {{.*}} %V512 = shufflevector - ; AVX1: cost of 32 {{.*}} %V512 = shufflevector + ; AVX1: cost of 24 {{.*}} %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> @@ -155,7 +155,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; SSE2: cost of 240 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 240 {{.*}} %V1024 = shufflevector ; SSE42: cost of 240 {{.*}} %V1024 = shufflevector - ; AVX1: cost of 64 {{.*}} %V1024 = shufflevector + ; AVX1: cost of 112 {{.*}} %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> @@ -179,7 +179,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSE2: cost of 32 {{.*}} %V256 = shufflevector ; SSSE3: cost of 18 {{.*}} %V256 = shufflevector ; SSE42: cost of 18 {{.*}} %V256 = shufflevector - ; AVX1: cost of 32 {{.*}} %V256 = shufflevector + ; AVX1: cost of 15 {{.*}} %V256 = shufflevector ; AVX2: cost of 7 {{.*}} %V256 = shufflevector ; AVX512F: cost of 7 {{.*}} %V256 = shufflevector ; AVX512BW: cost of 1 {{.*}} %V256 = shufflevector @@ -189,7 +189,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSE2: cost of 64 {{.*}} %V512 = shufflevector ; SSSE3: cost of 84 {{.*}} %V512 = shufflevector ; SSE42: cost of 84 {{.*}} %V512 = shufflevector - ; AVX1: cost of 64 {{.*}} %V512 = shufflevector + ; AVX1: cost of 90 {{.*}} %V512 = shufflevector ; AVX2: cost of 42 {{.*}} %V512 = shufflevector ; AVX512F: cost of 42 {{.*}} %V512 = shufflevector ; AVX512BW: cost of 1 {{.*}} %V512 = shufflevector @@ -199,7 +199,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; SSE2: cost of 128 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 360 {{.*}} %V1024 = shufflevector ; SSE42: cost of 360 {{.*}} %V1024 = shufflevector - ; AVX1: cost of 128 {{.*}} %V1024 = shufflevector + ; AVX1: cost of 420 {{.*}} %V1024 = shufflevector ; AVX2: cost of 196 {{.*}} %V1024 = shufflevector ; AVX512F: cost of 196 {{.*}} %V1024 = shufflevector ; AVX512BW: cost of 6 {{.*}} %V1024 = shufflevector @@ -225,7 +225,7 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512, ; SSE2: cost of 64 {{.*}} %V256 = shufflevector ; SSSE3: cost of 18 {{.*}} %V256 = shufflevector ; SSE42: cost of 18 {{.*}} %V256 = shufflevector - ; AVX1: cost of 64 {{.*}} %V256 = shufflevector + ; AVX1: cost of 15 {{.*}} %V256 = shufflevector ; AVX2: cost of 7 {{.*}} %V256 = shufflevector ; AVX512F: cost of 7 {{.*}} %V256 = shufflevector ; AVX512BW: cost of 3 {{.*}} %V256 = shufflevector @@ -235,7 +235,7 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512, ; SSE2: cost of 128 {{.*}} %V512 = shufflevector ; SSSE3: cost of 84 {{.*}} %V512 = shufflevector ; SSE42: cost of 84 {{.*}} %V512 = shufflevector - ; AVX1: cost of 128 {{.*}} %V512 = shufflevector + ; AVX1: cost of 90 {{.*}} %V512 = shufflevector ; AVX2: cost of 42 {{.*}} %V512 = shufflevector ; AVX512F: cost of 42 {{.*}} %V512 = shufflevector ; AVX512BW: cost of 19 {{.*}} %V512 = shufflevector -- 2.40.0