From b59c2d9d736b8e5c7b25b8d9aff04437d3d2e17e Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 10 Aug 2017 19:32:35 +0000 Subject: [PATCH] [CostModel][X86] Add SSE2 two-src shuffle costs llvm-svn: 310654 --- llvm/lib/Target/X86/X86TargetTransformInfo.cpp | 2 ++ .../Analysis/CostModel/X86/shuffle-single-src.ll | 10 +++++----- .../test/Analysis/CostModel/X86/shuffle-two-src.ll | 14 +++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp index 03dff0fb89553c..ed56e4512f68e0 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -973,6 +973,8 @@ int X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, { TTI::SK_PermuteTwoSrc, MVT::v2f64, 1 }, // shufpd { TTI::SK_PermuteTwoSrc, MVT::v2i64, 1 }, // shufpd { TTI::SK_PermuteTwoSrc, MVT::v4i32, 2 }, // 2*{unpck,movsd,pshufd} + { TTI::SK_PermuteTwoSrc, MVT::v8i16, 8 }, // blend+permute + { TTI::SK_PermuteTwoSrc, MVT::v16i8, 13 }, // blend+permute }; if (ST->hasSSE2()) diff --git a/llvm/test/Analysis/CostModel/X86/shuffle-single-src.ll b/llvm/test/Analysis/CostModel/X86/shuffle-single-src.ll index 842c72a335ae30..590f80d42539fc 100644 --- a/llvm/test/Analysis/CostModel/X86/shuffle-single-src.ll +++ b/llvm/test/Analysis/CostModel/X86/shuffle-single-src.ll @@ -159,7 +159,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; AVX512VBMI: cost of 1 {{.*}} %V128 = shufflevector %V128 = shufflevector <8 x i16> %src128, <8 x i16> undef, <8 x i32> - ; SSE2: cost of 32 {{.*}} %V256 = shufflevector + ; SSE2: cost of 16 {{.*}} %V256 = shufflevector ; SSSE3: cost of 6 {{.*}} %V256 = shufflevector ; SSE42: cost of 6 {{.*}} %V256 = shufflevector ; AVX1: cost of 8 {{.*}} %V256 = shufflevector @@ -169,7 +169,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; AVX512VBMI cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <16 x i16> %src256, <16 x i16> undef, <16 x i32> - ; SSE2: cost of 192 {{.*}} %V512 = shufflevector + ; SSE2: cost of 96 {{.*}} %V512 = shufflevector ; SSSE3: cost of 36 {{.*}} %V512 = shufflevector ; SSE42: cost of 36 {{.*}} %V512 = shufflevector ; AVX1: cost of 30 {{.*}} %V512 = shufflevector @@ -179,7 +179,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; AVX512VBMI: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <32 x i16> %src512, <32 x i16> undef, <32 x i32> - ; SSE2: cost of 896 {{.*}} %V1024 = shufflevector + ; SSE2: cost of 448 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 168 {{.*}} %V1024 = shufflevector ; SSE42: cost of 168 {{.*}} %V1024 = shufflevector ; AVX1: cost of 180 {{.*}} %V1024 = shufflevector @@ -201,7 +201,7 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512) ; AVX512: cost of 1 {{.*}} %V128 = shufflevector %V128 = shufflevector <16 x i8> %src128, <16 x i8> undef, <16 x i32> - ; SSE2: cost of 64 {{.*}} %V256 = shufflevector + ; SSE2: cost of 26 {{.*}} %V256 = shufflevector ; SSSE3: cost of 6 {{.*}} %V256 = shufflevector ; SSE42: cost of 6 {{.*}} %V256 = shufflevector ; AVX1: cost of 8 {{.*}} %V256 = shufflevector @@ -211,7 +211,7 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512) ; AVX512VBMI: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <32 x i8> %src256, <32 x i8> undef, <32 x i32> - ; SSE2: cost of 384 {{.*}} %V512 = shufflevector + ; SSE2: cost of 156 {{.*}} %V512 = shufflevector ; SSSE3: cost of 36 {{.*}} %V512 = shufflevector ; SSE42: cost of 36 {{.*}} %V512 = shufflevector ; AVX1: cost of 30 {{.*}} %V512 = shufflevector diff --git a/llvm/test/Analysis/CostModel/X86/shuffle-two-src.ll b/llvm/test/Analysis/CostModel/X86/shuffle-two-src.ll index dc6f5ceff5076e..1967397c3717bf 100644 --- a/llvm/test/Analysis/CostModel/X86/shuffle-two-src.ll +++ b/llvm/test/Analysis/CostModel/X86/shuffle-two-src.ll @@ -166,7 +166,7 @@ define void @test_vXi32(<4 x i32> %src128, <8 x i32> %src256, <16 x i32> %src512 ; CHECK-LABEL: 'test_vXi16' define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src512, <64 x i16> %src1024, <8 x i16> %src128_1, <16 x i16> %src256_1, <32 x i16> %src512_1, <64 x i16> %src1024_1) { - ; SSE2: cost of 16 {{.*}} %V128 = shufflevector + ; SSE2: cost of 8 {{.*}} %V128 = shufflevector ; SSSE3: cost of 3 {{.*}} %V128 = shufflevector ; SSE42: cost of 3 {{.*}} %V128 = shufflevector ; AVX1: cost of 3 {{.*}} %V128 = shufflevector @@ -176,7 +176,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; AVX512VBMI: cost of 1 {{.*}} %V128 = shufflevector %V128 = shufflevector <8 x i16> %src128, <8 x i16> %src128_1, <8 x i32> - ; SSE2: cost of 32 {{.*}} %V256 = shufflevector + ; SSE2: cost of 48 {{.*}} %V256 = shufflevector ; SSSE3: cost of 18 {{.*}} %V256 = shufflevector ; SSE42: cost of 18 {{.*}} %V256 = shufflevector ; AVX1: cost of 15 {{.*}} %V256 = shufflevector @@ -186,7 +186,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; AVX512VBMI: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <16 x i16> %src256, <16 x i16> %src256_1, <16 x i32> - ; SSE2: cost of 64 {{.*}} %V512 = shufflevector + ; SSE2: cost of 224 {{.*}} %V512 = shufflevector ; SSSE3: cost of 84 {{.*}} %V512 = shufflevector ; SSE42: cost of 84 {{.*}} %V512 = shufflevector ; AVX1: cost of 90 {{.*}} %V512 = shufflevector @@ -196,7 +196,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; AVX512VBMI: cost of 1 {{.*}} %V512 = shufflevector %V512 = shufflevector <32 x i16> %src512, <32 x i16> %src512_1, <32 x i32> - ; SSE2: cost of 128 {{.*}} %V1024 = shufflevector + ; SSE2: cost of 960 {{.*}} %V1024 = shufflevector ; SSSE3: cost of 360 {{.*}} %V1024 = shufflevector ; SSE42: cost of 360 {{.*}} %V1024 = shufflevector ; AVX1: cost of 420 {{.*}} %V1024 = shufflevector @@ -212,7 +212,7 @@ define void @test_vXi16(<8 x i16> %src128, <16 x i16> %src256, <32 x i16> %src51 ; CHECK-LABEL: 'test_vXi8' define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512, <16 x i8> %src128_1, <32 x i8> %src256_1, <64 x i8> %src512_1) { - ; SSE2: cost of 32 {{.*}} %V128 = shufflevector + ; SSE2: cost of 13 {{.*}} %V128 = shufflevector ; SSSE3: cost of 3 {{.*}} %V128 = shufflevector ; SSE42: cost of 3 {{.*}} %V128 = shufflevector ; AVX1: cost of 3 {{.*}} %V128 = shufflevector @@ -222,7 +222,7 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512, ; AVX512VBMI: cost of 1 {{.*}} %V128 = shufflevector %V128 = shufflevector <16 x i8> %src128, <16 x i8> %src128_1, <16 x i32> - ; SSE2: cost of 64 {{.*}} %V256 = shufflevector + ; SSE2: cost of 78 {{.*}} %V256 = shufflevector ; SSSE3: cost of 18 {{.*}} %V256 = shufflevector ; SSE42: cost of 18 {{.*}} %V256 = shufflevector ; AVX1: cost of 15 {{.*}} %V256 = shufflevector @@ -232,7 +232,7 @@ define void @test_vXi8(<16 x i8> %src128, <32 x i8> %src256, <64 x i8> %src512, ; AVX512VBMI: cost of 1 {{.*}} %V256 = shufflevector %V256 = shufflevector <32 x i8> %src256, <32 x i8> %src256_1, <32 x i32> - ; SSE2: cost of 128 {{.*}} %V512 = shufflevector + ; SSE2: cost of 364 {{.*}} %V512 = shufflevector ; SSSE3: cost of 84 {{.*}} %V512 = shufflevector ; SSE42: cost of 84 {{.*}} %V512 = shufflevector ; AVX1: cost of 90 {{.*}} %V512 = shufflevector