[clang] [SPARC] Enable +ua2007 for -Av8plusd/-Av9d (PR #234060)

Ying Huang via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 20:19:12 PDT 2026


https://github.com/yingopq updated https://github.com/llvm/llvm-project/pull/234060

>From 96321a34517d8569ce3a70cf98ddfe6b406ccecb Mon Sep 17 00:00:00 2001
From: Ying Huang <ying.huang at oss.cipunited.com>
Date: Wed, 21 Oct 2026 11:10:41 +0800
Subject: [PATCH 1/2] [SPARC] Enable +ua2007 for -Av8plusd/-Av9d

FMA instructions are modeled under ua2007, but the mappings for
-Av8plusd/-Av9d omitted it, so `fmadds` failed to assemble with
"instruction requires a CPU feature not currently enabled". Add
+ua2007 to match GNU as.

Fix #225925.
---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 ++--
 clang/test/Driver/sparc-ias-Wa.s      | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index e856952e196886..e6ee08daf831f0 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2798,11 +2798,11 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
                 .Case("-Av8plus", {"+v8plus", "+v9"})
                 .Case("-Av8plusa", {"+v8plus", "+v9", "+vis"})
                 .Case("-Av8plusb", {"+v8plus", "+v9", "+vis", "+vis2"})
-                .Case("-Av8plusd", {"+v8plus", "+v9", "+vis", "+vis2", "+vis3"})
+                .Case("-Av8plusd", {"+v8plus", "+v9", "+vis", "+vis2", "+vis3", "+ua2007"})
                 .Case("-Av9", {"+v9"})
                 .Case("-Av9a", {"+v9", "+vis"})
                 .Case("-Av9b", {"+v9", "+vis", "+vis2"})
-                .Case("-Av9d", {"+v9", "+vis", "+vis2", "+vis3"})
+                .Case("-Av9d", {"+v9", "+vis", "+vis2", "+vis3", "+ua2007"})
                 .Default({});
         if (!SparcTargetFeatures.empty())
           continue;
diff --git a/clang/test/Driver/sparc-ias-Wa.s b/clang/test/Driver/sparc-ias-Wa.s
index c031f237297d3b..1c4b48ef777d3f 100644
--- a/clang/test/Driver/sparc-ias-Wa.s
+++ b/clang/test/Driver/sparc-ias-Wa.s
@@ -32,6 +32,7 @@
 // V8PLUSD: "-target-feature" "+vis"
 // V8PLUSD: "-target-feature" "+vis2"
 // V8PLUSD: "-target-feature" "+vis3"
+// V8PLUSD: "-target-feature" "+ua2007"
 
 // RUN: %clang --target=sparc-linux-gnu -### -fintegrated-as -c %s -Wa,-Av9 2>&1 | \
 // RUN:   FileCheck -check-prefix=V9 %s
@@ -58,6 +59,7 @@
 // V9D: "-target-feature" "+vis"
 // V9D: "-target-feature" "+vis2"
 // V9D: "-target-feature" "+vis3"
+// V9D: "-target-feature" "+ua2007"
 
 // RUN: %clang --target=sparc64-linux-gnu -### -fintegrated-as -c %s 2>&1 | \
 // RUN:   FileCheck -check-prefix=VIS-DEFAULT %s

>From 9fee84d84626a82798adec0efb5f83241a14c502 Mon Sep 17 00:00:00 2001
From: Ying Huang <ying.huang at oss.cipunited.com>
Date: Wed, 21 Oct 2026 11:18:11 +0800
Subject: [PATCH 2/2] Fix clang-format info

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index e6ee08daf831f0..ded1eee2e5f669 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2798,7 +2798,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
                 .Case("-Av8plus", {"+v8plus", "+v9"})
                 .Case("-Av8plusa", {"+v8plus", "+v9", "+vis"})
                 .Case("-Av8plusb", {"+v8plus", "+v9", "+vis", "+vis2"})
-                .Case("-Av8plusd", {"+v8plus", "+v9", "+vis", "+vis2", "+vis3", "+ua2007"})
+                .Case("-Av8plusd",
+                      {"+v8plus", "+v9", "+vis", "+vis2", "+vis3", "+ua2007"})
                 .Case("-Av9", {"+v9"})
                 .Case("-Av9a", {"+v9", "+vis"})
                 .Case("-Av9b", {"+v9", "+vis", "+vis2"})



More information about the cfe-commits mailing list