[PATCH] D68698: [test-suite] Add Architecture Detection for RISC-V

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 05:40:40 PDT 2019


lenary created this revision.
lenary added reviewers: asb, luismarques.
Herald added subscribers: llvm-commits, s.egerton, PkmX, rkruppe, rogfer01, shiva0217, kito-cheng, simoncook, mgorny.
Herald added a project: LLVM.

The LLVM test suite has its own way of detecting the system
architecture. This adds support in that file for detecting RISC-V.

We use "riscv64" to identify 64-bit RISC-V, and "riscv32" to identify 32-bit
RISC-V, so that attempting to detect "riscv" matches any version of RISC-V.


Repository:
  rT test-suite

https://reviews.llvm.org/D68698

Files:
  cmake/modules/DetectArchitecture.c


Index: cmake/modules/DetectArchitecture.c
===================================================================
--- cmake/modules/DetectArchitecture.c
+++ cmake/modules/DetectArchitecture.c
@@ -8,6 +8,12 @@
 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";
+#endif
 #elif defined(__s390__)
 const char *str = "ARCHITECTURE IS SystemZ";
 #elif defined(__sparc__)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68698.224025.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191009/efc12122/attachment.bin>


More information about the llvm-commits mailing list