[PATCH] D159145: [RISCV] Don't add -unaligned-scalar-mem to target features by default.
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 29 21:22:53 PDT 2023
craig.topper updated this revision to Diff 554561.
craig.topper added a comment.
Remove change to sifive-x280.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159145/new/
https://reviews.llvm.org/D159145
Files:
clang/lib/Driver/ToolChains/Arch/RISCV.cpp
clang/test/Driver/riscv-default-features.c
clang/test/Driver/riscv-features.c
Index: clang/test/Driver/riscv-features.c
===================================================================
--- clang/test/Driver/riscv-features.c
+++ clang/test/Driver/riscv-features.c
@@ -39,8 +39,6 @@
// NO-UNALIGNED-SCALAR-MEM: "-target-feature" "-unaligned-scalar-mem"
// UNALIGNED-VECTOR-MEM: "-target-feature" "+unaligned-vector-mem"
// NO-UNALIGNED-VECTOR-MEM: "-target-feature" "-unaligned-vector-mem"
-// DEFAULT: "-target-feature" "-unaligned-scalar-mem"
-// DEFAULT-NOT: "-target-feature" "+unaligned-scalar-mem"
// RUN: %clang --target=riscv32-linux -### %s -fsyntax-only 2>&1 \
// RUN: | FileCheck %s -check-prefix=DEFAULT-LINUX
Index: clang/test/Driver/riscv-default-features.c
===================================================================
--- clang/test/Driver/riscv-default-features.c
+++ clang/test/Driver/riscv-default-features.c
@@ -3,10 +3,8 @@
// RV32: "target-features"="+32bit,+a,+c,+m,+relax,
// RV32-SAME: -save-restore
-// RV32-SAME: -unaligned-scalar-mem
// RV64: "target-features"="+64bit,+a,+c,+m,+relax,
// RV64-SAME: -save-restore
-// RV64-SAME: -unaligned-scalar-mem
// Dummy function
int foo(void){
Index: clang/lib/Driver/ToolChains/Arch/RISCV.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -169,15 +169,17 @@
// -mno-unaligned-access is default, unless -munaligned-access is specified.
bool HasV = llvm::is_contained(Features, "+zve32x");
- if (Args.hasFlag(options::OPT_munaligned_access,
- options::OPT_mno_unaligned_access, false)) {
- Features.push_back("+unaligned-scalar-mem");
- if (HasV)
- Features.push_back("+unaligned-vector-mem");
- } else {
- Features.push_back("-unaligned-scalar-mem");
- if (HasV)
- Features.push_back("-unaligned-vector-mem");
+ if (const Arg *A = Args.getLastArg(options::OPT_munaligned_access,
+ options::OPT_mno_unaligned_access)) {
+ if (A->getOption().matches(options::OPT_munaligned_access)) {
+ Features.push_back("+unaligned-scalar-mem");
+ if (HasV)
+ Features.push_back("+unaligned-vector-mem");
+ } else {
+ Features.push_back("-unaligned-scalar-mem");
+ if (HasV)
+ Features.push_back("-unaligned-vector-mem");
+ }
}
// Now add any that the user explicitly requested on the command line,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159145.554561.patch
Type: text/x-patch
Size: 2456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230830/37681647/attachment-0001.bin>
More information about the cfe-commits
mailing list