public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/109167] New: rs6000: _mm_slli_si128 and _mm_bslli_si128 are inconsistent in wrapper header
@ 2023-03-17 2:33 linkw at gcc dot gnu.org
2023-03-17 2:37 ` [Bug target/109167] " linkw at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-03-17 2:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109167
Bug ID: 109167
Summary: rs6000: _mm_slli_si128 and _mm_bslli_si128 are
inconsistent in wrapper header
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: linkw at gcc dot gnu.org
Target Milestone: ---
When I was investigating PR109082, I happened to find that in
gcc/config/rs6000/emmintrin.h, we have different definitions for _mm_slli_si128
and _mm_bslli_si128 as follow:
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_bslli_si128 (__m128i __A, const int __N)
{
__v16qu __result;
const __v16qu __zeros = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
if (__N >= 0 && __N < 16)
__result = vec_sld ((__v16qu) __A, __zeros, __N);
else
__result = __zeros;
return (__m128i) __result;
}
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_slli_si128 (__m128i __A, const int _imm5)
{
__v16qu __result;
const __v16qu __zeros = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
if (_imm5 == 0)
return __A;
else if (_imm5 > 0 && _imm5 < 16)
#ifdef __LITTLE_ENDIAN__
__result = vec_sld ((__v16qu) __A, __zeros, _imm5);
#else
__result = vec_sld (__zeros, (__v16qu) __A, (16 - _imm5));
#endif
else
__result = __zeros;
return (__m128i) __result;
}
But actually as ./gcc/config/i386/emmintrin.h, they should be the same:
#ifdef __OPTIMIZE__
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_bsrli_si128 (__m128i __A, const int __N)
{
return (__m128i)__builtin_ia32_psrldqi128 (__A, __N * 8);
}
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_bslli_si128 (__m128i __A, const int __N)
{
return (__m128i)__builtin_ia32_pslldqi128 (__A, __N * 8);
}
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_srli_si128 (__m128i __A, const int __N)
{
return (__m128i)__builtin_ia32_psrldqi128 (__A, __N * 8);
}
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_slli_si128 (__m128i __A, const int __N)
{
return (__m128i)__builtin_ia32_pslldqi128 (__A, __N * 8);
}
#else
#define _mm_bsrli_si128(A, N) \
((__m128i)__builtin_ia32_psrldqi128 ((__m128i)(A), (int)(N) * 8))
#define _mm_bslli_si128(A, N) \
((__m128i)__builtin_ia32_pslldqi128 ((__m128i)(A), (int)(N) * 8))
#define _mm_srli_si128(A, N) \
((__m128i)__builtin_ia32_psrldqi128 ((__m128i)(A), (int)(N) * 8))
#define _mm_slli_si128(A, N) \
((__m128i)__builtin_ia32_pslldqi128 ((__m128i)(A), (int)(N) * 8))
#endif
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/109167] rs6000: _mm_slli_si128 and _mm_bslli_si128 are inconsistent in wrapper header
2023-03-17 2:33 [Bug target/109167] New: rs6000: _mm_slli_si128 and _mm_bslli_si128 are inconsistent in wrapper header linkw at gcc dot gnu.org
@ 2023-03-17 2:37 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-03-17 2:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109167
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Target| |powerpc*-linux-gnu
Last reconfirmed| |2023-03-17
Assignee|unassigned at gcc dot gnu.org |linkw at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
The pair _mm_srli_si128 and _mm_bsrli_si128 doesn't have this issue:
extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_srli_si128 (__m128i __A, const int __N)
{
return _mm_bsrli_si128 (__A, __N);
}
And _mm_bsrli_si128 adopts different shifting directions for LE and BE, so I
think the current implementation of _mm_slli_si128 is what we want for
_mm_bslli_si128.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/109167] rs6000: _mm_slli_si128 and _mm_bslli_si128 are inconsistent in wrapper header
2023-03-17 2:33 [Bug target/109167] New: rs6000: _mm_slli_si128 and _mm_bslli_si128 are inconsistent in wrapper header linkw at gcc dot gnu.org
2023-03-17 2:37 ` [Bug target/109167] " 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
2 siblings, 0 replies; 4+ 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=109167
--- Comment #2 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:1e20bb6737e1173a0c3ef3e9e48c0eda40985ded
commit r13-6871-g1e20bb6737e1173a0c3ef3e9e48c0eda40985ded
Author: Kewen Lin <linkw@linux.ibm.com>
Date: Sun Mar 26 21:43:39 2023 -0500
rs6000: Make _mm_slli_si128 and _mm_bslli_si128 consistent [PR109167]
As PR109167 shows, it's unexpected to have two different
implementation ways for _mm_slli_si128 and _mm_bslli_si128,
as gcc/config/i386/emmintrin.h they should be the same. So
this patch is to fix it accordingly.
PR target/109167
gcc/ChangeLog:
* config/rs6000/emmintrin.h (_mm_bslli_si128): Move the
implementation
from ...
(_mm_slli_si128): ... here. Change to call _mm_bslli_si128
directly.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr109167.c: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/109167] rs6000: _mm_slli_si128 and _mm_bslli_si128 are inconsistent in wrapper header
2023-03-17 2:33 [Bug target/109167] New: rs6000: _mm_slli_si128 and _mm_bslli_si128 are inconsistent in wrapper header linkw at gcc dot gnu.org
2023-03-17 2:37 ` [Bug target/109167] " 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
2 siblings, 0 replies; 4+ 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=109167
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
Should be fixed on trunk.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-27 8:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 2:33 [Bug target/109167] New: rs6000: _mm_slli_si128 and _mm_bslli_si128 are inconsistent in wrapper header linkw at gcc dot gnu.org
2023-03-17 2:37 ` [Bug target/109167] " 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).