https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112789
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #4) > So just for future reference __builtin_c[lt]zs is for short. > > But with GCC 14 (trunk) added __builtin_ct[lt]g, there is no need to add > __builtin_c[lt]zs to GCC. > > You could just do: > > #if __has_builtin(__builtin_ctzg) && !__has_builtin(__builtin_ctzs) > #define ctzs(a) __builtin_ctzg((short)a) > #elif __has_builtin(__builtin_ctzs) > #define ctzs(a) __builtin_ctzs((short)a) > #else > #error implement fall back for not both cases > #endif s/short/unsigned short/ above (and not really needed for the clang __builtin_ctzs). So #if __has_builtin(__builtin_ctzs) #define ctzs(a) __builtin_ctzs(a) #elif __has_builtin(__builtin_ctzg) #define ctzs(a) __builtin_ctzg((unsigned short)(a)) #else ... #endif