diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-01-06 11:12:53 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-01-06 11:12:53 +0000 |
commit | d8333372bc764ea7575addf3dc9b2caaa39f178c (patch) | |
tree | b53c3a65e7996f7fe836f15032e1ab398d8bc161 | |
parent | 441d1d35d2a2d2b1ce43aa1905c9157ce5fe496f (diff) | |
download | bcm5719-llvm-d8333372bc764ea7575addf3dc9b2caaa39f178c.tar.gz bcm5719-llvm-d8333372bc764ea7575addf3dc9b2caaa39f178c.zip |
[CostModel][X86] Fix 512-bit SDIV/UDIV 'big' costs.
Set the costs on the lowest target that supports the type.
llvm-svn: 291229
-rw-r--r-- | llvm/lib/Target/X86/X86TargetTransformInfo.cpp | 34 | ||||
-rw-r--r-- | llvm/test/Analysis/CostModel/X86/vdiv-cost.ll | 6 |
2 files changed, 20 insertions, 20 deletions
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp index 80187a9fcc9..de4839432b9 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -226,12 +226,8 @@ int X86TTIImpl::getArithmeticInstrCost( // Vectorizing division is a bad idea. See the SSE2 table for more comments. { ISD::SDIV, MVT::v64i8, 64*20 }, { ISD::SDIV, MVT::v32i16, 32*20 }, - { ISD::SDIV, MVT::v16i32, 16*20 }, - { ISD::SDIV, MVT::v8i64, 8*20 }, { ISD::UDIV, MVT::v64i8, 64*20 }, - { ISD::UDIV, MVT::v32i16, 32*20 }, - { ISD::UDIV, MVT::v16i32, 16*20 }, - { ISD::UDIV, MVT::v8i64, 8*20 }, + { ISD::UDIV, MVT::v32i16, 32*20 } }; // Look for AVX512BW lowering tricks for custom cases. @@ -240,17 +236,23 @@ int X86TTIImpl::getArithmeticInstrCost( return LT.first * Entry->Cost; static const CostTblEntry AVX512CostTable[] = { - { ISD::SHL, MVT::v16i32, 1 }, - { ISD::SRL, MVT::v16i32, 1 }, - { ISD::SRA, MVT::v16i32, 1 }, - { ISD::SHL, MVT::v8i64, 1 }, - { ISD::SRL, MVT::v8i64, 1 }, - { ISD::SRA, MVT::v8i64, 1 }, - - { ISD::MUL, MVT::v32i8, 13 }, // extend/pmullw/trunc sequence. - { ISD::MUL, MVT::v16i8, 5 }, // extend/pmullw/trunc sequence. - { ISD::MUL, MVT::v16i32, 1 }, // pmulld - { ISD::MUL, MVT::v8i64, 8 } // 3*pmuludq/3*shift/2*add + { ISD::SHL, MVT::v16i32, 1 }, + { ISD::SRL, MVT::v16i32, 1 }, + { ISD::SRA, MVT::v16i32, 1 }, + { ISD::SHL, MVT::v8i64, 1 }, + { ISD::SRL, MVT::v8i64, 1 }, + { ISD::SRA, MVT::v8i64, 1 }, + + { ISD::MUL, MVT::v32i8, 13 }, // extend/pmullw/trunc sequence. + { ISD::MUL, MVT::v16i8, 5 }, // extend/pmullw/trunc sequence. + { ISD::MUL, MVT::v16i32, 1 }, // pmulld + { ISD::MUL, MVT::v8i64, 8 }, // 3*pmuludq/3*shift/2*add + + // Vectorizing division is a bad idea. See the SSE2 table for more comments. + { ISD::SDIV, MVT::v16i32, 16*20 }, + { ISD::SDIV, MVT::v8i64, 8*20 }, + { ISD::UDIV, MVT::v16i32, 16*20 }, + { ISD::UDIV, MVT::v8i64, 8*20 } }; if (ST->hasAVX512()) diff --git a/llvm/test/Analysis/CostModel/X86/vdiv-cost.ll b/llvm/test/Analysis/CostModel/X86/vdiv-cost.ll index a6191c5a5eb..a45bb4b3d0d 100644 --- a/llvm/test/Analysis/CostModel/X86/vdiv-cost.ll +++ b/llvm/test/Analysis/CostModel/X86/vdiv-cost.ll @@ -118,7 +118,5 @@ define <16 x i32> @test11(<16 x i32> %a) { ; CHECK: 'Cost Model Analysis' for function 'test11': ; SSE: Found an estimated cost of 320 for instruction: %div ; AVX: Found an estimated cost of 320 for instruction: %div -; AVX512F: Found an estimated cost of 48 for instruction: %div -; AVX512BW: Found an estimated cost of 320 for instruction: %div -; AVX512DQ: Found an estimated cost of 48 for instruction: %div -}
+; AVX512: Found an estimated cost of 320 for instruction: %div +} |