[llvm] [DAG] Introduce generic shl_add node [NFC] (PR #88791)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 11:26:55 PDT 2024


================
@@ -46905,12 +46897,18 @@ static SDValue reduceVMULWidth(SDNode *N, SelectionDAG &DAG,
   return DAG.getNode(ISD::CONCAT_VECTORS, DL, VT, ResLo, ResHi);
 }
 
+static SDValue createMulImm(uint64_t MulAmt, SDValue N, SelectionDAG &DAG,
+                            EVT VT, const SDLoc &DL) {
+  assert(MulAmt == 3 || MulAmt == 5 || MulAmt == 9);
+  SDValue ShAmt = DAG.getConstant(Log2_64(MulAmt - 1), DL, MVT::i8);
+  return DAG.getNode(ISD::SHL_ADD, DL, VT, N, ShAmt, N);
----------------
preames wrote:

That... is a good question.  We probably need to freeze here since we're increasing the number of uses, I had not considered that.  Let me add the freeze and see if that influences codegen in practice.  If it does, we may need to consider both a SHL_ADD node and a MUL359 node.  I'm hoping we don't, let me investigate and report back.

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


More information about the llvm-commits mailing list