From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9984F3851C07; Mon, 15 Feb 2021 10:19:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9984F3851C07 From: "acoplan at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99102] New: SVE: Wrong code with -O2 -ftree-vectorize -march=armv8.2-a+sve -msve-vector-bits=256 Date: Mon, 15 Feb 2021 10:19:35 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: acoplan at gcc dot gnu.org 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 10:19:35 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99102 Bug ID: 99102 Summary: SVE: Wrong code with -O2 -ftree-vectorize -march=3Darmv8.2-a+sve -msve-vector-bits=3D256 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- AArch64 GCC miscompiles the following testcase: long a[44]; short d, e =3D -7; void b(char f, short j, short k, unsigned l) { for (int g =3D 0; g < 9; g +=3D f) for (int b =3D 0; b < 90; b -=3D k) for (int h =3D 0; h < f; h++) for (short i =3D 0; i < 15; i +=3D 4) if (!l) a[i] =3D j; } int main() { for (long c =3D 0; c < 2; ++c) a[c] =3D 7; b(9, d, e, 5); if (!a[0]) __builtin_abort(); } at -O2 -ftree-vectorize -march=3Darmv8.2-a+sve -msve-vector-bits=3D256. Loo= king at the generated code for b: b: .LFB0: .cfi_startproc adrp x3, .LANCHOR0 and w0, w0, 255 sxth w2, w2 add x3, x3, :lo12:.LANCHOR0 mov w5, 0 mov z0.h, w1 ptrue p0.b, vl32 mov x1, 32 sxth z0.d, p0/m, z0.d index z1.d, #0, x1 .L2: mov w4, 0 .p2align 3,,7 .L7: mov w1, 0 cbz w0, .L5 .p2align 3,,7 .L3: add w1, w1, 1 st1d z0.d, p0, [x3, z1.d] cmp w0, w1 bne .L3 .L5: sub w4, w4, w2 cmp w4, 89 ble .L7 add w5, w5, w0 cmp w5, 8 ble .L2 ret we appear to ignore the value for the argument "l" completely (we immediate= ly clobber x3 with the address for a).=