[llvm] [IR] Initial introduction of memset_pattern (PR #97583)
Björn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 02:29:22 PDT 2024
================
@@ -15230,6 +15230,62 @@ The behavior of '``llvm.memset.inline.*``' is equivalent to the behavior of
'``llvm.memset.*``', but the generated code is guaranteed not to call any
external functions.
+.. _int_memset_pattern:
+
+'``llvm.memset.pattern``' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+This is an overloaded intrinsic. You can use ``llvm.memset_pattern`` on
+any integer bit width that is an integral number of bytes and for different
+address spaces. Not all targets support all bit widths however.
+
+::
+
+ declare void @llvm.memset.pattern.p0.i64.i128(ptr <dest>, i128 <val>,
+ i64 <len>, i1 <isvolatile>)
+
+Overview:
+"""""""""
+
+The '``llvm.memset.pattern.*``' intrinsics fill a block of memory with
+a particular value. This may be expanded to an inline loop, a sequence of
+stores, or a libcall depending on what is available for the target and the
+expected performance and code size impact.
+
+Arguments:
+""""""""""
+
+The first argument is a pointer to the destination to fill, the second
+is the value with which to fill it, the third argument is an integer
+argument specifying the number of times to fill the value, and the fourth is a
+boolean indicating a volatile access.
+
+The :ref:`align <attr_align>` parameter attribute can be provided
+for the first argument.
+
+If the ``isvolatile`` parameter is ``true``, the
+``llvm.memset.pattern`` call is a :ref:`volatile operation <volatile>`. The
+detailed access behavior is not very cleanly specified and it is unwise to
+depend on it.
+
+Semantics:
+""""""""""
+
+The '``llvm.memset.pattern*``' intrinsic fills "len" bytes of memory
----------------
bjope wrote:
Here it says that `len` is bytes of memory, while above it says it is the number of times the pattern should be repeated. Confusing. But maybe we haven't settled if the pattern is allowed to be non-byte-sized or not.
https://github.com/llvm/llvm-project/pull/97583
More information about the llvm-commits
mailing list