]> granicus.if.org Git - llvm/commitdiff
[CostModel][X86] Add SSE2 two-src shuffle costs
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 10 Aug 2017 19:32:35 +0000 (19:32 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 10 Aug 2017 19:32:35 +0000 (19:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310654 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86TargetTransformInfo.cpp
test/Analysis/CostModel/X86/shuffle-single-src.ll
test/Analysis/CostModel/X86/shuffle-two-src.ll

index 03dff0fb89553c2a522fc6a0ec5a5ce9e47ad286..ed56e4512f68e09780dc245cfb6a6165592b5f5b 100644 (file)
@@ -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())
index 842c72a335ae30e7f5807986be8e746af6a38073..590f80d42539fc3d398b4a53fc9e2ed19046e8ed 100644 (file)
@@ -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> <i32 7, i32 6, i32 6, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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> <i32 15, i32 14, i32 13, i32 13, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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> <i32 31, i32 30, i32 20, i32 28, i32 27, i32 26, i32 25, i32 24, i32 23, i32 22, i32 21, i32 20, i32 19, i32 18, i32 17, i32 16, i32 15, i32 14, i32 13, i32 12, i32 11, i32 11, i32 9, i32 8, i32 7, i32 11, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 11, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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> <i32 31, i32 30, i32 29, i32 28, i32 27, i32 26, i32 25, i32 24, i32 23, i32 22, i32 21, i32 20, i32 19, i32 18, i32 17, i32 16, i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 8, i32 8, i32 7, i32 6, i32 8, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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
index dc6f5ceff5076e883800a08795d3c91e4c91f357..1967397c3717bf25c2922d328880251c1c3e8db1 100644 (file)
@@ -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> <i32 7, i32 6, i32 6, i32 8, i32 9, i32 2, i32 1, i32 0>
 
-  ; 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> <i32 15, i32 14, i32 13, i32 20, i32 21, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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> <i32 31, i32 30, i32 45, i32 28, i32 27, i32 26, i32 25, i32 24, i32 23, i32 22, i32 21, i32 20, i32 19, i32 18, i32 17, i32 16, i32 15, i32 14, i32 13, i32 38, i32 11, i32 11, i32 9, i32 8, i32 7, i32 11, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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> <i32 29, i32 14, i32 28, i32 12, i32 11, i32 10, i32 11, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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> <i32 31, i32 30, i32 45, i32 28, i32 27, i32 26, i32 25, i32 24, i32 23, i32 22, i32 21, i32 20, i32 19, i32 18, i32 17, i32 16, i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 8, i32 8, i32 7, i32 6, i32 8, i32 4, i32 3, i32 2, i32 1, i32 0>
 
-  ; 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