On Tue, Feb 02, 2021 at 07:40:02PM +0100, Jakub Jelinek via Gcc-patches wrote:
> On Tue, Feb 02, 2021 at 11:39:30AM -0700, Jeff Law wrote:
> > > This patch adds some ctz simplifications (e.g. ctz (x) >= 3 can be done by
> > > testing if the low 3 bits are zero, etc.).
> > >
> > > In addition, I've noticed that in the CLZ case, the
> > > #ifdef CLZ_DEFINED_VALUE_AT_ZERO don't really work as intended, they
> > > are evaluated during genmatch and the macro is not defined then
> > > (but, because of the missing tm.h includes it isn't defined in
> > > gimple-match.c or generic-match.c either).  And when tm.h is included,
> > > defaults.h is included which defines a fallback version of that macro.
> > >
> > > For GCC 12, I wonder if it wouldn't be better to say in addition to 
> > > __builtin_c[lt]z*
> > > is always UB at zero that it would be undefined for .C[LT]Z ifn too if it
> > > has just one operand and use a second operand to be the constant we expect
> > > at zero.
> > >
> > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> > >
> > > 2021-01-16  Jakub Jelinek  <ja...@redhat.com>
> > >
> > >   PR tree-optimization/95527
> > >   * generic-match-head.c: Include tm.h.
> > >   * gimple-match-head.c: Include tm.h.
> > >   * match.pd (CLZ == INTEGER_CST): Don't use
> > >   #ifdef CLZ_DEFINED_VALUE_AT_ZERO, only test CLZ_DEFINED_VALUE_AT_ZERO
> > >   if clz == CFN_CLZ.  Add missing val declaration.
> > >   (CTZ cmp CST): New simplifications.
> > >
> > >   * gcc.dg/tree-ssa/pr95527-2.c: New test.
> > Similarly.  I'd lean towards deferring to gcc-12.
> 
> Ok, will repost at the start of stage1 then (for both).

Ok for trunk now?
https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563711.html

        Jakub

Reply via email to