From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A0303858C3A; Wed, 15 Dec 2021 03:25:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A0303858C3A From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/101846] Improve __builtin_shufflevector emitted code Date: Wed, 15 Dec 2021 03:25:42 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement 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: --- 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, 15 Dec 2021 03:25:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101846 --- Comment #9 from Hongtao.liu --- (In reply to Andrew Pinski from comment #7) > With just -mavx512f we produce a bunch of instructions (looking like we w= ent > to scalar mode) while LLVM is able to produce: > foo(short __vector(16)): # @foo(short __vector(= 16)) > .cfi_startproc > # %bb.0: > vpmovzxwd ymm1, xmm0 # ymm1 =3D > xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5], > zero,xmm0[6],zero,xmm0[7],zero > vextracti128 xmm0, ymm0, 1 > vpmovzxwd ymm0, xmm0 # ymm0 =3D > xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5], > zero,xmm0[6],zero,xmm0[7],zero > vinserti64x4 zmm0, zmm1, ymm0, 1 > ret >=20 >=20 zero_extend from ymm to zmm is supported under avx512bw, LLVM breaks them i= nto 2 zero extends from xmm to ymm, and then pack them back to zmm.=