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 @@ -150,7 +150,7 @@ // RUN: %clang --target=riscv32-unknown-elf -march=rv32id -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ID %s -// RV32ID: error: invalid arch name 'rv32id' +// RV32ID: "-target-feature" "+f" "-target-feature" "+d" // RUN: %clang --target=riscv32-unknown-elf -march=rv32l -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32L %s @@ -178,7 +178,7 @@ // RUN: %clang --target=riscv64-unknown-elf -march=rv64id -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64ID %s -// RV64ID: error: invalid arch name 'rv64id' +// RV64ID: "-target-feature" "+f" "-target-feature" "+d" // RUN: %clang --target=riscv64-unknown-elf -march=rv64l -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64L %s @@ -228,11 +228,6 @@ // RV64-EER: error: invalid arch name 'rv64e', // RV64-EER: standard user-level extension 'e' requires 'rv32' -// RUN: %clang --target=riscv32-unknown-elf -march=rv32id -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-DER %s -// RV32-DER: error: invalid arch name 'rv32id', -// RV32-DER: d requires f extension to also be specified - // 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', 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 @@ -839,14 +839,6 @@ errc::invalid_argument, "standard user-level extension 'e' requires 'rv32'"); - // It's illegal to specify the 'd' (double-precision floating point) - // extension without also specifying the 'f' (single precision - // floating-point) extension. - // TODO: This has been removed in later specs, which specify that D implies F - if (HasD && !HasF) - return createStringError(errc::invalid_argument, - "d requires f extension to also be specified"); - if (HasZve32f && !HasF && !HasZfinx) return createStringError( errc::invalid_argument, @@ -876,6 +868,7 @@ return Error::success(); } +static const char *ImpliedExtsD[] = {"f"}; static const char *ImpliedExtsV[] = {"zvl128b", "zve64d", "f", "d"}; static const char *ImpliedExtsZfhmin[] = {"f"}; static const char *ImpliedExtsZfh[] = {"f"}; @@ -920,6 +913,7 @@ // Note: The table needs to be sorted by name. static constexpr ImpliedExtsEntry ImpliedExts[] = { + {{"d"}, {ImpliedExtsD}}, {{"v"}, {ImpliedExtsV}}, {{"xtheadvdot"}, {ImpliedExtsXTHeadVdot}}, {{"zcb"}, {ImpliedExtsZcb}},