From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 89E1B3857812; Thu, 1 Apr 2021 18:19:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89E1B3857812 From: "rsandifo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99873] New: [11 Regression] GCC no longer makes as much use of ST3 Date: Thu, 01 Apr 2021 18:19:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rsandifo 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 keywords bug_severity priority component assigned_to reporter cc target_milestone cf_gcctarget 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: Thu, 01 Apr 2021 18:19:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99873 Bug ID: 99873 Summary: [11 Regression] GCC no longer makes as much use of ST3 Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rsandifo at gcc dot gnu.org CC: rguenth at gcc dot gnu.org Target Milestone: --- Target: aarch64*-*-* For: void f (int *restrict x, int *restrict y, int *restrict z, int n) { for (int i =3D 0; i < n; i +=3D 3) { x[i] =3D y[i] + z[i]; x[i + 1] =3D y[i + 1] - z[i + 1]; x[i + 2] =3D y[i + 2] | z[i + 2]; } } GCC 10 produced a nice loop using LD3 and ST3: .L4: ld3 {v4.4s - v6.4s}, [x4], 48 ld3 {v16.4s - v18.4s}, [x6], 48 add v1.4s, v16.4s, v4.4s sub v2.4s, v5.4s, v17.4s orr v3.16b, v18.16b, v6.16b st3 {v1.4s - v3.4s}, [x5], 48 cmp x8, x4 bne .L4 But GCC 11 instead uses lane stores: .L4: ld3 {v4.4s - v6.4s}, [x9], 48 mov x8, x4 ld3 {v16.4s - v18.4s}, [x11], 48 add x16, x4, 24 add x15, x4, 36 add x14, x4, 16 add x13, x4, 28 add x12, x4, 40 add v2.4s, v16.4s, v4.4s add x7, x4, 20 sub v1.4s, v5.4s, v17.4s add x6, x4, 32 orr v0.16b, v18.16b, v6.16b add x5, x4, 44 add x4, x4, 48 str s2, [x8], 12 st1 {v2.s}[1], [x8] st1 {v2.s}[2], [x16] st1 {v2.s}[3], [x15] str s1, [x4, -44] st1 {v1.s}[1], [x14] st1 {v1.s}[2], [x13] st1 {v1.s}[3], [x12] str s0, [x4, -40] st1 {v0.s}[1], [x7] st1 {v0.s}[2], [x6] st1 {v0.s}[3], [x5] cmp x10, x9 bne .L4 I think this is due to r11-3966 optimistically splitting store groups in a way that we can't recover from if SLP subsequently fails. Maybe the easiest thing for GCC 11 would be to block the split if the target supports IFN_STORE_LANES for the group size and element type. That restores the above case. Of the two tests affected by r11-3966, vect-complex-5.c seems better with LD2 & ST4, while the motivating case (pr97428.c) still uses SLP as intended.=