[PATCH] Fix __bultin_clrsb* (PR middle-end/49489)

Bernd Schmidt bernds@codesourcery.com
Tue Jun 21 16:46:00 GMT 2011

On 06/21/2011 06:10 PM, Jakub Jelinek wrote:
> gcc.c-torture/execute/builtin-bitops-1.c fails on x86_64-linux, because
> there is no SImode libcall, only DImode, and it was zero-extending instead
> of sign-extending the argument, and not subtracting the mode difference
> afterwards.  So int foo (int x) { return __builtin_clrsb (x); }
> expanded the same as
> int foo (int x) { return __builtin_clrsbl ((unsigned) x); }
> instead of the correct
> int foo (int x) { return __builtin_clrsbl (x) - 32; }
> Fixed thusly, I've also added folding of constant arguments
> during tree optimizations for it.
> Ok for trunk?


> 	(fold_builtin_bitop): Fix masking for width > HOST_BITS_PER_WIDE_INT
> 	and < 2 * HOST_BITS_PER_WIDE_INT.  Optimize BUILT_IN_CLRSB*.

Oh that's where the folders were hiding? I thought we didn't have any
for this family of builtins.


More information about the Gcc-patches mailing list