[llvm] [LegalizeVectorOps][RISCV] Don't promote VP_FABS/FNEG/FCOPYSIGN. (PR #106659)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 30 00:01:52 PDT 2024
================
@@ -1557,6 +1583,80 @@ SDValue VectorLegalizer::ExpandVP_REM(SDNode *Node) {
return DAG.getNode(ISD::VP_SUB, DL, VT, Dividend, Mul, Mask, EVL);
}
+SDValue VectorLegalizer::ExpandVP_FNEG(SDNode *Node) {
+ EVT VT = Node->getValueType(0);
+ EVT IntVT = VT.changeVectorElementTypeToInteger();
+
+ if (!TLI.isOperationLegalOrCustom(ISD::VP_XOR, IntVT))
+ return SDValue();
+
+ SDValue Mask = Node->getOperand(1);
+ SDValue EVL = Node->getOperand(2);
+
+ SDLoc DL(Node);
+ SDValue Cast = DAG.getNode(ISD::BITCAST, DL, IntVT, Node->getOperand(0));
+ SDValue SignMask = DAG.getConstant(
+ APInt::getSignMask(IntVT.getScalarSizeInBits()), DL, IntVT);
+ SDValue Xor = DAG.getNode(ISD::VP_XOR, DL, IntVT, Cast, SignMask, Mask, EVL);
+ return DAG.getNode(ISD::BITCAST, DL, VT, Xor);
----------------
lukel97 wrote:
Ah yup, I needed to do a git pull
https://github.com/llvm/llvm-project/pull/106659
More information about the llvm-commits
mailing list