public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "segher at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/99930] Failure to optimize floating point -abs(x) in nontrivial code at -O2/3
Date: Tue, 06 Apr 2021 17:31:26 +0000	[thread overview]
Message-ID: <bug-99930-4-8T6oZ62Alm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99930-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
What happens here is
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/combine.c;h=3294575357bfcb19e589868da34364498a860dcf;hb=HEAD#l1884

"*<code><mode>2_1" for absneg:MODEF has a bare "use".  And then we trigger

  If the USE in INSN was for a pseudo register, the matching
  insn pattern will likely match any register; combining this
  with any other USE would only be safe if we knew that the
  used registers have identical values, or if there was
  something to tell them apart, e.g. different modes.  For
  now, we forgo such complicated tests and simply disallow
  combining of USES of pseudo registers with any other USE.

because both the abs and the neg have a bare use.

The patterns should be rewritten to not have such bare uses.  Alternatively
we can add some pretty-much-never-triggered code do combine to handle this
case.  Patches welcome.

  parent reply	other threads:[~2021-04-06 17:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 10:38 [Bug target/99930] New: " core13 at gmx dot net
2021-04-06 11:57 ` [Bug rtl-optimization/99930] " rguenth at gcc dot gnu.org
2021-04-06 12:00 ` rguenth at gcc dot gnu.org
2021-04-06 17:31 ` segher at gcc dot gnu.org [this message]
2021-04-07 10:04 ` jakub at gcc dot gnu.org
2021-04-07 10:06 ` jakub at gcc dot gnu.org
2021-04-07 10:14 ` ubizjak at gmail dot com
2021-04-07 10:27 ` crazylht at gmail dot com
2021-04-07 16:32 ` segher at gcc dot gnu.org
2021-04-08  9:48 ` crazylht at gmail dot com
2021-04-08 22:46 ` segher at gcc dot gnu.org
2021-07-25  1:30 ` pinskia at gcc dot gnu.org
2023-12-24 23:16 ` [Bug middle-end/99930] " pinskia at gcc dot gnu.org

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=bug-99930-4-8T6oZ62Alm@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).