[AArch64] Implement Armv8.5-A memory tagging (MTE) intrinsics

Programming / Compilers / GCC - ktkachov [138bc75d-0d04-0410-961f-82ee72b054a4] - 19 November 2019 13:43 EST

2019-11-19 Dennis Zhang

- config/aarch64/aarch64-builtins.c (enum aarch64_builtins): Add AARCH64_MEMTAG_BUILTIN_START, AARCH64_MEMTAG_BUILTIN_IRG, AARCH64_MEMTAG_BUILTIN_GMI, AARCH64_MEMTAG_BUILTIN_SUBP, AARCH64_MEMTAG_BUILTIN_INC_TAG, AARCH64_MEMTAG_BUILTIN_SET_TAG, AARCH64_MEMTAG_BUILTIN_GET_TAG, and AARCH64_MEMTAG_BUILTIN_END. (aarch64_init_memtag_builtins): New. (AARCH64_INIT_MEMTAG_BUILTINS_DECL): New macro. (aarch64_general_init_builtins): Call aarch64_init_memtag_builtins. (aarch64_expand_builtin_memtag): New. (aarch64_general_expand_builtin): Call aarch64_expand_builtin_memtag. (AARCH64_BUILTIN_SUBCODE): New macro. (aarch64_resolve_overloaded_memtag): New. (aarch64_resolve_overloaded_builtin_general): New. Call aarch64_resolve_overloaded_memtag to handle overloaded MTE builtins.
- config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Define __ARM_FEATURE_MEMORY_TAGGING when enabled. (aarch64_resolve_overloaded_builtin): Call aarch64_resolve_overloaded_builtin_general.
- config/aarch64/aarch64-protos.h (aarch64_resolve_overloaded_builtin_general): New declaration.
- config/aarch64/aarch64.h (AARCH64_ISA_MEMTAG): New macro. (TARGET_MEMTAG): Likewise.
- config/aarch64/aarch64.md (UNSPEC_GEN_TAG): New unspec. (UNSPEC_GEN_TAG_RND, and UNSPEC_TAG_SPACE): Likewise. (irg, gmi, subp, addg, ldg, stg): New instructions.
- config/aarch64/arm_acle.h (__arm_mte_create_random_tag): New macro. (__arm_mte_exclude_tag, __arm_mte_ptrdiff): Likewise. (__arm_mte_increment_tag, __arm_mte_set_tag): Likewise. (__arm_mte_get_tag): Likewise.
- config/aarch64/predicates.md (aarch64_memtag_tag_offset): New. (aarch64_granule16_uimm6, aarch64_granule16_simm9): New.
- config/arm/types.md (memtag): New.
- doc/invoke.texi (-memtag): Update description.

2019-11-19 Dennis Zhang

- gcc.target/aarch64/acle/memtag_1.c: New test.
- gcc.target/aarch64/acle/memtag_2.c: New test.
- gcc.target/aarch64/acle/memtag_3.c: New test.

fcae029b424 [AArch64] Implement Armv8.5-A memory tagging (MTE) intrinsics
gcc/ChangeLog | 36 ++++
gcc/config/aarch64/aarch64-builtins.c | 234 +++++++++++++++++++++++
gcc/config/aarch64/aarch64-c.c | 5 +-
gcc/config/aarch64/aarch64-protos.h | 2 +
gcc/config/aarch64/aarch64.h | 4 +
gcc/config/aarch64/aarch64.md | 90 +++++++++
gcc/config/aarch64/arm_acle.h | 23 +++
gcc/config/aarch64/predicates.md | 14 ++
gcc/config/arm/types.md | 3 +-
gcc/doc/invoke.texi | 5 +-
gcc/testsuite/ChangeLog | 6 +
gcc/testsuite/gcc.target/aarch64/acle/memtag_1.c | 62 ++++++
gcc/testsuite/gcc.target/aarch64/acle/memtag_2.c | 70 +++++++
gcc/testsuite/gcc.target/aarch64/acle/memtag_3.c | 16 ++
14 files changed, 564 insertions(+), 6 deletions(-)

Upstream: gcc.gnu.org


  • Share