Skip to content

Commit

Permalink
[RISCV] Remove Zvamo implication for v1.0-rc change
Browse files Browse the repository at this point in the history
As v1.0-rc specs say Zvamo is removed from standard extension,
Zvamo has to be specified explicitly.

Reviewed By: evandro

Differential Revision: https://reviews.llvm.org/D105396
  • Loading branch information
arcbbb committed Jul 6, 2021
1 parent 37a92f3 commit f1cbea3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
8 changes: 5 additions & 3 deletions clang/lib/Driver/ToolChains/Arch/RISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,13 @@ static void getExtensionFeatures(const Driver &D,
<< MArch << Error << Ext;
return;
}
if (Ext == "zvamo" || Ext == "zvlsseg") {
if (Ext == "zvlsseg") {
Features.push_back("+experimental-v");
Features.push_back("+experimental-zvlsseg");
} else if (Ext == "zvamo") {
Features.push_back("+experimental-v");
Features.push_back("+experimental-zvamo");
Features.push_back("+experimental-zvlsseg");
Features.push_back("+experimental-zvamo");
} else if (isExperimentalExtension(Ext))
Features.push_back(Args.MakeArgString("+experimental-" + Ext));
else
Expand Down Expand Up @@ -429,7 +432,6 @@ static bool getArchFeatures(const Driver &D, StringRef MArch,
break;
case 'v':
Features.push_back("+experimental-v");
Features.push_back("+experimental-zvamo");
Features.push_back("+experimental-zvlsseg");
break;
}
Expand Down
18 changes: 11 additions & 7 deletions clang/test/Preprocessor/riscv-target-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,26 @@
// RUN: -march=rv64iv0p10 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s
// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \
// RUN: -march=rv32izvamo0p10 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s
// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions \
// RUN: -march=rv32izvamo0p10 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s
// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \
// RUN: -march=rv32izvlsseg0p10 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s
// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions \
// RUN: -march=rv32izvlsseg0p10 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s
// CHECK-V-EXT: __riscv_v 10000
// CHECK-V-EXT: __riscv_vector 1
// CHECK-V-EXT: __riscv_zvamo 10000
// CHECK-V-EXT: __riscv_zvlsseg 10000

// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \
// RUN: -march=rv32izvamo0p10 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-ZVAMO-EXT %s
// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions \
// RUN: -march=rv32izvamo0p10 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-ZVAMO-EXT %s
// CHECK-ZVAMO-EXT: __riscv_v 10000
// CHECK-ZVAMO-EXT: __riscv_vector 1
// CHECK-ZVAMO-EXT: __riscv_zvamo 10000
// CHECK-ZVAMO-EXT: __riscv_zvlsseg 10000

// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \
// RUN: -march=rv32izfh0p1 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-ZFH-EXT %s
Expand Down

0 comments on commit f1cbea3

Please sign in to comment.