From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B6AA33858C01; Wed, 23 Aug 2023 13:39:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6AA33858C01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692797944; bh=TQFBvaeEk4RecHlC8YOgucBiAvs7atsHrOGq/ZCViGQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Gv4tXoRFlPI/U3S/BsxGPEFftL1ylFmXUd9Uy443jp+Vqxykn+tWJcUXrtmj69B35 0upW7tgvUGB4ZLbiccMZb8sw+yetP2MRvh1bXpbueahqwkr01+cGlLrojKLPlF/lCt LuvR7jloA6wxjCOSGyo4xKBnOtOV7C9tsBhN7d+U= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/94866] Failure to optimize pinsrq of 0 with index 1 into movq Date: Wed, 23 Aug 2023 13:39:04 +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: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ubizjak at gmail dot com 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=3D94866 --- Comment #6 from Hongtao.liu --- (In reply to Uro=C5=A1 Bizjak from comment #4) > (In reply to Hongtao.liu from comment #3) > > in x86 backend expand_vec_perm_1, we always tries vec_merge frist for > > !one_operand_p, expand_vselect_vconcat is only tried when vec_merge fai= led > > which means we'd better to use vec_merge instead of vec_select:vec_conc= at > > when available in out backend pattern match. >=20 > In fact, I tried to convert existing sse2_movq128 patterns to vec_merge, = but > the patch regressed: >=20 > -FAIL: gcc.target/i386/sse2-pr94680-2.c scan-assembler movq > -FAIL: gcc.target/i386/sse2-pr94680-2.c scan-assembler-not pxor > -FAIL: gcc.target/i386/sse2-pr94680.c scan-assembler-not pxor > -FAIL: gcc.target/i386/sse2-pr94680.c scan-assembler-times > (?n)(?:mov|psrldq).*%xmm[0-9] 12 >=20 > So, the compiler still expects vec_concat/vec_select patterns to be prese= nt. v2df foo_v2df (v2df x) { return __builtin_shuffle (x, (v2df) { 0, 0 }, (v2di) { 0, 2 }); } The testcase is not a typical vec_merge case, for vec_merge, the shuffle in= dex should be {0, 3}. Here it happened to be a vec_merge because the second vec= tor is all zero. And yes for this case, we still need to vec_concat:vec_select pattern.=