[PATCH] D43146: [builtin] Update c?zdi2 to cover Linux/sparc

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 14:42:02 PST 2018


JDevlieghere created this revision.
JDevlieghere added reviewers: compnerd, joerg.
Herald added subscribers: Sanitizers, fedor.sergeev, jyknight.

The change in https://reviews.llvm.org/rL324593 didn't cover Linux/sparc64, where `__sparc64__` is
not defined. Instead `__sparc__` and `__arch64__` are needed. However, as
the problem has been observed on 32-bit SPARC as well, I just changed
the macro to `__sparc__`.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D43146

Files:
  compiler-rt/lib/builtins/clzdi2.c
  compiler-rt/lib/builtins/ctzdi2.c


Index: compiler-rt/lib/builtins/ctzdi2.c
===================================================================
--- compiler-rt/lib/builtins/ctzdi2.c
+++ compiler-rt/lib/builtins/ctzdi2.c
@@ -16,7 +16,7 @@
 
 /* Returns: the number of trailing 0-bits  */
 
-#if !defined(__clang__) && (defined(__sparc64__) || defined(__mips64) || defined(__riscv__))
+#if !defined(__clang__) && (defined(__sparc__) || defined(__mips64) || defined(__riscv__))
 /* gcc resolves __builtin_ctz -> __ctzdi2 leading to infinite recursion */
 #define __builtin_ctz(a) __ctzsi2(a)
 extern si_int __ctzsi2(si_int);
Index: compiler-rt/lib/builtins/clzdi2.c
===================================================================
--- compiler-rt/lib/builtins/clzdi2.c
+++ compiler-rt/lib/builtins/clzdi2.c
@@ -16,7 +16,7 @@
 
 /* Returns: the number of leading 0-bits */
 
-#if !defined(__clang__) && (defined(__sparc64__) || defined(__mips64) || defined(__riscv__))
+#if !defined(__clang__) && (defined(__sparc__) || defined(__mips64) || defined(__riscv__))
 /* gcc resolves __builtin_clz -> __clzdi2 leading to infinite recursion */
 #define __builtin_clz(a) __clzsi2(a)
 extern si_int __clzsi2(si_int);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43146.133689.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180209/3e090f0d/attachment.bin>


More information about the llvm-commits mailing list