[llvm] [RISCV] Implement EmitTargetCodeForMemset for Xqcilsm (PR #151555)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 3 22:49:27 PDT 2025


================
@@ -62,3 +64,91 @@ void RISCVSelectionDAGInfo::verifyTargetNode(const SelectionDAG &DAG,
   }
 #endif
 }
+
+SDValue RISCVSelectionDAGInfo::EmitTargetCodeForMemset(
+    SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src,
+    SDValue Size, Align Alignment, bool isVolatile, bool AlwaysInline,
+    MachinePointerInfo DstPtrInfo) const {
+  const auto &Subtarget = DAG.getSubtarget<RISCVSubtarget>();
+  // We currently do this only for Xqcilsm
+  if (!Subtarget.hasVendorXqcilsm())
+    return SDValue();
+
+  // Do this only if we know the size at compile time.
+  ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size);
+  if (!ConstantSize)
+    return SDValue();
+
+  uint64_t NumberOfBytesToWrite = ConstantSize->getZExtValue();
+
+  // Do this only if it is word aligned and we write multiple of 4 bytes.
----------------
topperc wrote:

```suggestion
  // Do this only if it is word aligned and we write a multiple of 4 bytes.
```

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


More information about the llvm-commits mailing list