@@ -6911,6 +6911,26 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
6911
6911
void SelectionDAGBuilder::visitConstrainedFPIntrinsic (
6912
6912
const ConstrainedFPIntrinsic &FPI) {
6913
6913
SDLoc sdl = getCurSDLoc ();
6914
+
6915
+ const TargetLowering &TLI = DAG.getTargetLoweringInfo ();
6916
+ SmallVector<EVT, 4 > ValueVTs;
6917
+ ComputeValueVTs (TLI, DAG.getDataLayout (), FPI.getType (), ValueVTs);
6918
+ ValueVTs.push_back (MVT::Other); // Out chain
6919
+
6920
+ SDValue Chain = getRoot ();
6921
+ SmallVector<SDValue, 4 > Opers;
6922
+ Opers.push_back (Chain);
6923
+ if (FPI.isUnaryOp ()) {
6924
+ Opers.push_back (getValue (FPI.getArgOperand (0 )));
6925
+ } else if (FPI.isTernaryOp ()) {
6926
+ Opers.push_back (getValue (FPI.getArgOperand (0 )));
6927
+ Opers.push_back (getValue (FPI.getArgOperand (1 )));
6928
+ Opers.push_back (getValue (FPI.getArgOperand (2 )));
6929
+ } else {
6930
+ Opers.push_back (getValue (FPI.getArgOperand (0 )));
6931
+ Opers.push_back (getValue (FPI.getArgOperand (1 )));
6932
+ }
6933
+
6914
6934
unsigned Opcode;
6915
6935
switch (FPI.getIntrinsicID ()) {
6916
6936
default : llvm_unreachable (" Impossible intrinsic" ); // Can't reach here.
@@ -6940,6 +6960,8 @@ void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
6940
6960
break ;
6941
6961
case Intrinsic::experimental_constrained_fptrunc:
6942
6962
Opcode = ISD::STRICT_FP_ROUND;
6963
+ Opers.push_back (DAG.getTargetConstant (0 , sdl,
6964
+ TLI.getPointerTy (DAG.getDataLayout ())));
6943
6965
break ;
6944
6966
case Intrinsic::experimental_constrained_fpext:
6945
6967
Opcode = ISD::STRICT_FP_EXTEND;
@@ -7011,31 +7033,9 @@ void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
7011
7033
Opcode = ISD::STRICT_FTRUNC;
7012
7034
break ;
7013
7035
}
7014
- const TargetLowering &TLI = DAG.getTargetLoweringInfo ();
7015
- SDValue Chain = getRoot ();
7016
- SmallVector<EVT, 4 > ValueVTs;
7017
- ComputeValueVTs (TLI, DAG.getDataLayout (), FPI.getType (), ValueVTs);
7018
- ValueVTs.push_back (MVT::Other); // Out chain
7019
7036
7020
7037
SDVTList VTs = DAG.getVTList (ValueVTs);
7021
- SDValue Result;
7022
- if (Opcode == ISD::STRICT_FP_ROUND)
7023
- Result = DAG.getNode (Opcode, sdl, VTs,
7024
- { Chain, getValue (FPI.getArgOperand (0 )),
7025
- DAG.getTargetConstant (0 , sdl,
7026
- TLI.getPointerTy (DAG.getDataLayout ())) });
7027
- else if (FPI.isUnaryOp ())
7028
- Result = DAG.getNode (Opcode, sdl, VTs,
7029
- { Chain, getValue (FPI.getArgOperand (0 )) });
7030
- else if (FPI.isTernaryOp ())
7031
- Result = DAG.getNode (Opcode, sdl, VTs,
7032
- { Chain, getValue (FPI.getArgOperand (0 )),
7033
- getValue (FPI.getArgOperand (1 )),
7034
- getValue (FPI.getArgOperand (2 )) });
7035
- else
7036
- Result = DAG.getNode (Opcode, sdl, VTs,
7037
- { Chain, getValue (FPI.getArgOperand (0 )),
7038
- getValue (FPI.getArgOperand (1 )) });
7038
+ SDValue Result = DAG.getNode (Opcode, sdl, VTs, Opers);
7039
7039
7040
7040
if (FPI.getExceptionBehavior () !=
7041
7041
ConstrainedFPIntrinsic::ExceptionBehavior::ebIgnore) {
0 commit comments