[PATCH] D95590: [RISCV] Define preprocessor definitions for 'P' extension
Jim Lin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 27 21:40:39 PST 2021
Jim created this revision.
Jim added reviewers: craig.topper, HsiangKai, kito-cheng, jrtc27, luismarques.
Herald added subscribers: frasercrmck, NickHung, evandro, apazos, sameer.abuasal, pzheng, s.egerton, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, asb.
Jim requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95590
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
@@ -109,6 +109,12 @@
// CHECK-DOUBLE-NOT: __riscv_float_abi_soft
// CHECK-DOUBLE-NOT: __riscv_float_abi_single
+// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions -march=rv32ip0p9 -x c -E -dM %s \
+// RUN: -o - | FileCheck --check-prefix=CHECK-P-EXT %s
+// RUN: %clang -target riscv64-unknown-linux-gnu -menable-experimental-extensions -march=rv64ip0p9 -x c -E -dM %s \
+// RUN: -o - | FileCheck --check-prefix=CHECK-P-EXT %s
+// CHECK-P-EXT: __riscv_p 90000
+
// RUN: %clang -target riscv32-unknown-linux-gnu -menable-experimental-extensions \
// RUN: -march=rv32iv1p0 -x c -E -dM %s \
// RUN: -o - | FileCheck --check-prefix=CHECK-V-EXT %s
Index: clang/lib/Basic/Targets/RISCV.h
===================================================================
--- clang/lib/Basic/Targets/RISCV.h
+++ clang/lib/Basic/Targets/RISCV.h
@@ -31,6 +31,7 @@
bool HasD = false;
bool HasC = false;
bool HasB = false;
+ bool HasP = false;
bool HasV = false;
bool HasZba = false;
bool HasZbb = false;
Index: clang/lib/Basic/Targets/RISCV.cpp
===================================================================
--- clang/lib/Basic/Targets/RISCV.cpp
+++ clang/lib/Basic/Targets/RISCV.cpp
@@ -149,6 +149,9 @@
Builder.defineMacro("__riscv_bitmanip");
}
+ if (HasP)
+ Builder.defineMacro("__riscv_p", "90000");
+
if (HasV) {
Builder.defineMacro("__riscv_v", "1000000");
Builder.defineMacro("__riscv_vector");
@@ -210,6 +213,7 @@
.Case("d", HasD)
.Case("c", HasC)
.Case("experimental-b", HasB)
+ .Case("experimental-p", HasP)
.Case("experimental-v", HasV)
.Case("experimental-zba", HasZba)
.Case("experimental-zbb", HasZbb)
@@ -244,6 +248,8 @@
HasC = true;
else if (Feature == "+experimental-b")
HasB = true;
+ else if (Feature == "+experimental-p")
+ HasP = true;
else if (Feature == "+experimental-v")
HasV = true;
else if (Feature == "+experimental-zba")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95590.319760.patch
Type: text/x-patch
Size: 2235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210128/0edef1a9/attachment.bin>
More information about the cfe-commits
mailing list