[llvm] [Xtensa] Implement lowering SELECT_CC, SETCC. (PR #97017)
Andrei Safronov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 6 17:25:13 PDT 2024
================
@@ -514,6 +530,38 @@ XtensaTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
return DAG.getNode(XtensaISD::RET, DL, MVT::Other, RetOps);
}
+SDValue XtensaTargetLowering::LowerSELECT_CC(SDValue Op,
+ SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+ EVT Ty = Op.getOperand(0).getValueType();
+ SDValue LHS = Op.getOperand(0);
+ SDValue RHS = Op.getOperand(1);
+ SDValue TrueValue = Op.getOperand(2);
+ SDValue FalseValue = Op.getOperand(3);
+ ISD::CondCode CC = cast<CondCodeSDNode>(Op->getOperand(4))->get();
+ SDValue TargetCC = DAG.getConstant(CC, DL, MVT::i32);
+
+ // Wrap select nodes
+ return DAG.getNode(XtensaISD::SELECT_CC, DL, Ty, LHS, RHS, TrueValue,
+ FalseValue, TargetCC);
+}
+
+SDValue XtensaTargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+ EVT Ty = Op.getOperand(0).getValueType();
+ SDValue LHS = Op.getOperand(0);
+ SDValue RHS = Op.getOperand(1);
+ ISD::CondCode CC = cast<CondCodeSDNode>(Op.getOperand(2))->get();
+ SDValue TargetCC = DAG.getConstant(CC, DL, MVT::i32);
+
+ // Expand to target SELECT_CC
----------------
andreisfr wrote:
Yes, at current stage it produce the same result, so I removed custom setcc lowering, I will add specific version in next patches. Fixed
https://github.com/llvm/llvm-project/pull/97017
More information about the llvm-commits
mailing list