From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 262063858414; Wed, 8 Sep 2021 10:58:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 262063858414 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/96135] [9/10/11/12 regression] bswap not detected by bswap pass, unexpected results between optimization levels Date: Wed, 08 Sep 2021 10:58:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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, 08 Sep 2021 10:58:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96135 --- Comment #6 from Andrew Pinski --- (In reply to Andrew Pinski from comment #5) > Note on the trunk for f and g at -O3 -msse4 (and -O3 on aarch64), GCC > produces: > _21 =3D VIEW_CONVERT_EXPR(i_2(D)); > _22 =3D VEC_PERM_EXPR <_21, _21, { 7, 6, 5, 4, 3, 2, 1, 0 }>; > _18 =3D VIEW_CONVERT_EXPR(_22); >=20 > But that VEC_PERM_EXPR is a bswap :). >=20 > So to fix this at -O3 -msse4, maybe we could just do: > (simplify > (view_convert (vec_perm @0 @0 vector_cst_byteswap_p @1)) > (if (INTERGAL_TYPE_P (type))) > (convert (bswap (view_convert @1)))) >=20 > Note I don't think we want to do the byteswap in the integer registers if= we > are going back to the floating point registers. Or we could just support that in vect-lowering.=