[llvm] [RISCV] Attempt to widen SEW before generic shuffle lowering (PR #122311)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 16:49:47 PST 2025


================
@@ -5261,6 +5261,42 @@ static SDValue lowerDisjointIndicesShuffle(ShuffleVectorSDNode *SVN,
   return DAG.getVectorShuffle(VT, DL, Select, DAG.getUNDEF(VT), NewMask);
 }
 
+/// Try to widen element type to get a new mask value for a better permutation
+/// sequence.  This doesn't try to inspect the widened mask for profitability;
+/// we speculate the widened form is equal or better.  This has the effect of
+/// reducing mask constant sizes - allowing cheaper materialization sequences
+/// - and index sequence sizes - reducing register pressure and materialization
+/// cost, at the cost of (possibly) an extra VTYPE toggle.
+static SDValue tryWidenMaskForShuffle(SDValue Op, SelectionDAG &DAG) {
+  SDLoc DL(Op);
+  EVT VT = Op.getValueType();
----------------
topperc wrote:

Use MVT. It results in less compiled code for getVectorElementType() and .getFixedSizeInBits().

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


More information about the llvm-commits mailing list