Skip to content

Conversation

@ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Mar 13, 2025

Copy link
Contributor Author

ilovepi commented Mar 13, 2025

@ilovepi ilovepi marked this pull request as ready for review March 13, 2025 18:20
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:RISC-V clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Mar 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-clang-driver
@llvm/pr-subscribers-backend-risc-v

@llvm/pr-subscribers-clang

Author: Paul Kirth (ilovepi)

Changes

Fuchsia supports RVA22 + Vector as outlined in https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0234_riscv_abi_rva22+v?hl=en


Full diff: https://github.com/llvm/llvm-project/pull/131183.diff

2 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Arch/RISCV.cpp (+4-1)
  • (modified) clang/test/Driver/riscv-features.c (+12)
diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
index 776dc81027046..a6c29af1df762 100644
--- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -325,7 +325,8 @@ std::string riscv::getRISCVArch(const llvm::opt::ArgList &Args,
     if (MABI.starts_with_insensitive("lp64")) {
       if (Triple.isAndroid())
         return "rv64imafdcv_zba_zbb_zbs";
-
+      if(Triple.isOSFuchsia())
+        return "rva22u64_v";
       return "rv64imafdc";
     }
   }
@@ -345,6 +346,8 @@ std::string riscv::getRISCVArch(const llvm::opt::ArgList &Args,
     return "rv64imac";
   if (Triple.isAndroid())
     return "rv64imafdcv_zba_zbb_zbs";
+  if (Triple.isOSFuchsia())
+    return "rva22u64_v";
   return "rv64imafdc";
 }
 
diff --git a/clang/test/Driver/riscv-features.c b/clang/test/Driver/riscv-features.c
index b58ec3b523e5c..80dec2c71f985 100644
--- a/clang/test/Driver/riscv-features.c
+++ b/clang/test/Driver/riscv-features.c
@@ -73,3 +73,15 @@
 
 // ERR-SPLIT-DWARF: error: -gsplit-dwarf{{.*}} is unsupported with RISC-V linker relaxation (-mrelax)
 // SPLIT-DWARF:     "-split-dwarf-file"
+
+// RUN: %clang -mabi=lp64d --target=riscv64-unknown-fuchsia -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=FUCHSIA
+// FUCHSIA: "-target-feature" "+m"
+// FUCHSIA-SAME: "-target-feature" "+a"
+// FUCHSIA-SAME: "-target-feature" "+f"
+// FUCHSIA-SAME: "-target-feature" "+d"
+// FUCHSIA-SAME: "-target-feature" "+c"
+// FUCHSIA-SAME: "-target-feature" "+v"
+// FUCHSIA-SAME: "-target-feature" "+zba"
+// FUCHSIA-SAME: "-target-feature" "+zbb"
+// FUCHSIA-SAME: "-target-feature" "+zbs"
+

@github-actions
Copy link

github-actions bot commented Mar 13, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@ilovepi ilovepi requested review from frobtech and hiraditya March 13, 2025 18:21
Copy link
Collaborator

@hiraditya hiraditya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from users/ilovepi/driver-cleanup to main March 17, 2025 17:33
@ilovepi ilovepi force-pushed the users/ilovepi/fuchsia-rv-default branch from e36cc43 to 8ea1c37 Compare March 17, 2025 17:35
@ilovepi ilovepi force-pushed the users/ilovepi/fuchsia-rv-default branch from 8ea1c37 to 30a2a3b Compare March 17, 2025 18:01
Copy link
Contributor Author

ilovepi commented Mar 17, 2025

Merge activity

  • Mar 17, 7:02 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Mar 17, 7:03 PM EDT: A user merged this pull request with Graphite.

@ilovepi ilovepi merged commit 541b8f2 into main Mar 17, 2025
11 checks passed
@ilovepi ilovepi deleted the users/ilovepi/fuchsia-rv-default branch March 17, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:RISC-V clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants