Index: clang/include/clang/Basic/BuiltinsAArch64.def =================================================================== --- clang/include/clang/Basic/BuiltinsAArch64.def +++ clang/include/clang/Basic/BuiltinsAArch64.def @@ -59,15 +59,15 @@ TARGET_BUILTIN(__builtin_arm_crc32cd, "UiUiWUi", "nc", "crc") // Memory Tagging Extensions (MTE) -BUILTIN(__builtin_arm_irg, "v*v*Ui", "t") -BUILTIN(__builtin_arm_addg, "v*v*Ui", "t") -BUILTIN(__builtin_arm_gmi, "Uiv*Ui", "t") -BUILTIN(__builtin_arm_ldg, "v*v*", "t") -BUILTIN(__builtin_arm_stg, "vv*", "t") -BUILTIN(__builtin_arm_subp, "Uiv*v*", "t") +TARGET_BUILTIN(__builtin_arm_irg, "v*v*Ui", "t", "mte") +TARGET_BUILTIN(__builtin_arm_addg, "v*v*Ui", "t", "mte") +TARGET_BUILTIN(__builtin_arm_gmi, "Uiv*Ui", "t", "mte") +TARGET_BUILTIN(__builtin_arm_ldg, "v*v*", "t", "mte") +TARGET_BUILTIN(__builtin_arm_stg, "vv*", "t", "mte") +TARGET_BUILTIN(__builtin_arm_subp, "Uiv*v*", "t", "mte") // Memory Operations -BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "") +TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops") // Memory barrier BUILTIN(__builtin_arm_dmb, "vUi", "nc") Index: clang/lib/Headers/arm_acle.h =================================================================== --- clang/lib/Headers/arm_acle.h +++ clang/lib/Headers/arm_acle.h @@ -722,17 +722,15 @@ #define __arm_wsrf64(sysreg, v) __arm_wsr64(sysreg, __builtin_bit_cast(uint64_t, v)) /* Memory Tagging Extensions (MTE) Intrinsics */ -#if defined(__ARM_FEATURE_MEMORY_TAGGING) && __ARM_FEATURE_MEMORY_TAGGING +#if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE #define __arm_mte_create_random_tag(__ptr, __mask) __builtin_arm_irg(__ptr, __mask) #define __arm_mte_increment_tag(__ptr, __tag_offset) __builtin_arm_addg(__ptr, __tag_offset) #define __arm_mte_exclude_tag(__ptr, __excluded) __builtin_arm_gmi(__ptr, __excluded) #define __arm_mte_get_tag(__ptr) __builtin_arm_ldg(__ptr) #define __arm_mte_set_tag(__ptr) __builtin_arm_stg(__ptr) #define __arm_mte_ptrdiff(__ptra, __ptrb) __builtin_arm_subp(__ptra, __ptrb) -#endif /* Memory Operations Intrinsics */ -#if defined(__ARM_FEATURE_MOPS) && __ARM_FEATURE_MOPS && defined(__ARM_FEATURE_MEMORY_TAGGING) && __ARM_FEATURE_MEMORY_TAGGING #define __arm_mops_memset_tag(__tagged_address, __value, __size) \ __builtin_arm_mops_memset_tag(__tagged_address, __value, __size) #endif