public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115355] New: PPCLE: Auto-vectorization creates wrong code for Power9
@ 2024-06-05 10:39 jens.seifert at de dot ibm.com
  2024-06-05 11:55 ` [Bug target/115355] " jens.seifert at de dot ibm.com
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: jens.seifert at de dot ibm.com @ 2024-06-05 10:39 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-06-28  1:17 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).