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 @@ -412,6 +412,26 @@ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZFHMIN %s // RV32-ZFHMIN: "-target-feature" "+zfhmin" +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izbt -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-NOFLAG %s +// RV32-EXPERIMENTAL-NOFLAG: error: invalid arch name 'rv32izbt' +// RV32-EXPERIMENTAL-NOFLAG: requires '-menable-experimental-extensions' + +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izbt -menable-experimental-extensions -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-NOVERS %s +// RV32-EXPERIMENTAL-NOVERS: error: invalid arch name 'rv32izbt' +// RV32-EXPERIMENTAL-NOVERS: experimental extension requires explicit version number + +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izbt0p1 -menable-experimental-extensions -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-BADVERS %s +// RV32-EXPERIMENTAL-BADVERS: error: invalid arch name 'rv32izbt0p1' +// RV32-EXPERIMENTAL-BADVERS: unsupported version number 0.1 for experimental extension +// RV32-EXPERIMENTAL-BADVERS: 'zbt'(this compiler supports 0.93) + +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izbt0p93 -menable-experimental-extensions -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-GOODVERS %s +// RV32-EXPERIMENTAL-GOODVERS: "-target-feature" "+experimental-zbt" + // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb1p0 -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZBB %s // RUN: %clang --target=riscv32-unknown-elf -march=rv32izbb -### %s \ @@ -494,3 +514,48 @@ // RUN: %clang --target=riscv32-unknown-elf -march=rv32izk1p0 -### %s \ // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ZK %s // RV32-ZK: "-target-feature" "+zk" + +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izfh1p0 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-RV32-ZFH %s +// CHECK-RV32-ZFH: "-target-feature" "+zfh" + +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izfhmin1p0 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-RV32-ZFHMIN %s +// CHECK-RV32-ZFHMIN: "-target-feature" "+zfhmin" + +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32x0p1 -### %s -c 2>&1 | \ +// RUN: FileCheck -check-prefix=RV32-ZVE32X-BADVERS %s +// RV32-ZVE32X-BADVERS: error: invalid arch name 'rv32izve32x0p1' +// RV32-ZVE32X-BADVERS: unsupported version number 0.1 for extension 'zve32x' + +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izve32x -### %s -c 2>&1 | \ +// RUN: FileCheck -check-prefix=RV32-ZVE32X-GOODVERS %s +// 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" + +// RUN: %clang --target=riscv32-unknown-elf -march=rv32izve64x -### %s -c 2>&1 | \ +// RUN: FileCheck -check-prefix=RV32-ZVE64X %s +// 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: FileCheck -check-prefix=RV32-ZVE64D-GOOD %s +// RV32-ZVE64D-GOOD: "-target-feature" "+zve64d"