From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BF6263813FC7; Wed, 5 Jun 2024 10:39:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF6263813FC7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717583974; bh=uhZyiIY+AlwdXD2bnduBVpgvPGSY4yrzSYXf8yQghuI=; h=From:To:Subject:Date:From; b=GcDD6Yr65NgNWMCBzv7ps6Jm7l+aK/tMhcTTXExfa4s8qxsxXDYHNU7Vpzg+RqsTd hk6sJT6bTkHjgjnF/e5da3obdta5SqodQSCV3CU+2J80MrzWueCY+vwMVx4MumvNS/ cUcVBNcNxs3m5SL5UFDI+cvZqbrl0J7CYCgf+IrI= From: "jens.seifert at de dot ibm.com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jens.seifert at de dot ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115355 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 #include #include void setToIdentityGOOD(unsigned long long *mVec, unsigned int mLen) { for (unsigned long long i =3D 0; i < mLen; i++) { mVec[i] =3D i; } } void setToIdentityBAD(unsigned long long *mVec, unsigned int mLen) { for (unsigned int i =3D 0; i < mLen; i++) { mVec[i] =3D i; } } unsigned long long vec1[100]; unsigned long long vec2[100]; int main(int argc, char *argv[]) { unsigned int l =3D argc > 1 ? atoi(argv[1]) : 29; setToIdentityGOOD(vec1, l); setToIdentityBAD(vec2, l); if (memcmp(vec1, vec2, l*sizeof(vec1[0])) !=3D 0) { for (unsigned int i =3D 0; i < l; i++) { printf("%llu %llu\n", vec1[i], vec2[i]); } } else { printf("match\n"); } return 0; } Fails gcc -O3 -mcpu=3Dpower9 -m64 setToIdentity.C -save-temps -fverbose-asm -o pw= r9.exe -mno-isel Good: gcc -O3 -mcpu=3Dpower8 -m64 setToIdentity.C -save-temps -fverbose-asm -o pw= r8.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.=