public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/115355] [12/13/14/15 Regression] vectorization exposes wrong code on P9 LE starting from r12-4496
Date: Thu, 06 Jun 2024 06:35:59 +0000	[thread overview]
Message-ID: <bug-115355-4-dn40myEPvu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115355-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Peter Bergner from comment #7)
> The test fails when setToIdentityBAD's index var is unsigned int.  It passes
> when using unsigned long long, unsigned long, unsigned short and unsigned
> char.  When using unsigned long long/unsigned long, we do no vectorize the

unsigned {long ,}long fails to vectorize due to cost modeling:

  missed:  cost model: the vector iteration cost = 2 divided by the scalar
iteration cost = 1 is greater or equal to the vectorization factor = 2.
  missed:  not vectorized: vectorization not profitable.

it can be forced with -fno-vect-cost-model.

> loop.  We vectorize the loop when using unsigned int/short/char.  The
> vectorized code is a little strange, in that the smaller the integer type we
> use for the index var, the more code we generate.  
> 
> The vectorized code for unsigned char is truly huge!  ...although it does
> seem to work correctly.  I'm attaching the "unsigned char i" code gen for
> setToIdentityBAD for people to examine.  Even though it gives "correct"
> results, it can't really be the code we want to generate, correct???

It's due to aggressive unrolling, as it has one early check on the loop bound
between 16 and 255, then cunroll completely unrolls it for each 16 multiples
(totally 15 loops). A compact version of code can be generated with
-fdisable-tree-cunroll.

  parent reply	other threads:[~2024-06-06  6:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 10:39 [Bug target/115355] New: PPCLE: Auto-vectorization creates wrong code for Power9 jens.seifert at de dot ibm.com
2024-06-05 11:55 ` [Bug target/115355] " jens.seifert at de dot ibm.com
2024-06-05 12:30 ` rguenth at gcc dot gnu.org
2024-06-05 13:03 ` bergner at gcc dot gnu.org
2024-06-05 13:43 ` linkw at gcc dot gnu.org
2024-06-05 14:59 ` bergner at gcc dot gnu.org
2024-06-05 15:42 ` [Bug target/115355] [12/13/14/15 Regression] " pinskia at gcc dot gnu.org
2024-06-05 21:05 ` bergner at gcc dot gnu.org
2024-06-05 21:05 ` bergner at gcc dot gnu.org
2024-06-06  4:36 ` [Bug target/115355] [12/13/14/15 Regression] vectorization exposes wrong code on P9 LE starting from r12-4496 linkw at gcc dot gnu.org
2024-06-06  6:30 ` rguenth at gcc dot gnu.org
2024-06-06  6:35 ` linkw at gcc dot gnu.org [this message]
2024-06-07  6:53 ` jens.seifert at de dot ibm.com
2024-06-07  8:14 ` linkw at gcc dot gnu.org
2024-06-20  9:15 ` rguenth at gcc dot gnu.org
2024-06-21  1:27 ` cvs-commit at gcc dot gnu.org
2024-06-26  7:17 ` cvs-commit at gcc dot gnu.org
2024-06-26  7:17 ` cvs-commit at gcc dot gnu.org
2024-06-28  1:13 ` cvs-commit at gcc dot gnu.org
2024-06-28  1:14 ` cvs-commit at gcc dot gnu.org
2024-06-28  1:17 ` cvs-commit 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-115355-4-dn40myEPvu@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).