[clang] 2800d57 - [RISCV] Error if F and Zfinx extensions are specified together.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 10 11:26:15 PST 2023
Author: Craig Topper
Date: 2023-03-10T11:26:00-08:00
New Revision: 2800d57e124a605c069a4d4024e73089b2783250
URL: https://github.com/llvm/llvm-project/commit/2800d57e124a605c069a4d4024e73089b2783250
DIFF: https://github.com/llvm/llvm-project/commit/2800d57e124a605c069a4d4024e73089b2783250.diff
LOG: [RISCV] Error if F and Zfinx extensions are specified together.
Fixes #61277
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D145809
Added:
Modified:
clang/test/Driver/riscv-arch.c
llvm/lib/Support/RISCVISAInfo.cpp
Removed:
################################################################################
diff --git a/clang/test/Driver/riscv-arch.c b/clang/test/Driver/riscv-arch.c
index 3e9ff82fc8cf7..790a9d8603512 100644
--- a/clang/test/Driver/riscv-arch.c
+++ b/clang/test/Driver/riscv-arch.c
@@ -583,3 +583,13 @@
// RUN: %clang -target riscv32-unknown-elf -march=rv32i_zmmul1p0 -### %s \
// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZMMUL-GOODVERS %s
// RV32-ZMMUL-GOODVERS: "-target-feature" "+zmmul"
+
+// RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzfinx -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-F-ZFINX-ER %s
+// RV32-F-ZFINX-ER: error: invalid arch name 'rv32ifzfinx',
+// RV32-F-ZFINX-ER: 'f' and 'zfinx' extensions are incompatible
+
+// RUN: %clang --target=riscv32-unknown-elf -march=rv32idzdinx -### %s \
+// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-D-ZDINX-ER %s
+// RV32-D-ZDINX-ER: error: invalid arch name 'rv32idzdinx',
+// RV32-D-ZFINX-ER: 'f' and 'zfinx' extensions are incompatible
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index fe923aa756832..dfa1c5539f08e 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -839,6 +839,10 @@ Error RISCVISAInfo::checkDependency() {
errc::invalid_argument,
"standard user-level extension 'e' requires 'rv32'");
+ if (HasF && HasZfinx)
+ return createStringError(errc::invalid_argument,
+ "'f' and 'zfinx' extensions are incompatible");
+
if (HasZve32f && !HasF && !HasZfinx)
return createStringError(
errc::invalid_argument,
More information about the cfe-commits
mailing list