From: Xi Ruoyao <xry111@xry111.site>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org, chenglulu <chenglulu@loongson.cn>,
i@xen0n.name, xuchenghua@loongson.cn,
Tamar Christina <Tamar.Christina@arm.com>,
tschwinge@gcc.gnu.org, Roger Sayle <roger@nextmovesoftware.com>,
Andrew Pinski <pinskia@gmail.com>
Subject: Re: [PATCH] Only allow (copysign x, NEG_CONST) -> (fneg (fabs x)) simplification for constant folding [PR112483]
Date: Wed, 15 Nov 2023 05:14:17 +0800 [thread overview]
Message-ID: <a2573e7f3e7eedff1adc5bd1722ebc640f6ff8bb.camel@xry111.site> (raw)
In-Reply-To: <CAFiYyc2BWEubDMzg7Fcqt9DFLwjcdzigkz6CEEYRwS2uw19vwQ@mail.gmail.com>
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.
> And I wonder when that happens - I suppose when op0 is CONST_DOUBLE only?
Yes, it's Andrew's intention.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
next prev parent reply other threads:[~2023-11-14 21:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 9:59 Xi Ruoyao
2023-11-14 10:44 ` Richard Biener
2023-11-14 21:14 ` Xi Ruoyao [this message]
2023-11-15 11:41 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2573e7f3e7eedff1adc5bd1722ebc640f6ff8bb.camel@xry111.site \
--to=xry111@xry111.site \
--cc=Tamar.Christina@arm.com \
--cc=chenglulu@loongson.cn \
--cc=gcc-patches@gcc.gnu.org \
--cc=i@xen0n.name \
--cc=pinskia@gmail.com \
--cc=richard.guenther@gmail.com \
--cc=roger@nextmovesoftware.com \
--cc=tschwinge@gcc.gnu.org \
--cc=xuchenghua@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).