public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
@ 2024-05-31 14:17 mkretz at gcc dot gnu.org
  2024-05-31 14:18 ` [Bug libstdc++/115308] " mkretz at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-05-31 14:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115308
           Summary: std::experimental::simd<char> is not convertible to
                    NEON intrinsic type with Clang
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: mkretz at gcc dot gnu.org
          Reporter: mkretz at gcc dot gnu.org
  Target Milestone: ---
            Target: arm-*-*, aarch64-*-*

std::experimental::parallelism_v2::__int_for_sizeof<1>() returns 'char' instead
of 'signed char' if __clang__ is defined. With -fno-signed-char that's an
observable bug.

https://github.com/VcDevel/std-simd/commit/2f99e2813fc751d2493ad79bc1aec3ce64c7c49e
is the commit that introduced it (before the merge to libstdc++). "Use char for
1
byte and long long for 8 bytes. This is necessary to match the return vector
type of vector compares."
I'm taking a guess here that this is due to GCC applying
-flax-vector-conversions on vector compare results and Clang probably doesn't
do it. But that still doesn't really justify returning 'char' unconditionally
for trait that is supposed to return a signed integer type.

The mask type issue must be solved differently, so that __int_for_sizeof can
return the right type again.

All releases of GCC are affected.

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

* [Bug libstdc++/115308] std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
  2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
@ 2024-05-31 14:18 ` mkretz at gcc dot gnu.org
  2024-06-04  8:22 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-05-31 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-05-31

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

* [Bug libstdc++/115308] std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
  2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
  2024-05-31 14:18 ` [Bug libstdc++/115308] " mkretz at gcc dot gnu.org
@ 2024-06-04  8:22 ` cvs-commit at gcc dot gnu.org
  2024-06-04  8:28 ` mkretz at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-04  8:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Matthias Kretz <mkretz@gcc.gnu.org>:

https://gcc.gnu.org/g:8e36cf4c5c9140915d0019999db132a900b48037

commit r15-1007-g8e36cf4c5c9140915d0019999db132a900b48037
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Mon Jun 3 12:02:07 2024 +0200

    libstdc++: Fix simd<char> conversion for -fno-signed-char for Clang

    The special case for Clang in the trait producing a signed integer type
    lead to the trait returning 'char' where it should have been 'signed
    char'. This workaround was introduced because on Clang the return type
    of vector compares was not convertible to '_SimdWrapper<
    __int_for_sizeof_t<...' unless '__int_for_sizeof_t<char>' was an alias
    for 'char'. In order to not rewrite the complete mask type code (there
    is code scattered around the implementation assuming signed integers),
    this needs to be 'signed char'; so the special case for Clang needs to
    be removed.
    The conversion issue is now solved in _SimdWrapper, which now
    additionally allows conversion from vector types with compatible
    integral type.

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115308
            * include/experimental/bits/simd.h (__int_for_sizeof): Remove
            special cases for __clang__.
            (_SimdWrapper): Change constructor overload set to allow
            conversion from vector types with integral conversions via bit
            reinterpretation.

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

* [Bug libstdc++/115308] std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
  2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
  2024-05-31 14:18 ` [Bug libstdc++/115308] " mkretz at gcc dot gnu.org
  2024-06-04  8:22 ` cvs-commit at gcc dot gnu.org
@ 2024-06-04  8:28 ` mkretz at gcc dot gnu.org
  2024-06-10  5:58 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-06-04  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
Resolved on trunk, will backport later

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

* [Bug libstdc++/115308] std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
  2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-06-04  8:28 ` mkretz at gcc dot gnu.org
@ 2024-06-10  5:58 ` cvs-commit at gcc dot gnu.org
  2024-06-11  9:51 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-10  5:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Matthias Kretz
<mkretz@gcc.gnu.org>:

https://gcc.gnu.org/g:489b58b79782fa361c0d7e852e0e684d743c8399

commit r14-10296-g489b58b79782fa361c0d7e852e0e684d743c8399
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Mon Jun 3 12:02:07 2024 +0200

    libstdc++: Fix simd<char> conversion for -fno-signed-char for Clang

    The special case for Clang in the trait producing a signed integer type
    lead to the trait returning 'char' where it should have been 'signed
    char'. This workaround was introduced because on Clang the return type
    of vector compares was not convertible to '_SimdWrapper<
    __int_for_sizeof_t<...' unless '__int_for_sizeof_t<char>' was an alias
    for 'char'. In order to not rewrite the complete mask type code (there
    is code scattered around the implementation assuming signed integers),
    this needs to be 'signed char'; so the special case for Clang needs to
    be removed.
    The conversion issue is now solved in _SimdWrapper, which now
    additionally allows conversion from vector types with compatible
    integral type.

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115308
            * include/experimental/bits/simd.h (__int_for_sizeof): Remove
            special cases for __clang__.
            (_SimdWrapper): Change constructor overload set to allow
            conversion from vector types with integral conversions via bit
            reinterpretation.

    (cherry picked from commit 8e36cf4c5c9140915d0019999db132a900b48037)

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

* [Bug libstdc++/115308] std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
  2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-06-10  5:58 ` cvs-commit at gcc dot gnu.org
@ 2024-06-11  9:51 ` cvs-commit at gcc dot gnu.org
  2024-06-20  4:48 ` ramana at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-11  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Matthias Kretz
<mkretz@gcc.gnu.org>:

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

commit r13-8841-gef2169090d0868e4718c2ebf25365aaa52c22139
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Mon Jun 3 12:02:07 2024 +0200

    libstdc++: Fix simd<char> conversion for -fno-signed-char for Clang

    The special case for Clang in the trait producing a signed integer type
    lead to the trait returning 'char' where it should have been 'signed
    char'. This workaround was introduced because on Clang the return type
    of vector compares was not convertible to '_SimdWrapper<
    __int_for_sizeof_t<...' unless '__int_for_sizeof_t<char>' was an alias
    for 'char'. In order to not rewrite the complete mask type code (there
    is code scattered around the implementation assuming signed integers),
    this needs to be 'signed char'; so the special case for Clang needs to
    be removed.
    The conversion issue is now solved in _SimdWrapper, which now
    additionally allows conversion from vector types with compatible
    integral type.

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115308
            * include/experimental/bits/simd.h (__int_for_sizeof): Remove
            special cases for __clang__.
            (_SimdWrapper): Change constructor overload set to allow
            conversion from vector types with integral conversions via bit
            reinterpretation.

    (cherry picked from commit 8e36cf4c5c9140915d0019999db132a900b48037)

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

* [Bug libstdc++/115308] std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
  2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-06-11  9:51 ` cvs-commit at gcc dot gnu.org
@ 2024-06-20  4:48 ` ramana at gcc dot gnu.org
  2024-06-20  7:25 ` mkretz at gcc dot gnu.org
  2024-06-20 12:45 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ramana at gcc dot gnu.org @ 2024-06-20  4:48 UTC (permalink / raw)
  To: gcc-bugs

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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

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

--- Comment #5 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Matthias - are you looking to go further back than GCC 13 for this ?

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

* [Bug libstdc++/115308] std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
  2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-06-20  4:48 ` ramana at gcc dot gnu.org
@ 2024-06-20  7:25 ` mkretz at gcc dot gnu.org
  2024-06-20 12:45 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-06-20  7:25 UTC (permalink / raw)
  To: gcc-bugs

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

Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.5

--- Comment #6 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
Yes, this was simply bad timing. The patch hit the GCC 12.4 freeze. I already
regtested it. Only waiting for 12.4 to be done. I have not yet checked whether
the patch makes sense on GCC 11.

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

* [Bug libstdc++/115308] std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang
  2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-06-20  7:25 ` mkretz at gcc dot gnu.org
@ 2024-06-20 12:45 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-20 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Matthias Kretz
<mkretz@gcc.gnu.org>:

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

commit r12-10572-gb9569e7a829d054336d2704ccff61eece5437baf
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Mon Jun 3 12:02:07 2024 +0200

    libstdc++: Fix simd<char> conversion for -fno-signed-char for Clang

    The special case for Clang in the trait producing a signed integer type
    lead to the trait returning 'char' where it should have been 'signed
    char'. This workaround was introduced because on Clang the return type
    of vector compares was not convertible to '_SimdWrapper<
    __int_for_sizeof_t<...' unless '__int_for_sizeof_t<char>' was an alias
    for 'char'. In order to not rewrite the complete mask type code (there
    is code scattered around the implementation assuming signed integers),
    this needs to be 'signed char'; so the special case for Clang needs to
    be removed.
    The conversion issue is now solved in _SimdWrapper, which now
    additionally allows conversion from vector types with compatible
    integral type.

    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/115308
            * include/experimental/bits/simd.h (__int_for_sizeof): Remove
            special cases for __clang__.
            (_SimdWrapper): Change constructor overload set to allow
            conversion from vector types with integral conversions via bit
            reinterpretation.

    (cherry picked from commit 8e36cf4c5c9140915d0019999db132a900b48037)

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

end of thread, other threads:[~2024-06-20 12:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-31 14:17 [Bug libstdc++/115308] New: std::experimental::simd<char> is not convertible to NEON intrinsic type with Clang mkretz at gcc dot gnu.org
2024-05-31 14:18 ` [Bug libstdc++/115308] " mkretz at gcc dot gnu.org
2024-06-04  8:22 ` cvs-commit at gcc dot gnu.org
2024-06-04  8:28 ` mkretz at gcc dot gnu.org
2024-06-10  5:58 ` cvs-commit at gcc dot gnu.org
2024-06-11  9:51 ` cvs-commit at gcc dot gnu.org
2024-06-20  4:48 ` ramana at gcc dot gnu.org
2024-06-20  7:25 ` mkretz at gcc dot gnu.org
2024-06-20 12:45 ` cvs-commit 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).