[RISCV] Support experimental v extensions.

This follows the design as discussed on the mailing lists in the
following RFC:
http://lists.llvm.org/pipermail/llvm-dev/2020-January/138364.html

Support for the vector 'v' extension v0.8.

Differential revision: https://reviews.llvm.org/D81188
This commit is contained in:
Hsiangkai Wang 2020-06-05 03:11:52 +08:00
parent 66da87dcba
commit d698ff92a5
2 changed files with 24 additions and 0 deletions

View File

@ -62,6 +62,8 @@ isExperimentalExtension(StringRef Ext) {
Ext == "zbf" || Ext == "zbm" || Ext == "zbp" || Ext == "zbr" ||
Ext == "zbs" || Ext == "zbt" || Ext == "zbproposedc")
return RISCVExtensionVersion{"0", "92"};
if (Ext == "v")
return RISCVExtensionVersion{"0", "8"};
return None;
}
@ -399,6 +401,9 @@ static bool getArchFeatures(const Driver &D, StringRef MArch,
case 'b':
Features.push_back("+experimental-b");
break;
case 'v':
Features.push_back("+experimental-v");
break;
}
// Consume full extension name and version, including any optional '_'

View File

@ -360,3 +360,22 @@
// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP %s
// RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbb"
// RV32-EXPERIMENTAL-ZBB-ZBP: "-target-feature" "+experimental-zbp"
// RUN: %clang -target riscv32-unknown-elf -march=rv32iv -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOFLAG %s
// RV32-EXPERIMENTAL-V-NOFLAG: error: invalid arch name 'rv32iv'
// RV32-EXPERIMENTAL-V-NOFLAG: requires '-menable-experimental-extensions'
// RUN: %clang -target riscv32-unknown-elf -march=rv32iv -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-V-NOVERS %s
// RV32-EXPERIMENTAL-V-NOVERS: error: invalid arch name 'rv32iv'
// RV32-EXPERIMENTAL-V-NOVERS: experimental extension requires explicit version number
// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p1 -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-V-BADVERS %s
// RV32-EXPERIMENTAL-V-BADVERS: error: invalid arch name 'rv32iv0p1'
// RV32-EXPERIMENTAL-V-BADVERS: unsupported version number 0.1 for experimental extension
// RUN: %clang -target riscv32-unknown-elf -march=rv32iv0p8 -menable-experimental-extensions -### %s -c 2>&1 | \
// RUN: FileCheck -check-prefix=RV32-EXPERIMENTAL-V-GOODVERS %s
// RV32-EXPERIMENTAL-V-GOODVERS: "-target-feature" "+experimental-v"