http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29776
--- Comment #10 from dean at arctic dot org --- On Thu, 4 Jul 2013, jakub at gcc dot gnu.org wrote: > I'm not 100% sure about CLZ/CTZ in the patch, because it could return any > value > for argument of 0, but as we document it as undefined behavior, perhaps it is > fine. this is unfortunate really -- the newer LZCNT/TZCNT instructions on x86 explicitly return 8*sizeof(type) for input of zero because the undefined behaviour of BSF/BSR posed a lot of problems in inner loops. it might be useful to add explicit builtins for this behaviour. thanks for taking a look at the bug :) -dean