public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109082] New: emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive
@ 2023-03-09 15:34 malat at debian dot org
  2023-03-09 15:35 ` [Bug c/109082] " malat at debian dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: malat at debian dot org @ 2023-03-09 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109082
           Summary: emmintrin.h:1624:16: error: argument 3 must be a
                    literal between 0 and 15, inclusive
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: malat at debian dot org
  Target Milestone: ---

On ppc64el here is what I get:

% /usr/lib/gcc-snapshot/bin/gcc -DNO_WARN_X86_INTRINSICS -O3 -c tu.c
In file included from tu.c:1:
In function '_mm_bsrli_si128',
    inlined from 'foo' at tu.c:3:10:
/usr/lib/gcc-snapshot/lib/gcc/powerpc64le-linux-gnu/13/include/emmintrin.h:1624:16:
error: argument 3 must be a literal between 0 and 15, inclusive
 1624 |       __result = vec_sld (__zeros, (__v16qu) __A, (16 - __N));
      |       ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

where

% cat tu.c
#include <emmintrin.h>
__m128i foo(__m128i A) {
  return _mm_bsrli_si128(A, 0);
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/109082] emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive
  2023-03-09 15:34 [Bug c/109082] New: emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive malat at debian dot org
@ 2023-03-09 15:35 ` malat at debian dot org
  2023-03-09 15:44 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: malat at debian dot org @ 2023-03-09 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Mathieu Malaterre <malat at debian dot org> ---
Looks like a typo:

% head -1624
/usr/lib/gcc-snapshot/lib/gcc/powerpc64le-linux-gnu/13/include/emmintrin.h |
tail
  __v16qu __result;
  const __v16qu __zeros = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

  if (__N < 16)
#ifdef __LITTLE_ENDIAN__
    if (__builtin_constant_p(__N))
      /* Would like to use Vector Shift Left Double by Octet
         Immediate here to use the immediate form and avoid
         load of __N * 8 value into a separate VR.  */
      __result = vec_sld (__zeros, (__v16qu) __A, (16 - __N));

^

should be 15 - __N

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/109082] emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive
  2023-03-09 15:34 [Bug c/109082] New: emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive malat at debian dot org
  2023-03-09 15:35 ` [Bug c/109082] " malat at debian dot org
@ 2023-03-09 15:44 ` jakub at gcc dot gnu.org
  2023-03-09 15:48 ` [Bug target/109082] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-09 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I doubt (15 - __N) would be correct, more likely -__N & 15.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/109082] emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive
  2023-03-09 15:34 [Bug c/109082] New: emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive malat at debian dot org
  2023-03-09 15:35 ` [Bug c/109082] " malat at debian dot org
  2023-03-09 15:44 ` jakub at gcc dot gnu.org
@ 2023-03-09 15:48 ` jakub at gcc dot gnu.org
  2023-03-16  8:14 ` linkw at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-09 15:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
_mm_slli_si128's __result = vec_sld (__zeros, (__v16qu) __A, (16 - _imm5)); has
similar problem.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/109082] emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive
  2023-03-09 15:34 [Bug c/109082] New: emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive malat at debian dot org
                   ` (2 preceding siblings ...)
  2023-03-09 15:48 ` [Bug target/109082] " jakub at gcc dot gnu.org
@ 2023-03-16  8:14 ` linkw at gcc dot gnu.org
  2023-03-27  2:45 ` cvs-commit at gcc dot gnu.org
  2023-03-27  8:10 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-03-16  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |linkw at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-03-16

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
Confirmed, as PVIPR for:
   r = vec_sld (a, b, c)
c must be in the range 0–15.

I noticed that for:

__m128i test_r(__m128i vec )
{
    return _mm_bsrli_si128 ( vec, -1);
}

icc would optimize it to vzero while gcc would emit error msg.

IMHO we should guard the N with __N < 16 && __N >= 0 and return vzeros for the
others.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/109082] emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive
  2023-03-09 15:34 [Bug c/109082] New: emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive malat at debian dot org
                   ` (3 preceding siblings ...)
  2023-03-16  8:14 ` linkw at gcc dot gnu.org
@ 2023-03-27  2:45 ` cvs-commit at gcc dot gnu.org
  2023-03-27  8:10 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-27  2:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:f33fc0775706e4db80d584c477608e28f4da0a6f

commit r13-6870-gf33fc0775706e4db80d584c477608e28f4da0a6f
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Sun Mar 26 21:42:23 2023 -0500

    rs6000: Ensure vec_sld shift count in allowable range [PR109082]

    As PR109082 shows, some uses of vec_sld in emmintrin.h don't
    strictly guarantee the given shift count is in the range
    0-15 (inclusive).  This patch is to make the argument
    range constraint honored for those uses.

            PR target/109082

    gcc/ChangeLog:

            * config/rs6000/emmintrin.h (_mm_bslli_si128): Check __N is not
less
            than zero when calling vec_sld.
            (_mm_bsrli_si128): Return __A if __N is zero, check __N is bigger
than
            zero when calling vec_sld.
            (_mm_slli_si128): Return __A if _imm5 is zero, check _imm5 is
bigger
            than zero when calling vec_sld.

    gcc/testsuite/ChangeLog:

            * gcc.target/powerpc/pr109082.c: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/109082] emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive
  2023-03-09 15:34 [Bug c/109082] New: emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive malat at debian dot org
                   ` (4 preceding siblings ...)
  2023-03-27  2:45 ` cvs-commit at gcc dot gnu.org
@ 2023-03-27  8:10 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-03-27  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Kewen Lin <linkw at gcc dot gnu.org> ---
Should be fixed on trunk.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-27  8:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09 15:34 [Bug c/109082] New: emmintrin.h:1624:16: error: argument 3 must be a literal between 0 and 15, inclusive malat at debian dot org
2023-03-09 15:35 ` [Bug c/109082] " malat at debian dot org
2023-03-09 15:44 ` jakub at gcc dot gnu.org
2023-03-09 15:48 ` [Bug target/109082] " jakub at gcc dot gnu.org
2023-03-16  8:14 ` linkw at gcc dot gnu.org
2023-03-27  2:45 ` cvs-commit at gcc dot gnu.org
2023-03-27  8:10 ` linkw at gcc dot gnu.org

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).