http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29776
--- Comment #5 from Uros Bizjak <ubizjak at gmail dot com> 2012-07-30 12:48:19 UTC --- Created attachment 27895 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27895 Target patch that handles ctz extensions x86 target patch that teaches gcc about extensions for ctz. Patched gcc generates no extension for: long long foo (int x) { return __builtin_ctz (x); } and int foo (long long x) { return __builtin_ctzll (x); } (and their unsigned variants) on x86.