public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "clyon at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-104882-4-RwTUnbMsrW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104882-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104882

Christophe Lyon <clyon at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2022-03-16

--- Comment #2 from Christophe Lyon <clyon at gcc dot gnu.org> ---
My understanding is that MVE's vmovn instructions do not work like Neon's.

If q0 = { 0x33333333, 0x22222222, 0x11111111, 0 } ( 4x32 bits)
   q1 = { 0x77777777, 0x66666666, 0x55555555, 0x44444444 }

With Neon:
vmovn.i32 d4, q0 gives:
d4 = { 0x3333, 0x2222, 0x1111, 0 } (4x16 bits)
vmovn.i32 d5, q1 gives:
d5 = { 0x7777, 0x6666, 0x5555, 0x4444 }
thus q2 = { 0x7777, 0x6666, 0x5555, 0x4444, 0x3333, 0x2222, 0x1111, 0 }

But with MVE:
vmovnb.i32 q2, q0 gives:
q2 = { 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 = { 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 = { 0x66666666, 0x44444444, 0x22222222, 0 }
q1 = { 0x77777777, 0x55555555, 0x33333333, 0x11111111 }

since MVE's vmovn do not seem to naturally map to GCC's vec_pack_trunc

  parent reply	other threads:[~2022-03-16 14:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11 14:18 [Bug target/104882] New: " acoplan at gcc dot gnu.org
2022-03-11 14:21 ` [Bug target/104882] " acoplan at gcc dot gnu.org
2022-03-14  5:39 ` pinskia at gcc dot gnu.org
2022-03-14  7:50 ` rguenth at gcc dot gnu.org
2022-03-16 14:40 ` clyon at gcc dot gnu.org [this message]
2022-03-22 14:37 ` clyon at gcc dot gnu.org
2022-03-25 17:27 ` cvs-commit at gcc dot gnu.org
2022-03-25 17:30 ` clyon at gcc dot gnu.org
2023-03-03 19:10 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-104882-4-RwTUnbMsrW@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).