From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DDD8E385DC27; Tue, 10 Aug 2021 13:14:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDD8E385DC27 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/101846] New: Improve __builtin_shufflevector emitted code Date: Tue, 10 Aug 2021 13:14:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Tue, 10 Aug 2021 13:14:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101846 Bug ID: 101846 Summary: Improve __builtin_shufflevector emitted code Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- typedef short v16hi __attribute__((vector_size (32))); typedef short v32hi __attribute__((vector_size (64))); v32hi foo (v16hi x) { return __builtin_shufflevector (x, (v16hi) {}, 0, 16, 1, 17, 2, 18, 3, 19= , 4, 20, 5, 21, 6, 22, 7, 23, 8, 24, 9, 25, 10, 26, 11, = 27, 12, 28, 13, 29, 14, 30, 15, 31); } v16hi bar (v32hi x) { return __builtin_shufflevector (x, x, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, = 20, 22, 24, 26, 28, 30); } shows two cases, where we should be emitting just vpmovzxwd %ymm0, %zmm0 and vpmovdw %zmm0, %ymm0 but we actually emit vmovdqa %ymm0, %ymm0 vpmovzxwd %ymm0, %zmm0 where the vmovdqa is unnecessary - the permutation doesn't care about the elements at or above 32-bytes - and vmovdqa64 %zmm0, %zmm1 vmovdqa64 .LC0(%rip), %zmm0 vpermi2w %zmm1, %zmm1, %zmm0 Similarly for permutations matching other vpmovxz* or vpmov* instructions.=