[clang] [clang][FMV] Pass the '+fmv' target-feature when FMV is enabled. (PR #87942)
Alexandros Lamprineas via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 07:43:49 PST 2024
https://github.com/labrinea updated https://github.com/llvm/llvm-project/pull/87942
>From 38eea2eca0a852965f6b3d2037c5c0f2905ce6db Mon Sep 17 00:00:00 2001
From: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
Date: Sun, 7 Apr 2024 16:04:12 +0100
Subject: [PATCH] [clang][FMV] Pass the '+fmv' target-feature when FMV is
enabled.
This will allow the backend to enable the corresponding subtarget
feature (FeatureFMV), which in turn can be queried for llvm codegen
decisions. See #87939 for example.
---
clang/lib/Driver/ToolChains/Clang.cpp | 13 +++++++------
clang/test/Driver/aarch64-features.c | 1 +
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 766a9b91e3c0ad..13dbd8ab261d3d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7815,13 +7815,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
addOutlineAtomicsArgs(D, getToolChain(), Args, CmdArgs, Triple);
- if (Triple.isAArch64() &&
- (Args.hasArg(options::OPT_mno_fmv) ||
- (Triple.isAndroid() && Triple.isAndroidVersionLT(23)) ||
- getToolChain().GetRuntimeLibType(Args) != ToolChain::RLT_CompilerRT)) {
- // Disable Function Multiversioning on AArch64 target.
+ if (Triple.isAArch64()) {
CmdArgs.push_back("-target-feature");
- CmdArgs.push_back("-fmv");
+ if (Args.hasArg(options::OPT_mno_fmv) ||
+ (Triple.isAndroid() && Triple.isAndroidVersionLT(23)) ||
+ getToolChain().GetRuntimeLibType(Args) != ToolChain::RLT_CompilerRT)
+ CmdArgs.push_back("-fmv");
+ else
+ CmdArgs.push_back("+fmv");
}
if (Args.hasFlag(options::OPT_faddrsig, options::OPT_fno_addrsig,
diff --git a/clang/test/Driver/aarch64-features.c b/clang/test/Driver/aarch64-features.c
index d2075c91314a8b..4f401ea65232f2 100644
--- a/clang/test/Driver/aarch64-features.c
+++ b/clang/test/Driver/aarch64-features.c
@@ -24,6 +24,7 @@
// CHECK-FMV-OFF: "-target-feature" "-fmv"
// CHECK-FMV-NOT: "-target-feature" "-fmv"
+// CHECK-FMV: "-target-feature" "+fmv"
// Check for AArch64 out-of-line atomics default settings.
// RUN: %clang --target=aarch64-linux-android -rtlib=compiler-rt \
More information about the cfe-commits
mailing list