From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 48FA63858D37; Wed, 6 Apr 2022 07:00:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48FA63858D37 From: "krebbel at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/105175] New: [12 Regression] Pointless warning about missed vector optimization Date: Wed, 06 Apr 2022 07:00:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: krebbel 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: Wed, 06 Apr 2022 07:00:55 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105175 Bug ID: 105175 Summary: [12 Regression] Pointless warning about missed vector optimization Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: krebbel at gcc dot gnu.org Target Milestone: --- For this code snippet extracted from Qemu source: enum { QEMU_MIGRATION_COOKIE_PERSISTENT =3D 1 }; struct { unsigned flags; unsigned flagsMandatory } qemuMigrationCookieGetPersistent_mig; qemuMigrationCookieGetPersistent() { qemuMigrationCookieGetPersistent_mig.flags &=3D QEMU_MIGRATION_COOKIE_PERSISTENT; qemuMigrationCookieGetPersistent_mig.flagsMandatory &=3D QEMU_MIGRATION_COOKIE_PERSISTENT; } cc1 -O3 -mno-sse t.c -Wvector-operation-performance gives me: t.c: In function =E2=80=98qemuMigrationCookieGetPersistent=E2=80=99: t.c:7:46: warning: vector operation will be expanded with a single scalar operation [-Wvector-operation-performance] 7 | qemuMigrationCookieGetPersistent_mig.flags &=3D The generated code actually looks quite decent. Both integer AND operations= are merged into a 64 bit AND since https://gcc.gnu.org/git/gitweb.cgi?p=3Dgcc.git;h=3Df31da42e047e8018ca6ad980= 9273bc7efb6ffcaf This appears to be a nice optimization to me. However, in tree-vect-generic= .cc we then complain about this being implemented with just a scalar instructio= n. Apart from this being pretty confusing for the programmer who never request= ed anything to be vectorized I also don't see why it is a bad thing to impleme= nt a vector operation with a scalar operation as long as it is able to cover the entire vector with that. With GCC 12 we have auto-vectorization enabled already with -O2, so I expect this warning to surface much more frequently now. In particular on targets = like s390 where older distros still have to build everything without hardware ve= ctor support this might be annoying. Also I'm not sure whether this warning ever points at an actual problem. To me it looks like we should just drop it altogether.=