https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112483

--- Comment #17 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #16)
> (In reply to Andrew Pinski from comment #12)
> > What about this patch:
> > ```
> > diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
> > index 69d87579d9c..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, op0, mode);
> > +           tmp = simplify_unary_operation (NEG, mode, tmp, mode);
> >           return tmp;
> >         }
> >        if (GET_CODE (op0) == NEG || GET_CODE (op0) == ABS)
> > 
> > ```
> > 
> > We only generate NEG if it simplifies from the ABS. Most likely due to
> > constants.
> 
> I'm trying this out on LoongArch.

Works for me.  Will you send the simplify_gen_unary -> simplify_unary_operation
change to gcc-patches?

Reply via email to