On Tue, Nov 14, 2023 at 10:14 PM Xi Ruoyao <xry...@xry111.site> wrote:
>
> On Tue, 2023-11-14 at 11:44 +0100, Richard Biener wrote:
> > > diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
> > > index 2d2e5a3c1ca..f3745d86aea 100644
> > > --- a/gcc/simplify-rtx.cc
> > > +++ b/gcc/simplify-rtx.cc
> > > @@ -4392,7 +4392,7 @@ simplify_ashift:
> > >            real_convert (&f1, mode, CONST_DOUBLE_REAL_VALUE (trueop1));
> > >            rtx tmp = simplify_gen_unary (ABS, mode, op0, mode);
> > >            if (REAL_VALUE_NEGATIVE (f1))
> > > -           tmp = simplify_gen_unary (NEG, mode, tmp, mode);
> > > +           tmp = simplify_unary_operation (NEG, mode, tmp, mode);
> > >           return tmp;
> > >         }
> >
> > shouldn't that be when either the ABS or the NEG simplify?
>
> Simplify (copysign x, POSTIVE_CONST) to (abs x) is an optimization.  So
> for a positive f1, tmp will just be (abs x) and we return it.

Ah, OK.

> > And I wonder when that happens - I suppose when op0 is CONST_DOUBLE only?
>
> Yes, it's Andrew's intention.

The patch is fine then.

Richard.

> --
> Xi Ruoyao <xry...@xry111.site>
> School of Aerospace Science and Technology, Xidian University

Reply via email to