Hi Jakub, > Perhaps another way out of this would be document and enforce that > __builtin_c[lt]z{,l,ll} etc calls are undefined at zero, but C[TL]Z ifn > calls are defined there based on *_DEFINED_VALUE_AT_ZERO (*) == 2, and then > we would need to make sure that e.g. in simplify_count_trailing_zeroes > we emit a .CTZ or __builtin_ctz call depending on whether it is undefined > there or not; or give .C[TL]Z an additional argument (0/1) which would tell > if it is defined at zero or not.
I think a better way forward would be to make the builtin_clz/ctz more defined. Having undefined values is a source of unnecessary bugs given practically all modern targets return the number of bits for the zero input - it is relatively easy to ensure this on the few targets that don't. Cheers, Wilco