This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Bit twiddling builtins
Richard Henderson <rth@redhat.com> writes:
> +LIB2FUNCS_3 = _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 \
> + _popcountdi2 _paritysi2 _paritydi2
>
> No need for this. Just add to LIB2FUNCS_2.
Well, the comment above that seemed to imply that some makes or shells
have probems with variables longer than 256 characters, and when I add
them to LIB2FUNCS_2, it does get longer than that. If this is no
longer relevant, we might as well merge LIB2FUNCS_1 and LIB2FUNCS_2...
> +(define_expand "paritydi2"
> + [(set (match_dup 2)
> + (popcount:DI (match_operand:DI 1 "register_operand" "")))
> + (set (match_operand:DI 0 "register_operand" "")
> + (and:DI (match_dup 2) (const_int 1)))]
>
> It'd be nice if optabs could synthisize this. Not a requirement.
I'll look into it.
> +/* Try calculating
> + (ctz:narrow x)
> + as
> + (if_then_else x (ctz:wide (zero_extend:wide x)) (width narrow)). */
>
> As I said, these should be undefined at zero. Ergo CTZ needs
> no special treatment.
OK.
BTW, I'm wondering about these statements in optabs.c when looking for
wider modes:
if (class == MODE_INT || class == MODE_FLOAT || class == MODE_COMPLEX_FLOAT)
Why not MODE_COMPLEX_INT?
--
Falk