forked from OSchip/llvm-project
[TargetLowering] In expandFP_TO_UINT, add proper extend or truncate for the condition to feed the DstVT select.
Previously, for vectors we created a vselect with a condition that didn't match what the target wanted according to getSetCCResultType. To make up for this, X86 had a special DAG combine to detect if the condition was all sign bits and then insert its own truncate or extend. By adding the extend/truncate here explicitly we can avoid that.
This commit is contained in:
parent
285d5e6b8b
commit
16a67d252c
|
@ -6067,6 +6067,8 @@ bool TargetLowering::expandFP_TO_UINT(SDNode *Node, SDValue &Result,
|
|||
EVT DstVT = Node->getValueType(0);
|
||||
EVT SetCCVT =
|
||||
getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), SrcVT);
|
||||
EVT DstSetCCVT =
|
||||
getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), DstVT);
|
||||
|
||||
// Only expand vector types if we have the appropriate vector bit operations.
|
||||
unsigned SIntOpcode = Node->isStrictFPOpcode() ? ISD::STRICT_FP_TO_SINT :
|
||||
|
@ -6115,6 +6117,7 @@ bool TargetLowering::expandFP_TO_UINT(SDNode *Node, SDValue &Result,
|
|||
// TODO: Should any fast-math-flags be set for the FSUB?
|
||||
SDValue FltOfs = DAG.getSelect(dl, SrcVT, Sel,
|
||||
DAG.getConstantFP(0.0, dl, SrcVT), Cst);
|
||||
Sel = DAG.getBoolExtOrTrunc(Sel, dl, DstSetCCVT, DstVT);
|
||||
SDValue IntOfs = DAG.getSelect(dl, DstVT, Sel,
|
||||
DAG.getConstant(0, dl, DstVT),
|
||||
DAG.getConstant(SignMask, dl, DstVT));
|
||||
|
@ -6142,6 +6145,7 @@ bool TargetLowering::expandFP_TO_UINT(SDNode *Node, SDValue &Result,
|
|||
DAG.getNode(ISD::FSUB, dl, SrcVT, Src, Cst));
|
||||
False = DAG.getNode(ISD::XOR, dl, DstVT, False,
|
||||
DAG.getConstant(SignMask, dl, DstVT));
|
||||
Sel = DAG.getBoolExtOrTrunc(Sel, dl, DstSetCCVT, DstVT);
|
||||
Result = DAG.getSelect(dl, DstVT, Sel, True, False);
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue