Il 03/05/2012 11:57, Richard Guenther ha scritto: > Hmm, I'll let target maintainers have a look at this - it's non-obvious > for arm (the only case I looked at) at least. My guess is that the > difference was to allow __builtin_ctz to be "optimized" and CTZ > to be always well-defined (which incidentially it is not ...!?). Hm.
On ARM: - clzsi4 is defined to expand to clz:SI, so it is the textbook example of returning 2 from CLZ_DEFINED_VALUE_AT_ZERO - ctzsi4 expands to bitrev + clz:SI, so it will return 32 too. ctz:SI will never appear at all in the RTX stream, so you can define its value at zero to be whatever you want. Hence the correct valid of CTZ_DEFINED_VALUE_AT_ZERO is also 2. Similar reasoning applies basically everywhere. CTZ_DEFINED_VALUE_AT_ZERO cannot be 2 when a define_expand produces different sequences with different values at zero, depending on optimize_size or the phase of the moon (but not depending on TARGET_*. One would be represented as ctz:SI in the RTL, the other not (perhaps something involving an if_then_else or an unspec). In this case, indeed expand must not consider the value at zero to be defined. However, no such define_expand exists for clz/ctz in config/*/*.md. Paolo