From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 30A0B3858C50; Fri, 17 Nov 2023 02:57:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 30A0B3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700189825; bh=6L342s6EMdVv8SkqjBDYRA3a/jbEjZRW6FCqy2YesUQ=; h=From:To:Subject:Date:From; b=YTfkJkq7G3zGSMrkK/ujgNgGtuhco/uRzZFpM7Pz8AAu67jroKO12SLzIfPPUZLmS sTGEbhEEcqs8skXwRIgFz+iBRUKGz48pjCmo/bqFfncTHlyNhhGL0dRoXUBxrgm4wS 5mu9Ozxa/ci5MtW4faB4W3cq3Fc/7IDJW0E6i/xw= From: "liuhongt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112579] New: bb vectorizer failed to reduction sum += inv >> {1,2,3,4,5,6,7,8} Date: Fri, 17 Nov 2023 02:57:04 +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: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: liuhongt 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 blocked 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=3D112579 Bug ID: 112579 Summary: bb vectorizer failed to reduction sum +=3D inv >> {1,2,3,4,5,6,7,8} Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: liuhongt at gcc dot gnu.org Blocks: 112325 Target Milestone: --- This is from PR112325 unsigned foo (unsigned * restrict s, unsigned qh, unsigned * restrict qs) { unsigned int sumi =3D 0; sumi +=3D (qh >> 0); sumi +=3D (qh >> 1); sumi +=3D (qh >> 2); sumi +=3D (qh >> 3); sumi +=3D (qh >> 4); sumi +=3D (qh >> 5); sumi +=3D (qh >> 6); sumi +=3D (qh >> 7); sumi +=3D (qh >> 8); sumi +=3D (qh >> 9); sumi +=3D (qh >> 10); sumi +=3D (qh >> 11); sumi +=3D (qh >> 12); sumi +=3D (qh >> 13); sumi +=3D (qh >> 14); sumi +=3D (qh >> 15); return sumi; } test2.c:28:8: note: nunits =3D 8 test2.c:28:8: missed: Build SLP failed: unrolling required in basic block= SLP test2.c:28:8: note: Build SLP for _5 =3D qh_16(D) >> 5; test2.c:28:8: note: get vectype for scalar type (group size 14): unsigned= int test2.c:28:8: note: vectype: vector(8) unsigned int test2.c:28:8: note: nunits =3D 8 test2.c:28:8: missed: Build SLP failed: unrolling required in basic block= SLP test2.c:28:8: note: Build SLP for _4 =3D qh_16(D) >> 4; test2.c:28:8: note: get vectype for scalar type (group size 14): unsigned= int test2.c:28:8: note: vectype: vector(8) unsigned int test2.c:28:8: note: nunits =3D 8 test2.c:28:8: missed: Build SLP failed: unrolling required in basic block= SLP test2.c:28:8: note: Build SLP for _3 =3D qh_16(D) >> 3; test2.c:28:8: note: get vectype for scalar type (group size 14): unsigned= int test2.c:28:8: note: vectype: vector(8) unsigned int test2.c:28:8: note: nunits =3D 8 test2.c:28:8: missed: Build SLP failed: unrolling required in basic block= SLP test2.c:28:8: note: Build SLP for _1 =3D qh_16(D) >> 1; test2.c:28:8: note: get vectype for scalar type (group size 14): unsigned= int test2.c:28:8: note: vectype: vector(8) unsigned int test2.c:28:8: note: nunits =3D 8 test2.c:28:8: missed: Build SLP failed: unrolling required in basic block= SLP test2.c:28:8: note: SLP discovery for node 0x6415a60 failed test2.c:28:8: note: SLP discovery failed rewrite it as unsigned foo1 (unsigned * restrict s, unsigned qh, unsigned * restrict qs) { unsigned int sumi =3D 0; for (int i =3D 0; i !=3D 16; i++) sumi +=3D qh >> i; return sumi; } loop vectorizer successfully vectorize it. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112325 [Bug 112325] Missed vectorization of reduction after unrolling=