case Mul: return ISD::MUL;
case FMul: return ISD::FMUL;
case UDiv: return ISD::UDIV;
- case SDiv: return ISD::UDIV;
+ case SDiv: return ISD::SDIV;
case FDiv: return ISD::FDIV;
case URem: return ISD::UREM;
case SRem: return ISD::SREM;
{ ISD::SDIV, MVT::v8i16, 6 }, // pmulhw sequence
{ ISD::UDIV, MVT::v8i16, 6 }, // pmulhuw sequence
+ { ISD::SDIV, MVT::v4i32, 19 }, // pmuludq sequence
{ ISD::UDIV, MVT::v4i32, 15 }, // pmuludq sequence
};
if (Op2Info == TargetTransformInfo::OK_UniformConstantValue &&
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);
if (Idx != -1)
return LT.first * SSE2UniformConstCostTable[Idx].Cost;
ret <4 x i32> %div
; 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
}
ret <8 x i32> %div
; 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
}