[PATCH] D92650: [RISCV] Define preprocessor definitions for 'V' extension.
Hsiangkai Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 4 16:35:14 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5e953a274b2a: [RISCV] Define preprocessor definitions for 'V' extension. (authored by HsiangKai).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92650/new/
https://reviews.llvm.org/D92650
Files:
clang/lib/Basic/Targets/RISCV.cpp
clang/lib/Basic/Targets/RISCV.h
clang/test/Preprocessor/riscv-target-features.c
Index: clang/test/Preprocessor/riscv-target-features.c
===================================================================
--- clang/test/Preprocessor/riscv-target-features.c
+++ clang/test/Preprocessor/riscv-target-features.c
@@ -79,6 +79,14 @@
// CHECK-DOUBLE-NOT: __riscv_float_abi_soft
// CHECK-DOUBLE-NOT: __riscv_float_abi_single
+// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \
+// RUN: -march=rv32iv0p9 -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=rv64iv0p9 -x c -E -dM %s \
+// RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s
+// CHECK-V-EXT: __riscv_vector 1
+//
// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions -march=rv32izfh0p1 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-ZFH-EXT %s
// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions -march=rv64izfh0p1 -x c -E -dM %s \
Index: clang/lib/Basic/Targets/RISCV.h
===================================================================
--- clang/lib/Basic/Targets/RISCV.h
+++ clang/lib/Basic/Targets/RISCV.h
@@ -31,12 +31,13 @@
bool HasD;
bool HasC;
bool HasB;
+ bool HasV;
bool HasZfh;
public:
RISCVTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
: TargetInfo(Triple), HasM(false), HasA(false), HasF(false), HasD(false),
- HasC(false), HasB(false), HasZfh(false) {
+ HasC(false), HasB(false), HasV(false), HasZfh(false) {
LongDoubleWidth = 128;
LongDoubleAlign = 128;
LongDoubleFormat = &llvm::APFloat::IEEEquad();
Index: clang/lib/Basic/Targets/RISCV.cpp
===================================================================
--- clang/lib/Basic/Targets/RISCV.cpp
+++ clang/lib/Basic/Targets/RISCV.cpp
@@ -136,6 +136,9 @@
if (HasB)
Builder.defineMacro("__riscv_bitmanip");
+ if (HasV)
+ Builder.defineMacro("__riscv_vector");
+
if (HasZfh)
Builder.defineMacro("__riscv_zfh");
}
@@ -153,6 +156,7 @@
.Case("d", HasD)
.Case("c", HasC)
.Case("experimental-b", HasB)
+ .Case("experimental-v", HasV)
.Case("experimental-zfh", HasZfh)
.Default(false);
}
@@ -173,6 +177,8 @@
HasC = true;
else if (Feature == "+experimental-b")
HasB = true;
+ else if (Feature == "+experimental-v")
+ HasV = true;
else if (Feature == "+experimental-zfh")
HasZfh = true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92650.309696.patch
Type: text/x-patch
Size: 2541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201205/4d25ef4a/attachment-0001.bin>
More information about the cfe-commits
mailing list