[Bug target/59874] Missing builtin (__builtin_clzs) when compiling with g++

linux at carewolf dot com gcc-bugzilla@gcc.gnu.org
Tue Dec 13 17:11:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59874

--- Comment #8 from Allan Jensen <linux at carewolf dot com> ---
Thanks that looks good. I will test it when I have a chance. I am changing the
Qt sources to not assume the presence of __builtin_clzs when __BMI__ is
defined. It can use __builtin_clz() and __builtin_ctz()-16U instead, but for
general compatibility it is nice that GCC also keeps it around. 

Note, it would be even better though if GCC could support the short forms as
generic builtins. That changes the semantics slightly, but they are named so
similarly to the clz, clzl and clzll it would be easy to assume they also are
generics, with similar semantics, and can work across all targets.

Btw. I assume __builtin_clzs being a target specific builtin, that GCC never
had the capability of resolving it at compile-time? If that is the case, it
might actually be a bug that GCC allowed it at all in a constexpr function.


More information about the Gcc-bugs mailing list