From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E21F93858439; Wed, 1 Nov 2023 02:41:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E21F93858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698806480; bh=CRIl/LPCbAvI0Ah780+Ii7NIoG+GXMx+a9Jizj3rOzk=; h=From:To:Subject:Date:From; b=Vf4M/o6hqQZ1/vd3iSgfuUwrlWJiGRfMopgjhChvfysU1qSLDDVGCTGpozLVn20KP l4pwJbk6h2lbsnzdW/JXS6WPnv6sAiaiJo7Jt6jFbnAopJHWkN7hQDsp13nUAlC+jO iJq6asm21A5UufG6eZEgYu9rBLI2255x4lmPA1+k= From: "wwwhhhyyy333 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112325] New: Missed vectorization after cunrolli Date: Wed, 01 Nov 2023 02:41:20 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wwwhhhyyy333 at gmail dot 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=3D112325 Bug ID: 112325 Summary: Missed vectorization after cunrolli Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: wwwhhhyyy333 at gmail dot com Target Milestone: --- testcase: #include #include typedef struct { float s; int8_t qs[32]; } block; void foo (const int n, float * restrict s, const int8_t q[4], const block * restrict y) { const int qk =3D 32; const int nb =3D n / qk; float sumf =3D 0.0; int sumi =3D 0; for (int i =3D 0; i < nb; i++) { uint32_t qh; memcpy(&qh, q, 4); for (int j =3D 0; j < qk/2; ++j) { sumi +=3D (qh >> j) * y[i].qs[j]; } sumf +=3D (y[i].s * (float) sumi); } *s =3D sumf; } This can be vectorized under -O2 -mavx512vl but not -O3 -mavx512vl, see https://godbolt.org/z/csPr4cPen Under -O3 -mavx512vl -fdisable-tree-cunrolli the loop can also be vectorize= d.=