diff --git a/clang/test/Driver/riscv-arch.c b/clang/test/Driver/riscv-arch.c --- a/clang/test/Driver/riscv-arch.c +++ b/clang/test/Driver/riscv-arch.c @@ -218,16 +218,6 @@ // RV32-ORDER: error: invalid arch name 'rv32imcq', // RV32-ORDER: standard user-level extension not given in canonical order 'q' -// RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32f -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZVE32F-ER %s -// RV32-ZVE32F-ER: error: invalid arch name 'rv32izve32f', -// RV32-ZVE32F-ER: 'zve32f' requires 'f' or 'zfinx' extension to also be specified - -// RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzve64d -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZVE64D-ER %s -// RV32-ZVE64D-ER: error: invalid arch name 'rv32ifzve64d', -// RV32-ZVE64D-ER: 'zve64d' requires 'd' or 'zdinx' extension to also be specified - // RUN: %clang --target=riscv32-unknown-elf -march=rv32izvl64b -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZVL64B-ER %s // RV32-ZVL64B-ER: error: invalid arch name 'rv32izvl64b', @@ -498,10 +488,6 @@ // RV32-ZVE32X-GOODVERS: "-target-feature" "+zve32x" // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32f -### %s -c 2>&1 | \ -// RUN: FileCheck -check-prefix=RV32-ZVE32F-REQUIRE-F %s -// RV32-ZVE32F-REQUIRE-F: error: invalid arch name 'rv32izve32f', 'zve32f' requires 'f' or 'zfinx' extension to also be specified - -// RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzve32f -### %s -c 2>&1 | \ // RUN: FileCheck -check-prefix=RV32-ZVE32F-GOOD %s // RV32-ZVE32F-GOOD: "-target-feature" "+zve32f" @@ -510,18 +496,10 @@ // RV32-ZVE64X: "-target-feature" "+zve64x" // RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64f -### %s -c 2>&1 | \ -// RUN: FileCheck -check-prefix=RV32-ZVE64F-REQUIRE-F %s -// RV32-ZVE64F-REQUIRE-F: error: invalid arch name 'rv32izve64f', 'zve32f' requires 'f' or 'zfinx' extension to also be specified - -// RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzve64f -### %s -c 2>&1 | \ // RUN: FileCheck -check-prefix=RV32-ZVE64F-GOOD %s // RV32-ZVE64F-GOOD: "-target-feature" "+zve64f" -// RUN: %clang --target=riscv32-unknown-elf -march=rv32ifzve64d -### %s -c 2>&1 | \ -// RUN: FileCheck -check-prefix=RV32-ZVE64D-REQUIRE-D %s -// RV32-ZVE64D-REQUIRE-D: error: invalid arch name 'rv32ifzve64d', 'zve64d' requires 'd' or 'zdinx' extension to also be specified - -// RUN: %clang --target=riscv32-unknown-elf -march=rv32ifdzve64d -### %s -c 2>&1 | \ +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64d -### %s -c 2>&1 | \ // RUN: FileCheck -check-prefix=RV32-ZVE64D-GOOD %s // RV32-ZVE64D-GOOD: "-target-feature" "+zve64d" diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp --- a/llvm/lib/Support/RISCVISAInfo.cpp +++ b/llvm/lib/Support/RISCVISAInfo.cpp @@ -848,35 +848,19 @@ } Error RISCVISAInfo::checkDependency() { - bool HasD = Exts.count("d") != 0; bool HasF = Exts.count("f") != 0; bool HasZfinx = Exts.count("zfinx") != 0; - bool HasZdinx = Exts.count("zdinx") != 0; bool HasVector = Exts.count("zve32x") != 0; - bool HasZve32f = Exts.count("zve32f") != 0; - bool HasZve64d = Exts.count("zve64d") != 0; bool HasZvl = MinVLen != 0; if (HasF && HasZfinx) return createStringError(errc::invalid_argument, "'f' and 'zfinx' extensions are incompatible"); - if (HasZve32f && !HasF && !HasZfinx) + if (Exts.count("zvfh") && !Exts.count("zfh") && !Exts.count("zfhmin")) return createStringError( errc::invalid_argument, - "'zve32f' requires 'f' or 'zfinx' extension to also be specified"); - - if (HasZve64d && !HasD && !HasZdinx) - return createStringError( - errc::invalid_argument, - "'zve64d' requires 'd' or 'zdinx' extension to also be specified"); - - if (Exts.count("zvfh") && !Exts.count("zfh") && !Exts.count("zfhmin") && - !Exts.count("zhinx") && !Exts.count("zhinxmin")) - return createStringError( - errc::invalid_argument, - "'zvfh' requires 'zfh', 'zfhmin', 'zhinx' or 'zhinxmin' extension to " - "also be specified"); + "'zvfh' requires 'zfh' or 'zfhmin extension to also be specified"); if (HasZvl && !HasVector) return createStringError( @@ -931,9 +915,9 @@ static const char *ImpliedExtsZkn[] = {"zbkb", "zbkc", "zbkx", "zkne", "zknd", "zknh"}; static const char *ImpliedExtsZks[] = {"zbkb", "zbkc", "zbkx", "zksed", "zksh"}; -static const char *ImpliedExtsZve32f[] = {"zve32x"}; +static const char *ImpliedExtsZve32f[] = {"zve32x", "f"}; static const char *ImpliedExtsZve32x[] = {"zvl32b", "zicsr"}; -static const char *ImpliedExtsZve64d[] = {"zve64f"}; +static const char *ImpliedExtsZve64d[] = {"zve64f", "d"}; static const char *ImpliedExtsZve64f[] = {"zve64x", "zve32f"}; static const char *ImpliedExtsZve64x[] = {"zve32x", "zvl64b"}; static const char *ImpliedExtsZvfh[] = {"zve32f"}; diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td --- a/llvm/lib/Target/RISCV/RISCVFeatures.td +++ b/llvm/lib/Target/RISCV/RISCVFeatures.td @@ -389,7 +389,7 @@ : SubtargetFeature<"zve32f", "HasStdExtZve32f", "true", "'Zve32f' (Vector Extensions for Embedded Processors " "with maximal 32 EEW and F extension)", - [FeatureStdExtZve32x]>; + [FeatureStdExtZve32x, FeatureStdExtF]>; def FeatureStdExtZve64x : SubtargetFeature<"zve64x", "HasStdExtZve64x", "true", @@ -407,13 +407,12 @@ : SubtargetFeature<"zve64d", "HasStdExtZve64d", "true", "'Zve64d' (Vector Extensions for Embedded Processors " "with maximal 64 EEW, F and D extension)", - [FeatureStdExtZve64f]>; + [FeatureStdExtZve64f, FeatureStdExtD]>; def FeatureStdExtV : SubtargetFeature<"v", "HasStdExtV", "true", "'V' (Vector Extension for Application Processors)", - [FeatureStdExtZvl128b, FeatureStdExtZve64d, - FeatureStdExtF, FeatureStdExtD]>; + [FeatureStdExtZvl128b, FeatureStdExtZve64d]>; def HasVInstructions : Predicate<"Subtarget->hasVInstructions()">, AssemblerPredicate<