From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5BC433858402; Wed, 31 Jan 2024 01:46:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5BC433858402 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706665590; bh=ByqHlMQfWJrSH25KpsQ0kczldhcfWnd0+FfbKam9h3M=; h=From:To:Subject:Date:From; b=rQKelq3EshRu/iZOTzWz+EljX9q/5GyhGTgwY1EHfVX3crpHzME8ioNIOXmM7CJD5 pn5i7JYdP6RQZaGvGASUoy5Nv6SfGeoey623n41M6PlEhWBpX9YXX5aac4K8LnBTWc iqFRC2sjDzIKBi6CXNa5mdJcpFeZ/6Iekuaep3QA= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113677] New: Missing `VEC_PERM_EXPR <{a, CST}, CST, {0, 1, 2, ...}>` optimization Date: Wed, 31 Jan 2024 01:46:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization 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 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=3D113677 Bug ID: 113677 Summary: Missing `VEC_PERM_EXPR <{a, CST}, CST, {0, 1, 2, ...}>` optimization Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` #define vect32 __attribute__((vector_size(4) )) #define vect64 __attribute__((vector_size(8) )) vect64 unsigned char f(vect32 unsigned char a) { vect32 unsigned char zero=3D{0,0,0,0}; return __builtin_shufflevector (a, zero, 0, 1, 2, 3, 4, 5, 6, 7); } ``` On x86_64 this produces: ``` f: movd xmm0, edi pxor xmm1, xmm1 punpckldq xmm0, xmm1 ret ``` We should just produce: ``` movd xmm0, edi ret ``` In .optimized we get: ``` _1 =3D {a_2(D), { 0, 0, 0, 0 }}; _3 =3D VEC_PERM_EXPR <_1, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 1, 2, 3, 8, 9,= 10, 11 }>; return _3; ``` But _3 and _1 are the same ...=