public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/99754] [sse2] new _mm_loadu_si16 and _mm_loadu_si32 implemented incorrectly
Date: Mon, 28 Mar 2022 02:33:18 +0000	[thread overview]
Message-ID: <bug-99754-4-FDntjuJ1EC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99754-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by hongtao Liu
<liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:85568e505c3b06708ec0fb21d1ab4f78e0c66896

commit r11-9699-g85568e505c3b06708ec0fb21d1ab4f78e0c66896
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Mar 14 10:44:38 2022 +0100

    i386: Fix up _mm_loadu_si{16,32} [PR99754]

    These intrinsics are supposed to do an unaligned may_alias load
    of a 16-bit or 32-bit value and store it as the first element of
    a 128-bit integer vector, with all other elements cleared.

    The current _mm_storeu_* implementation implements that correctly, uses
    __*_u types to do the store and extracts the first element of a vector into
    it.
    But _mm_loadu_si{16,32} gets it all wrong.  It performs an aligned
    non-may_alias load and because _mm_set_epi{16,32} has the args reversed,
    it also inserts it into the last vector element instead of first.

    The following patch fixes that.

    Note, while the Intrinsics guide for _mm_loadu_si32 says SSE2,
    for _mm_loadu_si16 it says strangely SSE.  But the intrinsics
    returns __m128i, which is only defined in emmintrin.h, and
    _mm_set_epi16 is also only SSE2 and later in emmintrin.h.
    Even clang defines it in emmintrin.h and ends up with inlining
    failure when calling _mm_loadu_si16 from sse,no-sse2 function.
    So, isn't that a bug in the intrinsic guide instead?

    2022-03-14  Jakub Jelinek  <jakub@redhat.com>

            PR target/99754
            * config/i386/emmintrin.h (_mm_loadu_si32): Put loaded value into
            first   rather than last element of the vector, use __m32_u to do
            a really unaligned load, use just 0 instead of (int)0.
            (_mm_loadu_si16): Put loaded value into first rather than last
            element of the vector, use __m16_u to do a really unaligned load,
            use just 0 instead of (short)0.

            * gcc.target/i386/pr99754-1.c: New test.
            * gcc.target/i386/pr99754-2.c: New test.

  parent reply	other threads:[~2022-03-28  2:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 18:07 [Bug target/99754] New: " evan@coeus-group.com
2021-03-25  6:52 ` [Bug target/99754] " crazylht at gmail dot com
2022-03-11 15:15 ` peter at cordes dot ca
2022-03-11 15:21 ` peter at cordes dot ca
2022-03-11 15:53 ` jakub at gcc dot gnu.org
2022-03-14  9:45 ` cvs-commit at gcc dot gnu.org
2022-03-26 23:03 ` peter at cordes dot ca
2022-03-28  1:44 ` crazylht at gmail dot com
2022-03-28  2:33 ` cvs-commit at gcc dot gnu.org [this message]
2022-03-28  2:35 ` crazylht at gmail dot com
2022-05-07  7:26 ` jakub 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-99754-4-FDntjuJ1EC@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).