From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6DE8C3858C66; Tue, 6 Feb 2024 17:05:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DE8C3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707239147; bh=stsMJoCe7u+/K6jBQIPXDEllKQeBHKhxCts5XUqzPeY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FRk7orjaFR1wh3GH4fiBLPpkdkgZ+zWBah/VbMPGCeBrbsr4iV3fG7dic3N3LKxH1 xLTHTkB80KcWjHGTKD09akZScgJ/lebGYH5EectF4D6wTldJpx1xPvG7ASMHsOjr4i PcfoPzfWLwl+48ftbAbBzymEJrEiyhKe0aF9zJ6o= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113677] Missing `VEC_PERM_EXPR <{a, CST}, CST, {0, 1, 2, ...}>` optimization Date: Tue, 06 Feb 2024 17:05:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113677 --- Comment #4 from Andrew Pinski --- Note it is not just about constants either. Take: ``` #define vect64 __attribute__((vector_size(8) )) #define vect128 __attribute__((vector_size(16) )) vect128 unsigned int f(vect64 unsigned int a, vect64 unsigned int b) { vect64 unsigned int zero=3D{0, 0}; return __builtin_shufflevector (a, b, 0, 1, 2, 3); } ``` We get: ``` _1 =3D {a_3(D), { 0, 0 }}; _2 =3D {b_4(D), { 0, 0 }}; _5 =3D VEC_PERM_EXPR <_1, _2, { 0, 1, 4, 5 }>; ``` Which obvious could be done to just: `_5 =3D {a_3(D), b_4(D)};`=