[clang] [Clang][AArch64] Fix checkArmStreamingBuiltin for 'sve-b16b16' (PR #109420)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 24 06:32:12 PDT 2024


================
@@ -1802,9 +1854,29 @@ void SVEEmitter::createStreamingAttrs(raw_ostream &OS, ACLEKind Kind) {
 
     if (Def->isFlagSet(IsStreamingFlag))
       StreamingMap["ArmStreaming"].insert(Def->getMangledName());
-    else if (Def->isFlagSet(VerifyRuntimeMode))
+    else if (Def->isFlagSet(VerifyRuntimeMode)) {
+      // Verify that the target guards contain at least one feature that
+      // actually enables SVE or SME (explicitly, or implicitly). This is needed
+      // for the code in SemaARM.cpp (checkArmStreamingBuiltin) that checks
+      // whether the required runtime mode for an intrinsic matches with the
+      // given set of target features and function attributes.
+      //
+      // The feature lists below must match the disabled features in
+      // 'checkArmStreamingBuiltin'!
+      if (!Def->getSVEGuard().empty() &&
+          !verifyGuard(Def->getSVEGuard(),
+                       {"sve", "sve2", "sve2p1", "sve2-aes", "sve2-sha3",
----------------
sdesmalen-arm wrote:

Thanks for pointing those out!

It's worth saying that we could also implement things differently and require all SVE target guards to have "sve/sve2/sve2p1" as a base, such that `let SVETargetGuard = "sve2-aes"` becomes `let SVETargetGuard = "sve2,sve2-aes"`. That means we need to refactor some of the target guards in the .td files, but it means we don't have to continually add all features that imply sve/sve2/sve2p1 to this list (and the list in SemaARM.cpp). For end-users I think it doesn't matter, the only difference is in the diagnostic which prints the required features for the intrinsic. Perhaps that is the better way forward.

https://github.com/llvm/llvm-project/pull/109420


More information about the cfe-commits mailing list