This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] vrp: fold ffs to ctz
On Jun 5, 2012, at 6:46 AM, Paolo Bonzini wrote:
>> Do we always have CTZ if we have FFS? Can't there be a target that
>> implements FFS as opcode but not CTZ, so you'd slow down things?
>> Thus, should the transform be conditonal on target support for CTZ
>> or no target support for FFS?
>
> Hmm, SH and (some semi-obscure variant of) SPARC. But actually SPARC
> should define a clz pattern instead; SH should have a popcount pattern +
> a generic trick to expand ctz/ffs in terms of popcount. I'll submit
> those before applying this patch.
VAX has both FFS/FFC instructions but only a ffs pattern.
It does not have CTZ or CTO patterns but those could be added trivially.