mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
X86TTI: Adjust sdiv cost now that we can lower it on plain SSE2.
Includes a fix for a horrible typo that caused all SDIV costs to be slightly off :) llvm-svn: 207371
This commit is contained in:
parent
cc45aefeb0
commit
764309a6cd
@ -1327,7 +1327,7 @@ int TargetLoweringBase::InstructionOpcodeToISD(unsigned Opcode) const {
|
|||||||
case Mul: return ISD::MUL;
|
case Mul: return ISD::MUL;
|
||||||
case FMul: return ISD::FMUL;
|
case FMul: return ISD::FMUL;
|
||||||
case UDiv: return ISD::UDIV;
|
case UDiv: return ISD::UDIV;
|
||||||
case SDiv: return ISD::UDIV;
|
case SDiv: return ISD::SDIV;
|
||||||
case FDiv: return ISD::FDIV;
|
case FDiv: return ISD::FDIV;
|
||||||
case URem: return ISD::UREM;
|
case URem: return ISD::UREM;
|
||||||
case SRem: return ISD::SREM;
|
case SRem: return ISD::SREM;
|
||||||
|
@ -369,11 +369,16 @@ unsigned X86TTI::getArithmeticInstrCost(unsigned Opcode, Type *Ty,
|
|||||||
|
|
||||||
{ ISD::SDIV, MVT::v8i16, 6 }, // pmulhw sequence
|
{ ISD::SDIV, MVT::v8i16, 6 }, // pmulhw sequence
|
||||||
{ ISD::UDIV, MVT::v8i16, 6 }, // pmulhuw sequence
|
{ ISD::UDIV, MVT::v8i16, 6 }, // pmulhuw sequence
|
||||||
|
{ ISD::SDIV, MVT::v4i32, 19 }, // pmuludq sequence
|
||||||
{ ISD::UDIV, MVT::v4i32, 15 }, // pmuludq sequence
|
{ ISD::UDIV, MVT::v4i32, 15 }, // pmuludq sequence
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Op2Info == TargetTransformInfo::OK_UniformConstantValue &&
|
if (Op2Info == TargetTransformInfo::OK_UniformConstantValue &&
|
||||||
ST->hasSSE2()) {
|
ST->hasSSE2()) {
|
||||||
|
// pmuldq sequence.
|
||||||
|
if (ISD == ISD::SDIV && LT.second == MVT::v4i32 && ST->hasSSE41())
|
||||||
|
return LT.first * 15;
|
||||||
|
|
||||||
int Idx = CostTableLookup(SSE2UniformConstCostTable, ISD, LT.second);
|
int Idx = CostTableLookup(SSE2UniformConstCostTable, ISD, LT.second);
|
||||||
if (Idx != -1)
|
if (Idx != -1)
|
||||||
return LT.first * SSE2UniformConstCostTable[Idx].Cost;
|
return LT.first * SSE2UniformConstCostTable[Idx].Cost;
|
||||||
|
@ -69,7 +69,7 @@ define <4 x i32> @test8(<4 x i32> %a) {
|
|||||||
ret <4 x i32> %div
|
ret <4 x i32> %div
|
||||||
|
|
||||||
; CHECK: 'Cost Model Analysis' for function 'test8':
|
; CHECK: 'Cost Model Analysis' for function 'test8':
|
||||||
; SSE2: Found an estimated cost of 15 for instruction: %div
|
; SSE2: Found an estimated cost of 19 for instruction: %div
|
||||||
; AVX2: Found an estimated cost of 15 for instruction: %div
|
; AVX2: Found an estimated cost of 15 for instruction: %div
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ define <8 x i32> @test9(<8 x i32> %a) {
|
|||||||
ret <8 x i32> %div
|
ret <8 x i32> %div
|
||||||
|
|
||||||
; CHECK: 'Cost Model Analysis' for function 'test9':
|
; CHECK: 'Cost Model Analysis' for function 'test9':
|
||||||
; SSE2: Found an estimated cost of 30 for instruction: %div
|
; SSE2: Found an estimated cost of 38 for instruction: %div
|
||||||
; AVX2: Found an estimated cost of 15 for instruction: %div
|
; AVX2: Found an estimated cost of 15 for instruction: %div
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user