public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tnfchris at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/116463] [15 Regression] fast-math-complex-mls-{double,float}.c fail after r15-3087-gb07f8a301158e5
Date: Thu, 22 Aug 2024 23:03:51 +0000	[thread overview]
Message-ID: <bug-116463-4-imdUmbBhzb@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-116463-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Yeah, This is because they generate different gimple sequences and thus
different SLP trees.
The core of the problem is there's no canonical form here, and a missing gimple
simplification rule:

  _33 = IMAGPART_EXPR <*_3> + ((REALPART_EXPR <*_5> * IMAGPART_EXPR <*_7>) +
(IMAGPART_EXPR <*_5> * REALPART_EXPR <*_7>));
vs
  _37 = IMAGPART_EXPR <*_3> - ((REALPART_EXPR <*_5> * -IMAGPART_EXPR <*_7>) +
(IMAGPART_EXPR <*_5> * -REALPART_EXPR <*_7>));

i.e. a - ((b * -c) + (d * -e)) == a + (b * c) + (d * e)

So probably in match.pd we should fold _37 into _33 which is a simpler form of
the same thing and it's better on scalar as well.

It would be better to finally introduce a vectorizer canonical form, for
instance the real part generates:

  _36 = (_31 - _30) + REALPART_EXPR <*_3>;
vs
  _32 = REALPART_EXPR <*_3> + (_26 - _27);

and this already is an additional thing to check, so it would be better if slp
build always puts complex parts consistently on one side of commutative
operations so we don't have to swap operands to check.

In any case, I have some patches in this area and can take a look when I'm
back, but think the new expression should be simplified back into the old one.

  parent reply	other threads:[~2024-08-22 23:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 19:58 [Bug tree-optimization/116463] New: " pinskia at gcc dot gnu.org
2024-08-22 19:59 ` [Bug tree-optimization/116463] " pinskia at gcc dot gnu.org
2024-08-22 20:09 ` pinskia at gcc dot gnu.org
2024-08-22 20:18 ` pinskia at gcc dot gnu.org
2024-08-22 20:20 ` pinskia at gcc dot gnu.org
2024-08-22 20:43 ` pinskia at gcc dot gnu.org
2024-08-22 23:03 ` tnfchris at gcc dot gnu.org [this message]
2024-08-23 11:43 ` rguenth at gcc dot gnu.org
2024-08-23 12:37 ` cvs-commit at gcc dot gnu.org
2024-08-23 12:46 ` rguenth at gcc dot gnu.org
2024-08-23 23:03 ` pinskia at gcc dot gnu.org
2024-08-25 20:21 ` pinskia at gcc dot gnu.org
2024-08-28  8:06 ` tnfchris at gcc dot gnu.org
2024-08-28  8:13 ` rguenth 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-116463-4-imdUmbBhzb@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).