Skip to content

Commit 541b8f2

Browse files
authored
[clang][driver] Use rva22u64_v as the default march for Fuchsia targets (llvm#131183)
Fuchsia supports RVA22 + Vector as outlined in https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0234_riscv_abi_rva22+v?hl=en
1 parent 584f8cc commit 541b8f2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

clang/lib/Driver/ToolChains/Arch/RISCV.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ std::string riscv::getRISCVArch(const llvm::opt::ArgList &Args,
325325
if (MABI.starts_with_insensitive("lp64")) {
326326
if (Triple.isAndroid())
327327
return "rv64imafdcv_zba_zbb_zbs";
328-
328+
if (Triple.isOSFuchsia())
329+
return "rva22u64_v";
329330
return "rv64imafdc";
330331
}
331332
}
@@ -345,6 +346,8 @@ std::string riscv::getRISCVArch(const llvm::opt::ArgList &Args,
345346
return "rv64imac";
346347
if (Triple.isAndroid())
347348
return "rv64imafdcv_zba_zbb_zbs";
349+
if (Triple.isOSFuchsia())
350+
return "rva22u64_v";
348351
return "rv64imafdc";
349352
}
350353

clang/test/Driver/riscv-features.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,15 @@
7373

7474
// ERR-SPLIT-DWARF: error: -gsplit-dwarf{{.*}} is unsupported with RISC-V linker relaxation (-mrelax)
7575
// SPLIT-DWARF: "-split-dwarf-file"
76+
77+
// RUN: %clang -mabi=lp64d --target=riscv64-unknown-fuchsia -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=FUCHSIA
78+
// FUCHSIA: "-target-feature" "+m"
79+
// FUCHSIA-SAME: "-target-feature" "+a"
80+
// FUCHSIA-SAME: "-target-feature" "+f"
81+
// FUCHSIA-SAME: "-target-feature" "+d"
82+
// FUCHSIA-SAME: "-target-feature" "+c"
83+
// FUCHSIA-SAME: "-target-feature" "+v"
84+
// FUCHSIA-SAME: "-target-feature" "+zba"
85+
// FUCHSIA-SAME: "-target-feature" "+zbb"
86+
// FUCHSIA-SAME: "-target-feature" "+zbs"
87+

0 commit comments

Comments
 (0)