[clang] 6bcf57f - Enable zbb for riscv android
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 13 12:30:12 PDT 2023
Author: AdityaK
Date: 2023-06-13T12:30:04-07:00
New Revision: 6bcf57f0b7ec8b28e933387a4925dfc52779ce0f
URL: https://github.com/llvm/llvm-project/commit/6bcf57f0b7ec8b28e933387a4925dfc52779ce0f
DIFF: https://github.com/llvm/llvm-project/commit/6bcf57f0b7ec8b28e933387a4925dfc52779ce0f.diff
LOG: Enable zbb for riscv android
Differential Revision: https://reviews.llvm.org/D152729
Reviewers: enh, pirama, jrtc27
Added:
Modified:
clang/lib/Driver/ToolChains/Arch/RISCV.cpp
clang/test/Driver/riscv-features.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
index f47a6a592f0d1..1c342d5765bfb 100644
--- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -292,8 +292,12 @@ StringRef riscv::getRISCVArch(const llvm::opt::ArgList &Args,
return "rv32e";
else if (MABI.starts_with_insensitive("ilp32"))
return "rv32imafdc";
- else if (MABI.starts_with_insensitive("lp64"))
+ else if (MABI.starts_with_insensitive("lp64")) {
+ if (Triple.isAndroid())
+ return "rv64imafdc_zbb";
+
return "rv64imafdc";
+ }
}
// 4. Choose a default based on the triple
@@ -309,6 +313,8 @@ StringRef riscv::getRISCVArch(const llvm::opt::ArgList &Args,
} else {
if (Triple.getOS() == llvm::Triple::UnknownOS)
return "rv64imac";
+ else if (Triple.isAndroid())
+ return "rv64imafdc_zbb";
else
return "rv64imafdc";
}
diff --git a/clang/test/Driver/riscv-features.c b/clang/test/Driver/riscv-features.c
index b189fdeacec8c..78d3b2d3baecf 100644
--- a/clang/test/Driver/riscv-features.c
+++ b/clang/test/Driver/riscv-features.c
@@ -1,5 +1,7 @@
// RUN: %clang --target=riscv32-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s
// RUN: %clang --target=riscv64-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT
+// RUN: %clang -mabi=lp64d --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT
// CHECK: fno-signed-char
@@ -8,6 +10,7 @@
// RUN: %clang --target=riscv32-unknown-elf -### %s -mrelax 2>&1 | FileCheck %s -check-prefix=RELAX
// RUN: %clang --target=riscv32-unknown-elf -### %s -mno-relax 2>&1 | FileCheck %s -check-prefix=NO-RELAX
+// ANDROID: "-target-feature" "+zbb"
// RELAX: "-target-feature" "+relax"
// NO-RELAX: "-target-feature" "-relax"
// DEFAULT: "-target-feature" "+relax"
More information about the cfe-commits
mailing list