Skip to content

Commit

Permalink
[CostModel][X86] Add SSE2 two-src shuffle costs
Browse files Browse the repository at this point in the history
llvm-svn: 310654
  • Loading branch information
RKSimon committed Aug 10, 2017
1 parent e9499dd commit b59c2d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Target/X86/X86TargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
10 changes: 5 additions & 5 deletions llvm/test/Analysis/CostModel/X86/shuffle-single-src.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/Analysis/CostModel/X86/shuffle-two-src.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b59c2d9

Please sign in to comment.