[clang] Reland "[clang][CodeGen][X86_64] Honor per-function AVX ABI in C/C++ call paths, maintain old psABI for PlayStation." (PR #210349)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 20 13:01:05 PDT 2026


================
@@ -1822,6 +1826,29 @@ void X86_64ABIInfo::postMerge(unsigned AggregateSize, Class &Lo,
     Hi = SSE;
 }
 
+static X86AVXABILevel getEffectiveX86AVXABILevel(CodeGenTypes &CGT,
+                                                 X86AVXABILevel GlobalAVXLevel,
+                                                 const FunctionDecl *FD) {
+  // Always return global AVX level on PlayStation.
+  if (CGT.getTarget().getTriple().isPS() ||
+      CGT.getContext().getLangOpts().getClangABICompat() <=
+          LangOptions::ClangABI::Ver23) {
+    return GlobalAVXLevel;
+  }
+
+  X86AVXABILevel Level = GlobalAVXLevel;
+  if (!FD || !FD->hasAttr<TargetAttr>())
----------------
efriedma-quic wrote:

Please add a comment noting that TargetVersionAttr isn't relevant for x86. Please leave a FIXME noting you're intentionally leaving out TargetClonesAttr and CPUSpecificAttr for now.

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


More information about the cfe-commits mailing list