================
@@ -3540,6 +3540,41 @@ def CIR_MemCpyOp : CIR_MemOp<"libc.memcpy"> {
 
 // TODO: MemMoveOp
 
+//===----------------------------------------------------------------------===//
+// MemSetOp
+//===----------------------------------------------------------------------===//
+
+def CIR_MemSetOp : CIR_Op<"libc.memset"> {
+  let summary = "Equivalent to libc's `memset`";
+  let description = [{
+    Given the CIR pointer, `dst`, `cir.libc.memset` will set the first `len`
+    bytes of the memory pointed by `dst` to the specified `val`.
+
+    Examples:
+
+    ```mlir
+      // Set 2 bytes from a record to 0:
+      %2 = cir.const #cir.int<2> : !u32i
+      %3 = cir.const #cir.int<0> : !u32i
+      %zero = cir.cast integral %3 : !s32i -> !u8i
+      cir.libc.memset %2 bytes from %record set to %zero : !cir.ptr<!void>,
----------------
erichkeane wrote:

Hrmph... ok, those are fine then.  Slight preference to omit 'set' to be more 
like memcpy, but otherwise no concern as their is prior art.

https://github.com/llvm/llvm-project/pull/178806
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to