From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 453983858D37; Thu, 9 Mar 2023 02:21:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 453983858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678328489; bh=EIokLYg9XIb0BtfpfkcuiQ+JB9P/yLoQAWeFdIUCv7o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XtowkEGcvTAKLYqFUyahwCIdJq0NzPsqJbI/PMwMIKY6q5OtKSfu4ttBmLw34RWiO n7khZZhW9fAXX5HLNaI8LqMqU4AIx/HgHy16yIYlRaQ/STztnMrZGbgtqHf6Ae0AmO KYUjT/POlukB/LZEE5JtLfkbBOW84TTjm54e+YGw= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108938] Missing bswap detection Date: Thu, 09 Mar 2023 02:21:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108938 --- Comment #14 from Hongtao.liu --- Got 1 performance opportunity in GCC itself with bswap + bit_and + rotate, = the Intermediate value are all single-use which can be DCEd. Got 4 performance opportunity in SPEC2017. bswap + bit_and + rotate + single_use: 1=20 bswap + rotate + single_use: 1 bswap + rotate + not single_use: 2. For 2 not single use, the tectase is like foo1 (char* a, unsigned int* __restrict b) { a[0] =3D b[0] >> 24; a[1] =3D b[0] >> 16; a[2] =3D b[0] >> 8; a[3] =3D b[0]; a[4] =3D b[1] >> 24; a[5] =3D b[1] >> 16; a[6] =3D b[1] >> 8; a[7] =3D b[1]; } b[0] is used by multi stmt for shift, but no other places, so it actually c= an be DECd. So for GCC itself and SPEC2017 with -O2, bswap + bit_and + rotate optimization won't cause extra stmts.=