]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC: r230021
authormarius <marius@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 25 May 2012 17:15:53 +0000 (17:15 +0000)
committermarius <marius@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 25 May 2012 17:15:53 +0000 (17:15 +0000)
commitf7df213b59add907a15b99f8135f7727b1abbf2b
tree70344f7e4fd1f87d0356566e011f417fb2d35be3
parent162c13245b7b15f9afb85d7d19ca6b5fec8df875
MFC: r230021

Add a workaround to prevent endless recursion in compiler-rt.

SPARC and MIPS CPUs don't have special instructions to count
leading/trailing zeroes. The compiler-rt library provides fallback
rountines for these. The 64-bit routines, __clzdi2 and __ctzdi2, are
implemented as simple wrappers around the compiler built-in
__builtin_clz(), assuming these will expand to either 32-bit
CPU instructions or calls to __clzsi2 and __ctzsi2.

Unfortunately, our GCC 4.2 probably thinks that because the operand is
stored in a 64-bit register, it might just be a better idea to invoke
its 64-bit equivalent, simply resulting into endless recursion. Fix this
by defining __builtin_clz and __builtin_ctz to __clzsi2 and __ctzsi2
explicitly.

git-svn-id: svn://svn.freebsd.org/base/stable/9@236012 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
contrib/compiler-rt/lib/int_lib.h