@@ -6894,6 +6894,26 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
6894
6894
void SelectionDAGBuilder::visitConstrainedFPIntrinsic (
6895
6895
const ConstrainedFPIntrinsic &FPI) {
6896
6896
SDLoc sdl = getCurSDLoc ();
6897
+
6898
+ const TargetLowering &TLI = DAG.getTargetLoweringInfo ();
6899
+ SmallVector<EVT, 4 > ValueVTs;
6900
+ ComputeValueVTs (TLI, DAG.getDataLayout (), FPI.getType (), ValueVTs);
6901
+ ValueVTs.push_back (MVT::Other); // Out chain
6902
+
6903
+ SDValue Chain = getRoot ();
6904
+ SmallVector<SDValue, 4 > Opers;
6905
+ Opers.push_back (Chain);
6906
+ if (FPI.isUnaryOp ()) {
6907
+ Opers.push_back (getValue (FPI.getArgOperand (0 )));
6908
+ } else if (FPI.isTernaryOp ()) {
6909
+ Opers.push_back (getValue (FPI.getArgOperand (0 )));
6910
+ Opers.push_back (getValue (FPI.getArgOperand (1 )));
6911
+ Opers.push_back (getValue (FPI.getArgOperand (2 )));
6912
+ } else {
6913
+ Opers.push_back (getValue (FPI.getArgOperand (0 )));
6914
+ Opers.push_back (getValue (FPI.getArgOperand (1 )));
6915
+ }
6916
+
6897
6917
unsigned Opcode;
6898
6918
switch (FPI.getIntrinsicID ()) {
6899
6919
default : llvm_unreachable (" Impossible intrinsic" ); // Can't reach here.
@@ -6923,6 +6943,8 @@ void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
6923
6943
break ;
6924
6944
case Intrinsic::experimental_constrained_fptrunc:
6925
6945
Opcode = ISD::STRICT_FP_ROUND;
6946
+ Opers.push_back (DAG.getTargetConstant (0 , sdl,
6947
+ TLI.getPointerTy (DAG.getDataLayout ())));
6926
6948
break ;
6927
6949
case Intrinsic::experimental_constrained_fpext:
6928
6950
Opcode = ISD::STRICT_FP_EXTEND;
@@ -6994,31 +7016,9 @@ void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
6994
7016
Opcode = ISD::STRICT_FTRUNC;
6995
7017
break ;
6996
7018
}
6997
- const TargetLowering &TLI = DAG.getTargetLoweringInfo ();
6998
- SDValue Chain = getRoot ();
6999
- SmallVector<EVT, 4 > ValueVTs;
7000
- ComputeValueVTs (TLI, DAG.getDataLayout (), FPI.getType (), ValueVTs);
7001
- ValueVTs.push_back (MVT::Other); // Out chain
7002
7019
7003
7020
SDVTList VTs = DAG.getVTList (ValueVTs);
7004
- SDValue Result;
7005
- if (Opcode == ISD::STRICT_FP_ROUND)
7006
- Result = DAG.getNode (Opcode, sdl, VTs,
7007
- { Chain, getValue (FPI.getArgOperand (0 )),
7008
- DAG.getTargetConstant (0 , sdl,
7009
- TLI.getPointerTy (DAG.getDataLayout ())) });
7010
- else if (FPI.isUnaryOp ())
7011
- Result = DAG.getNode (Opcode, sdl, VTs,
7012
- { Chain, getValue (FPI.getArgOperand (0 )) });
7013
- else if (FPI.isTernaryOp ())
7014
- Result = DAG.getNode (Opcode, sdl, VTs,
7015
- { Chain, getValue (FPI.getArgOperand (0 )),
7016
- getValue (FPI.getArgOperand (1 )),
7017
- getValue (FPI.getArgOperand (2 )) });
7018
- else
7019
- Result = DAG.getNode (Opcode, sdl, VTs,
7020
- { Chain, getValue (FPI.getArgOperand (0 )),
7021
- getValue (FPI.getArgOperand (1 )) });
7021
+ SDValue Result = DAG.getNode (Opcode, sdl, VTs, Opers);
7022
7022
7023
7023
if (FPI.getExceptionBehavior () !=
7024
7024
ConstrainedFPIntrinsic::ExceptionBehavior::ebIgnore) {
0 commit comments