Skip to content

Commit 15c1bd9

Browse files
author
git apple-llvm automerger
committed
Merge commit 'd3949c6f6f39' from apple/master into swift/master-next
2 parents f1e4c7b + d3949c6 commit 15c1bd9

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6911,6 +6911,26 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
69116911
void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
69126912
const ConstrainedFPIntrinsic &FPI) {
69136913
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+
69146934
unsigned Opcode;
69156935
switch (FPI.getIntrinsicID()) {
69166936
default: llvm_unreachable("Impossible intrinsic"); // Can't reach here.
@@ -6940,6 +6960,8 @@ void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
69406960
break;
69416961
case Intrinsic::experimental_constrained_fptrunc:
69426962
Opcode = ISD::STRICT_FP_ROUND;
6963+
Opers.push_back(DAG.getTargetConstant(0, sdl,
6964+
TLI.getPointerTy(DAG.getDataLayout())));
69436965
break;
69446966
case Intrinsic::experimental_constrained_fpext:
69456967
Opcode = ISD::STRICT_FP_EXTEND;
@@ -7011,31 +7033,9 @@ void SelectionDAGBuilder::visitConstrainedFPIntrinsic(
70117033
Opcode = ISD::STRICT_FTRUNC;
70127034
break;
70137035
}
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
70197036

70207037
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);
70397039

70407040
if (FPI.getExceptionBehavior() !=
70417041
ConstrainedFPIntrinsic::ExceptionBehavior::ebIgnore) {

0 commit comments

Comments
 (0)