From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 31F2D3858420; Mon, 22 Jan 2024 06:06:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31F2D3858420 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705903579; bh=wetKVVzRa16CTmnORTQy4jQeDKl9Rq0OtYgCqUuXklQ=; h=From:To:Subject:Date:From; b=dcOa+lliWVL8eGhxOqpm6rIZkKNCsK90q7zIg42eDWGIbIjAcxBYqQkSvDmvOFA0T goZWFPZvGYFg9o17ARSxUY0DrKTp8UwDaJc+Zl9J40ahEgY5s3fi8PKIo9wi2A5uPe wKHZhzQvvGmorn3vpEFfr7SaHFtzTakM8dQme0oE= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113537] New: ext should be used more for __builtin_shufflevector Date: Mon, 22 Jan 2024 06:06:18 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia 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 keywords bug_severity priority component assigned_to reporter target_milestone cf_gcctarget 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113537 Bug ID: 113537 Summary: ext should be used more for __builtin_shufflevector Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Target: aarch64 Take: ``` #define vector4 __attribute__((vector_size(4))) #define vector8 __attribute__((vector_size(8))) #define vector16 __attribute__((vector_size(16))) vector8 char f3(vector16 char a) { return __builtin_shufflevector (a, a, 1, 2, 3, 4, 5, 6, 7, 8); } vector8 char f2(vector16 char a) { return __builtin_shufflevector (a, a, 1, 2, 3, 4, 5, 6, 7, 0); } ``` Currently GCC produces: ``` f3: adrp x0, .LC0 ldr q31, [x0, #:lo12:.LC0] tbl v0.16b, {v0.16b}, v31.16b ret f2: adrp x0, .LC1 ldr q31, [x0, #:lo12:.LC1] tbl v0.16b, {v0.16b}, v31.16b ret ``` But these should be optimized to just: ``` f3: ext v0.16b, v0.16b, v0.16b, #1 ret f2: ext v0.8b, v0.8b, v0.8b, #1 ret ```=