[llvm] [RISCV] Canonicalize the true operand of vselect to fold more vmerge.vvm instructions (PR #206449)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 10:58:24 PDT 2026
================
@@ -20430,16 +20461,24 @@ static bool matchSelectAddSub(SDValue TrueVal, SDValue FalseVal, bool &SwapCC) {
(TrueVal.getOperand(1) == A && TrueVal.getOperand(0) == B));
}
-/// Convert vselect CC, (add a, b), (sub a, b) to add a, (vselect CC, -b, b).
-/// This allows us match a vadd.vv fed by a masked vrsub, which reduces
-/// register pressure over the add followed by masked vsub sequence.
-static SDValue performVSELECTCombine(SDNode *N, SelectionDAG &DAG) {
+static SDValue performVSELECTCombine(SDNode *N, SelectionDAG &DAG,
+ const RISCVSubtarget &Subtarget) {
SDLoc DL(N);
EVT VT = N->getValueType(0);
SDValue CC = N->getOperand(0);
SDValue TrueVal = N->getOperand(1);
SDValue FalseVal = N->getOperand(2);
+ // Convert (vselect CC, true, false) to (vselect InvertCC, false, true when)
----------------
lenary wrote:
```suggestion
// Convert (vselect CC, true, false) to (vselect InvertCC, false, true) when
```
https://github.com/llvm/llvm-project/pull/206449
More information about the llvm-commits
mailing list