https://gcc.gnu.org/g:f04c6c499575ae1f51c7d26a57a3353ca71de311

commit r16-6157-gf04c6c499575ae1f51c7d26a57a3353ca71de311
Author: Claudiu Zissulescu <[email protected]>
Date:   Wed Jul 9 14:46:38 2025 +0300

    target-insns.def: (tag_memory) New pattern.
    
    Add a new target instruction. Hardware-assisted sanitizers on
    architectures providing instructions to tag/untag memory can then
    make use of this new instruction pattern. For example, the
    memtag-stack sanitizer uses these instructions to tag and untag a
    memory granule.
    
            gcc/
            * target-insns.def (tag_memory): New target instruction.
            * doc/md.texi (tag_memory): Add documentation.
    
    Signed-off-by: Claudiu Zissulescu <[email protected]>

Diff:
---
 gcc/doc/md.texi      | 5 +++++
 gcc/target-insns.def | 1 +
 2 files changed, 6 insertions(+)

diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 86ed4ffe1e8e..79588762fd38 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -8679,6 +8679,11 @@ the values were equal.
 If this pattern is not defined, then a plain compare pattern and
 conditional branch pattern is used.
 
+@cindex @code{tag_memory} instruction pattern
+This pattern tags an object that begins at the address specified by
+operand 0, has the byte size indicated by the operand 2, and uses the
+tag from operand 1.
+
 @cindex @code{clear_cache} instruction pattern
 @item @samp{clear_cache}
 This pattern, if defined, flushes the instruction cache for a region of
diff --git a/gcc/target-insns.def b/gcc/target-insns.def
index 59025a20bf7e..16e1d8cf565f 100644
--- a/gcc/target-insns.def
+++ b/gcc/target-insns.def
@@ -102,6 +102,7 @@ DEF_TARGET_INSN (stack_protect_combined_test, (rtx x0, rtx 
x1, rtx x2))
 DEF_TARGET_INSN (stack_protect_test, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1))
+DEF_TARGET_INSN (tag_memory, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (trap, (void))
 DEF_TARGET_INSN (unique, (void))
 DEF_TARGET_INSN (untyped_call, (rtx x0, rtx x1, rtx x2))

Reply via email to