https://github.com/Lukacma created 
https://github.com/llvm/llvm-project/pull/196526

SVETargetGuard was incorrectly set to just sve-aes2 instructions, even though 
those instructions are available in non-streaming mode with FEAT_SSVE_AES as 
well. Additionally I added sve2p1 as required feature to SVETargetGuard as 
based on 
[spec](https://developer.arm.com/documentation/109697/2025_12/Feature-descriptions/The-Armv9-6-architecture-extension?lang=en#md463-the-armv96-architecture-extension__feat_FEAT_SVE_AES2):

> If FEAT_SVE_AES2 is implemented, then 
> [FEAT_SVE2p1](https://developer.arm.com/documentation/109697/2025_12/Feature-descriptions/The-Armv9-4-architecture-extension?lang=en#md461-the-armv94-architecture-extension__feat_FEAT_SVE2p1)
>  or 
> [FEAT_SSVE_AES](https://developer.arm.com/documentation/109697/2025_12/Feature-descriptions/The-Armv9-6-architecture-extension?lang=en#md463-the-armv96-architecture-extension__feat_FEAT_SSVE_AES)
>  is implemented. 

>From 386ae9fadbbf471c4abf4ee8ad0f4629d25f3621 Mon Sep 17 00:00:00 2001
From: Marian Lukac <[email protected]>
Date: Fri, 8 May 2026 12:33:46 +0000
Subject: [PATCH] [Clang][AArch64] Adjust feature flags for sve-aes2
 instructions

---
 clang/include/clang/Basic/arm_sve.td                  |  2 +-
 .../AArch64/sve2p1-intrinsics/acle_sve2p1_crypto.c    | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/clang/include/clang/Basic/arm_sve.td 
b/clang/include/clang/Basic/arm_sve.td
index ac9f9af30fce7..d42e96ba896f3 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -1924,7 +1924,7 @@ def SVPMULLT_PAIR_U64   : SInst<"svpmullt_pair[_{d}]",   
"ddd", "Ul", MergeNone,
 def SVPMULLT_PAIR_N_U64 : SInst<"svpmullt_pair[_n_{d}]", "dda", "Ul", 
MergeNone, "aarch64_sve_pmullt_pair", [VerifyRuntimeMode]>;
 }
 
-let SVETargetGuard = "sve-aes2", SMETargetGuard = "sve-aes2,ssve-aes" in {
+let SVETargetGuard = "(sve2p1|ssve-aes),sve-aes2", SMETargetGuard = 
"sve-aes2,ssve-aes" in {
 def SVAESD_X2   : SInst<"svaesd_lane[_{d}_x2]",   "22di", "Uc", MergeNone, 
"aarch64_sve_aesd_lane_x2", [IsOverloadNone, VerifyRuntimeMode], [ImmCheck<2, 
ImmCheck0_3>]>;
 def SVAESDIMC_X2 : SInst<"svaesdimc_lane[_{d}_x2]", "22di",  "Uc", MergeNone, 
"aarch64_sve_aesdimc_lane_x2", [IsOverloadNone, VerifyRuntimeMode], 
[ImmCheck<2, ImmCheck0_3>]>;
 def SVAESE_X2   : SInst<"svaese_lane[_{d}_x2]",   "22di", "Uc", MergeNone, 
"aarch64_sve_aese_lane_x2", [IsOverloadNone, VerifyRuntimeMode], [ImmCheck<2, 
ImmCheck0_3>]>;
diff --git a/clang/test/CodeGen/AArch64/sve2p1-intrinsics/acle_sve2p1_crypto.c 
b/clang/test/CodeGen/AArch64/sve2p1-intrinsics/acle_sve2p1_crypto.c
index 43126d2ea0cd8..5124309573c0c 100644
--- a/clang/test/CodeGen/AArch64/sve2p1-intrinsics/acle_sve2p1_crypto.c
+++ b/clang/test/CodeGen/AArch64/sve2p1-intrinsics/acle_sve2p1_crypto.c
@@ -1,14 +1,15 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature 
+sve -target-feature +sve-aes2 -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck 
%s
-// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature 
+sve -target-feature +sve-aes2 -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | 
FileCheck %s -check-prefix=CPP-CHECK
-// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple 
aarch64 -target-feature +sve -target-feature +sve-aes2 -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple 
aarch64 -target-feature +sve -target-feature +sve-aes2 -O1 -Werror -Wall 
-emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature 
+sve -target-feature +sve2p1 -target-feature +sve-aes2 -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature 
+sve -target-feature +ssve-aes -target-feature +sve-aes2 -O1 -Werror -Wall 
-emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
+// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple 
aarch64 -target-feature +sve -target-feature +sve2p1 -target-feature +sve-aes2 
-O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple 
aarch64 -target-feature +sve -target-feature +sve2p1 -target-feature +sve-aes2 
-O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s 
-check-prefix=CPP-CHECK
 
 // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature 
+sme -target-feature +sve-aes2 -target-feature +ssve-aes -O1 -Werror -Wall 
-emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature 
+sme -target-feature +sve-aes2 -target-feature +ssve-aes -O1 -Werror -Wall 
-emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK
 // RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple 
aarch64 -target-feature +sme -target-feature +sve-aes2 -target-feature 
+ssve-aes -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -triple 
aarch64 -target-feature +sme -target-feature +sve-aes2 -target-feature 
+ssve-aes -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s 
-check-prefix=CPP-CHECK
-// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -target-feature 
+sve-aes2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
+// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -target-feature 
+sve2p1 -target-feature +sve-aes2 -S -disable-O0-optnone -Werror -Wall -o 
/dev/null %s
+// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -target-feature 
+ssve-aes -target-feature +sve-aes2 -S -disable-O0-optnone -Werror -Wall -o 
/dev/null %s
 // RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature 
+sve-aes2 -target-feature +ssve-aes -S -disable-O0-optnone -Werror -Wall -o 
/dev/null %s
 
 // REQUIRES: aarch64-registered-target

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

Reply via email to