From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CADC03858D37; Fri, 21 Jan 2022 01:25:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CADC03858D37 From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104151] [9/10/11/12 Regression] x86: excessive code generated for 128-bit byteswap Date: Fri, 21 Jan 2022 01:25:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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: Fri, 21 Jan 2022 01:25:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104151 --- Comment #3 from Hongtao.liu --- 172_1 1 times scalar_store costs 12 in body 173_2 1 times scalar_store costs 12 in body 174__builtin_bswap64 (_8) 1 times scalar_stmt costs 4 in body 175__builtin_bswap64 (_10) 1 times scalar_stmt costs 4 in body 176BIT_FIELD_REF 1 times scalar_stmt costs 4 in body 177BIT_FIELD_REF 1 times scalar_stmt costs 4 in body 1781 1 times vec_perm costs 4 in body 179__builtin_bswap64 (_8) 1 times vector_stmt costs 4 in prologue 180__builtin_bswap64 (_8) 1 times vec_perm costs 4 in body 181_1 1 times vector_store costs 16 in body 182test.cc:9:10: note: Cost model analysis for part in loop 0: 183 Vector cost: 28 184 Scalar cost: 40 ... 243 [local count: 1073741824]: 244 _8 =3D BIT_FIELD_REF ; 245 _11 =3D VIEW_CONVERT_EXPR(a_3(D)); 246 _13 =3D VIEW_CONVERT_EXPR(a_3(D)); 247 _12 =3D VEC_PERM_EXPR <_11, _13, { 1, 0 }>; 248 _14 =3D VIEW_CONVERT_EXPR(_12); 249 _15 =3D VEC_PERM_EXPR <_14, _14, { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13,= 12, 11, 10, 9, 8 }>; 250 _16 =3D VIEW_CONVERT_EXPR(_15); 251 _1 =3D __builtin_bswap64 (_8); 252 _10 =3D BIT_FIELD_REF ; 253 _2 =3D __builtin_bswap64 (_10); 254 MEM [(long unsigned int *)&y] =3D _16; 255 _7 =3D MEM [(char * {ref-all})&y]; 1. According to ABI, uint128 is passed by 2 gpr, and there should be extra = cost for _11 =3D VIEW_CONVERT_EXPR(a_3(D)); 2. Why there's 1781 1 times vec_perm costs 4 in body, should it be= 2 times vec_perm costs?=