This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/79678] x86 (and other?) SIMD builtins have signedness issues


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*, i?86-*-*

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Just as a note you should always use intrinsics, not builtins.  Currently
builtin types are specified using modes:

BDESC (OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A, CODE_FOR_mmx_umaxv8qi3,
"__builtin_ia32_pmaxub", IX86_BUILTIN_PMAXUB, UNKNOWN, (int)
V8QI_FTYPE_V8QI_V8QI)

in this case there's no signed variant (for MMX).  For v16qi3 we have

BDESC (OPTION_MASK_ISA_SSE2, CODE_FOR_umaxv16qi3, "__builtin_ia32_pmaxub128",
IX86_BUILTIN_PMAXUB128, UNKNOWN, (int) V16QI_FTYPE_V16QI_V16QI)
BDESC (OPTION_MASK_ISA_SSE4_1, CODE_FOR_smaxv16qi3, "__builtin_ia32_pmaxsb128",
IX86_BUILTIN_PMAXSB128, UNKNOWN, (int) V16QI_FTYPE_V16QI_V16QI)

where you can see how they'll end up having the same type signature.

Intrinsics have the same issue:

extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_max_epi8 (__m128i __X, __m128i __Y)
{
  return (__m128i) __builtin_ia32_pmaxsb128 ((__v16qi)__X, (__v16qi)__Y);
}

OTOH they return the generic __m128i and are thus not very useful in
conjunction
with the generic vector extensions.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]