diff options
authorSam Elliott <selliott@lowrisc.org>2019-10-09 15:33:29 +0000
committerSam Elliott <selliott@lowrisc.org>2019-10-09 15:33:29 +0000
commita70a8dc656d8421b0f8061e4e91271eff9e7cdcc (patch)
parent7680b39a7d6ca81a9b04f85c62c7d1fd9bc4c807 (diff)
[test-suite] Add Architecture Detection for RISC-V
Summary: The LLVM test suite has its own way of detecting the system architecture. This adds support in that file for detecting RISC-V. This will eventually cause the ARCH variable to be populated. We use ARCH="riscv64" to identify 64-bit RISC-V, and ARCH="riscv32" to identify 32-bit RISC-V, so that attempting to detect "riscv" in the ARCH variable will match any version of RISC-V. Reviewers: asb, luismarques Reviewed By: luismarques Subscribers: mgorny, simoncook, kito-cheng, shiva0217, rogfer01, rkruppe, PkmX, s.egerton, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68698 git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@374176 91177308-0d34-0410-b5e6-96231b3b80d8
1 files changed, 6 insertions, 0 deletions
diff --git a/cmake/modules/DetectArchitecture.c b/cmake/modules/DetectArchitecture.c
index ef488b50..35f7c0bc 100644
--- a/cmake/modules/DetectArchitecture.c
+++ b/cmake/modules/DetectArchitecture.c
@@ -8,6 +8,12 @@ const char *str = "ARCHITECTURE IS Alpha";
const char *str = "ARCHITECTURE IS Mips";
#elif defined(__powerpc__) || defined(__ppc__) || defined(__power__)
const char *str = "ARCHITECTURE IS PowerPC";
+#elif defined(__riscv)
+#if __riscv_xlen == 64
+const char *str = "ARCHITECTURE IS riscv64";
+#elif __riscv_xlen == 32
+const char *str = "ARCHITECTURE IS riscv32";
#elif defined(__s390__)
const char *str = "ARCHITECTURE IS SystemZ";
#elif defined(__sparc__)