public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jens.seifert at de dot ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/115355] New: PPCLE: Auto-vectorization creates wrong code for Power9
Date: Wed, 05 Jun 2024 10:39:34 +0000	[thread overview]
Message-ID: <bug-115355-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 115355
           Summary: PPCLE: Auto-vectorization creates wrong code for
                    Power9
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.seifert at de dot ibm.com
  Target Milestone: ---

Input setToIdentity.C:

#include <stdlib.h>
#include <memory.h>
#include <stdio.h>

void setToIdentityGOOD(unsigned long long *mVec, unsigned int mLen)
{
  for (unsigned long long i = 0; i < mLen; i++)
  {
    mVec[i] = i;
  }
}

void setToIdentityBAD(unsigned long long *mVec, unsigned int mLen)
{
  for (unsigned int i = 0; i < mLen; i++)
  {
    mVec[i] = i;
  }
}

unsigned long long vec1[100];
unsigned long long vec2[100];

int main(int argc, char *argv[])
{
  unsigned int l = argc > 1 ? atoi(argv[1]) : 29;
  setToIdentityGOOD(vec1, l);
  setToIdentityBAD(vec2, l);

  if (memcmp(vec1, vec2, l*sizeof(vec1[0])) != 0)
  {
     for (unsigned int i = 0; i < l; i++)
     {
        printf("%llu %llu\n", vec1[i], vec2[i]);
     }
  }
  else
  {
     printf("match\n");
  }
  return 0;
}


Fails
gcc -O3 -mcpu=power9 -m64 setToIdentity.C -save-temps -fverbose-asm -o pwr9.exe
-mno-isel


Good:
gcc -O3 -mcpu=power8 -m64 setToIdentity.C -save-temps -fverbose-asm -o pwr8.exe
-mno-isel

"-mno-isel" is only specified to reduce the diff.


Failing output:

pwr9.exe
0 0
1 1
2 0
3 4294967296
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28

4th element contains wrong data.

             reply	other threads:[~2024-06-05 10:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 10:39 jens.seifert at de dot ibm.com [this message]
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
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@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).