[clang] [llvm] [RISCV] Support __builtin_cpu_init and __builtin_cpu_supports (PR #99700)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 16:09:36 PDT 2024


================
@@ -2,14 +2,29 @@
 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-- -DX86 -verify %s
 // RUN: %clang_cc1 -fsyntax-only -triple powerpc64-unknown-linux-gnu -DPPC \
 // RUN:   -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple riscv32-unknown-linux-gnu -DRISCV \
+// RUN:   -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple riscv64-unknown-linux-gnu -DRISCV \
+// RUN:   -verify %s
 // expected-no-diagnostics
 #if __has_builtin(__builtin_cpu_is)
-# ifdef ARM
-#   error "ARM shouldn't have __builtin_cpu_is"
+# if defined(ARM) || defined(RISCV)
+#   error "ARM/RISCV shouldn't have __builtin_cpu_is"
 # endif
 #endif
+
 #if __has_builtin(__builtin_cpu_init)
 # if defined(ARM) || defined(PPC)
 #   error "ARM/PPC shouldn't have __builtin_cpu_init"
 # endif
+#else
+# ifdef RISCV
+#   error "RISCV should have __builtin_cpu_init"
+# endif
+#endif
+
+#if !__has_builtin(__builtin_cpu_supports)
+# if defined(X86) || defined(RISCV)
----------------
topperc wrote:

Does ARM support __builtin_cpu_supports?

https://github.com/llvm/llvm-project/pull/99700


More information about the llvm-commits mailing list