This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: ffs/ctz expansions using clz
On 8/8/07, Mark Mitchell <mark@codesourcery.com> wrote:
> Richard Sandiford wrote:
> > Sandra Loosemore <sandra@codesourcery.com> writes:
> >> This patch depends on CLZ_DEFINED_VALUE_AT_ZERO applying to the clz
> >> optab as well as the clz rtl expression. I couldn't tell from reading
> >> the documentation whether this is a change from its previous meaning
> >> or not, but I don't think it's inconsistent with current practice in
> >> all the other back ends.
> >
> > It is a change. I was thinking the macro ought to be tristate:
> > defined always, defined for the clz rtl code only, or undefined.
> > Sorry for not making that clear.
>
> All right. Let's do the following for CLZ_DEFINED_VALUE_DEFINED_AT_ZERO:
>
> 0 - Not defined at zero.
> 1 - Defined at zero for the RTL "clz" instruction.
> 2 - Defined at zero for both the RTL "clz" instruction and the optabs
> "clz" expansion.
>
> That's backwards-compatible, as the existing definitions are all
> {0,1}-valued.
Is that true, rs6000 defines it as:
/* The cntlzw and cntlzd instructions return 32 and 64 for input of zero. */
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
((VALUE) = ((MODE) == SImode ? 32 : 64))
Thanks,
Andrew Pinski