Skip to content

Commit 1f66724

Browse files
committed
[AArch64] Create a performRNDRCombine to pull code out of PerformDAGCombine. NFC
1 parent e9259a4 commit 1f66724

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26926,6 +26926,23 @@ static SDValue performSHLCombine(SDNode *N,
2692626926
return DAG.getNode(ISD::AND, DL, VT, NewShift, NewRHS);
2692726927
}
2692826928

26929+
static SDValue performRNDRCombine(SDNode *N, SelectionDAG &DAG) {
26930+
unsigned IntrinsicID = N->getConstantOperandVal(1);
26931+
auto Register =
26932+
(IntrinsicID == Intrinsic::aarch64_rndr ? AArch64SysReg::RNDR
26933+
: AArch64SysReg::RNDRRS);
26934+
SDLoc DL(N);
26935+
SDValue A = DAG.getNode(
26936+
AArch64ISD::MRS, DL, DAG.getVTList(MVT::i64, FlagsVT, MVT::Other),
26937+
N->getOperand(0), DAG.getConstant(Register, DL, MVT::i32));
26938+
SDValue B = DAG.getNode(
26939+
AArch64ISD::CSINC, DL, MVT::i32, DAG.getConstant(0, DL, MVT::i32),
26940+
DAG.getConstant(0, DL, MVT::i32),
26941+
DAG.getConstant(AArch64CC::NE, DL, MVT::i32), A.getValue(1));
26942+
return DAG.getMergeValues(
26943+
{A, DAG.getZExtOrTrunc(B, DL, MVT::i1), A.getValue(2)}, DL);
26944+
}
26945+
2692926946
SDValue AArch64TargetLowering::PerformDAGCombine(SDNode *N,
2693026947
DAGCombinerInfo &DCI) const {
2693126948
SelectionDAG &DAG = DCI.DAG;
@@ -27241,22 +27258,8 @@ SDValue AArch64TargetLowering::PerformDAGCombine(SDNode *N,
2724127258
case Intrinsic::aarch64_sve_st1_scatter_scalar_offset:
2724227259
return performScatterStoreCombine(N, DAG, AArch64ISD::SST1_IMM_PRED);
2724327260
case Intrinsic::aarch64_rndr:
27244-
case Intrinsic::aarch64_rndrrs: {
27245-
unsigned IntrinsicID = N->getConstantOperandVal(1);
27246-
auto Register =
27247-
(IntrinsicID == Intrinsic::aarch64_rndr ? AArch64SysReg::RNDR
27248-
: AArch64SysReg::RNDRRS);
27249-
SDLoc DL(N);
27250-
SDValue A = DAG.getNode(
27251-
AArch64ISD::MRS, DL, DAG.getVTList(MVT::i64, FlagsVT, MVT::Other),
27252-
N->getOperand(0), DAG.getConstant(Register, DL, MVT::i32));
27253-
SDValue B = DAG.getNode(
27254-
AArch64ISD::CSINC, DL, MVT::i32, DAG.getConstant(0, DL, MVT::i32),
27255-
DAG.getConstant(0, DL, MVT::i32),
27256-
DAG.getConstant(AArch64CC::NE, DL, MVT::i32), A.getValue(1));
27257-
return DAG.getMergeValues(
27258-
{A, DAG.getZExtOrTrunc(B, DL, MVT::i1), A.getValue(2)}, DL);
27259-
}
27261+
case Intrinsic::aarch64_rndrrs:
27262+
return performRNDRCombine(N, DAG);
2726027263
case Intrinsic::aarch64_sme_ldr_zt:
2726127264
return DAG.getNode(AArch64ISD::RESTORE_ZT, SDLoc(N),
2726227265
DAG.getVTList(MVT::Other), N->getOperand(0),

0 commit comments

Comments
 (0)