From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 61A8C3857806; Wed, 16 Mar 2022 14:40:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61A8C3857806 From: "clyon at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/104882] [12 Regression] MVE: Wrong code at -O2 since r12-1434-g046a3beb1673bf4a61c131373b6a5e84158e92bf Date: Wed, 16 Mar 2022 14:40:17 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: clyon at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: clyon at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed bug_status cf_reconfirmed_on 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, 16 Mar 2022 14:40:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104882 Christophe Lyon changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2022-03-16 --- Comment #2 from Christophe Lyon --- My understanding is that MVE's vmovn instructions do not work like Neon's. If q0 =3D { 0x33333333, 0x22222222, 0x11111111, 0 } ( 4x32 bits) q1 =3D { 0x77777777, 0x66666666, 0x55555555, 0x44444444 } With Neon: vmovn.i32 d4, q0 gives: d4 =3D { 0x3333, 0x2222, 0x1111, 0 } (4x16 bits) vmovn.i32 d5, q1 gives: d5 =3D { 0x7777, 0x6666, 0x5555, 0x4444 } thus q2 =3D { 0x7777, 0x6666, 0x5555, 0x4444, 0x3333, 0x2222, 0x1111, 0 } But with MVE: vmovnb.i32 q2, q0 gives: q2 =3D { 0x????, 0x3333, 0x????, 0x2222, 0x????, 0x1111, 0x????, 0 } (8x16 = bits, only the bottom bits of each 32 bits element are updated) vmovnt.i32 q2, q1 then gives: q2 =3D { 0x7777, 0x3333, 0x6666, 0x2222, 0x5555, 0x1111, 0x4444, 0 } (only = the top bits are updated) This means that the input should be shuffled before using MVE's vmovn[bt] to have q0 =3D { 0x66666666, 0x44444444, 0x22222222, 0 } q1 =3D { 0x77777777, 0x55555555, 0x33333333, 0x11111111 } since MVE's vmovn do not seem to naturally map to GCC's vec_pack_trunc=