[llvm] [RISCV] Fold (vXi8 (trunc (vselect (setltu, X, 256), X, (sext (setgt X, 0))))) to vmax+vnclipu. (PR #94720)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 09:55:00 PDT 2024


================
@@ -13370,6 +13371,76 @@ static SDValue combineDeMorganOfBoolean(SDNode *N, SelectionDAG &DAG) {
   return DAG.getNode(ISD::XOR, DL, VT, Logic, DAG.getConstant(1, DL, VT));
 }
 
+// Fold (vXi8 (trunc (vselect (setltu, X, 256), X, (sext (setgt X, 0))))) to
----------------
topperc wrote:

> If we have (vselect (X > 0), 255, 0) - and variants - do we reliably combine that into the sext of condition form?

I think InstCombine and DAGCombine both will from a quick test.

https://github.com/llvm/llvm-project/pull/94720


More information about the llvm-commits mailing list