public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
@ 2024-04-22 12:56 mkretz at gcc dot gnu.org
  2024-04-22 12:58 ` [Bug libstdc++/114803] " mkretz at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-04-22 12:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114803
           Summary: simd conversion to [[gnu::vector_size(N)]] type hits
                    invalid code in experimental/bits/simd_builtin.h
           Product: gcc
           Version: 14.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: ---

Testcase (https://godbolt.org/z/roGdrfz85):

#include <experimental/simd>
namespace stdx = std::experimental;

using V = stdx::simd<int>;
using VB [[gnu::vector_size(16)]] = int;

V test(V x)
{
  auto intrin = static_cast<__m128i>(x);
  x = static_cast<V>(intrin);
  auto vb = static_cast<VB>(x);
  return static_cast<V>(vb);
}

The above should compile to a simple `ret`.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
@ 2024-04-22 12:58 ` mkretz at gcc dot gnu.org
  2024-04-22 18:56 ` cvs-commit at gcc dot gnu.org
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-04-22 12:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-04-22
     Ever confirmed|0                           |1

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
  2024-04-22 12:58 ` [Bug libstdc++/114803] " mkretz at gcc dot gnu.org
@ 2024-04-22 18:56 ` cvs-commit at gcc dot gnu.org
  2024-04-22 18:58 ` mkretz at gcc dot gnu.org
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-22 18:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:7ef139146a8923a8719873ca3fdae175668e8d63

commit r14-10079-g7ef139146a8923a8719873ca3fdae175668e8d63
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Mon Apr 22 16:12:34 2024 +0200

    libstdc++: Fix conversion of simd to vector builtin

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

    libstdc++-v3/ChangeLog:

            PR libstdc++/114803
            * include/experimental/bits/simd_builtin.h
            (_SimdBase2::operator __vector_type_t): There is no __builtin()
            function in _SimdWrapper, instead use its conversion operator.
            * testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc: New
            test.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
  2024-04-22 12:58 ` [Bug libstdc++/114803] " mkretz at gcc dot gnu.org
  2024-04-22 18:56 ` cvs-commit at gcc dot gnu.org
@ 2024-04-22 18:58 ` mkretz at gcc dot gnu.org
  2024-05-07 16:19 ` cvs-commit at gcc dot gnu.org
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-04-22 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
Fixed in master, still need to backport.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-04-22 18:58 ` mkretz at gcc dot gnu.org
@ 2024-05-07 16:19 ` cvs-commit at gcc dot gnu.org
  2024-05-08 16:15 ` cvs-commit at gcc dot gnu.org
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-07 16:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:6663f2a04c16288124d5ef918c661260e4f66284

commit r13-8712-g6663f2a04c16288124d5ef918c661260e4f66284
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Mon Apr 22 16:12:34 2024 +0200

    libstdc++: Fix conversion of simd to vector builtin

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

    libstdc++-v3/ChangeLog:

            PR libstdc++/114803
            * include/experimental/bits/simd_builtin.h
            (_SimdBase2::operator __vector_type_t): There is no __builtin()
            function in _SimdWrapper, instead use its conversion operator.
            * testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc: New
            test.

    (cherry picked from commit 7ef139146a8923a8719873ca3fdae175668e8d63)

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-07 16:19 ` cvs-commit at gcc dot gnu.org
@ 2024-05-08 16:15 ` cvs-commit at gcc dot gnu.org
  2024-05-10 14:07 ` cvs-commit at gcc dot gnu.org
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-08 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:0ab30fb865e6465156f7db10506b56ef2df19648

commit r12-10429-g0ab30fb865e6465156f7db10506b56ef2df19648
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Mon Apr 22 16:12:34 2024 +0200

    libstdc++: Fix conversion of simd to vector builtin

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

    libstdc++-v3/ChangeLog:

            PR libstdc++/114803
            * include/experimental/bits/simd_builtin.h
            (_SimdBase2::operator __vector_type_t): There is no __builtin()
            function in _SimdWrapper, instead use its conversion operator.
            * testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc: New
            test.

    (cherry picked from commit 7ef139146a8923a8719873ca3fdae175668e8d63)

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-08 16:15 ` cvs-commit at gcc dot gnu.org
@ 2024-05-10 14:07 ` cvs-commit at gcc dot gnu.org
  2024-05-10 14:24 ` mkretz at gcc dot gnu.org
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-10 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:9e3663ba96df1315f53b4b488f4c2e63633c7b2f

commit r11-11434-g9e3663ba96df1315f53b4b488f4c2e63633c7b2f
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Mon Apr 22 16:12:34 2024 +0200

    libstdc++: Fix conversion of simd to vector builtin

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

    libstdc++-v3/ChangeLog:

            PR libstdc++/114803
            * include/experimental/bits/simd_builtin.h
            (_SimdBase2::operator __vector_type_t): There is no __builtin()
            function in _SimdWrapper, instead use its conversion operator.
            * testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc: New
            test.

    (cherry picked from commit 7ef139146a8923a8719873ca3fdae175668e8d63)

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-05-10 14:07 ` cvs-commit at gcc dot gnu.org
@ 2024-05-10 14:24 ` mkretz at gcc dot gnu.org
  2024-05-30  8:14 ` aoliva at gcc dot gnu.org
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-05-10 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
Fixed on all branches.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-05-10 14:24 ` mkretz at gcc dot gnu.org
@ 2024-05-30  8:14 ` aoliva at gcc dot gnu.org
  2024-05-30 12:04 ` aoliva at gcc dot gnu.org
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: aoliva at gcc dot gnu.org @ 2024-05-30  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

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

--- Comment #7 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
FWIW, since the backport, this test started failing in gcc-13 on arm and
aarch64 targets.  Presumably this affects earlier branches as well.

.../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc: In
instantiation of 'void maybe_test() [with T = char]':
.../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc:87:  
required from here
.../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc:68:
error: invalid 'static_cast' from type 'V' {aka
'std::experimental::parallelism_v2::simd<char,
std::experimental::parallelism_v2::simd_abi::_VecBuiltin<16> >'} to type
'uint8x16_t'

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-05-30  8:14 ` aoliva at gcc dot gnu.org
@ 2024-05-30 12:04 ` aoliva at gcc dot gnu.org
  2024-05-31  8:47 ` mkretz at gcc dot gnu.org
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: aoliva at gcc dot gnu.org @ 2024-05-30 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
-fsigned-char works around the fail on affected targets.  I couldn't trigger it
on arm-eabi, alas, not even with -funsigned-char.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-05-30 12:04 ` aoliva at gcc dot gnu.org
@ 2024-05-31  8:47 ` mkretz at gcc dot gnu.org
  2024-05-31 10:59 ` aoliva at gcc dot gnu.org
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-05-31  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
(In reply to Alexandre Oliva from comment #7)
> FWIW, since the backport, this test started failing in gcc-13 on arm and
> aarch64 targets.  Presumably this affects earlier branches as well.
> 
> .../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc: In
> instantiation of 'void maybe_test() [with T = char]':
> .../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc:87: 
> required from here
> .../libstdc++-v3/testsuite/experimental/simd/pr114803_vecbuiltin_cvt.cc:68:
> error: invalid 'static_cast' from type 'V' {aka
> 'std::experimental::parallelism_v2::simd<char,
> std::experimental::parallelism_v2::simd_abi::_VecBuiltin<16> >'} to type
> 'uint8x16_t'

I tested on aarch64-linux-gnu and arm-linux-gnueabi before and after the
backport and there were no regressions. What target do I need to add to my
list?

The specific error you report is rather puzzling. Basically an integral, sizeof
1, not signed char, when packed into a simd<char> is not explicitly convertible
to uint8x16_t. The simd<char> is defined to be convertible to its underlying
intrinsic type which is determined in
libstdc++-v3/include/experimental/bits/simd.h and goes like this:

'char' has no full specialization for '__intrinsic_type<char, 16>' (unless
'char' is the *same* type as 'signed char' or 'unsigned char') and thus picks
the partial specialization of __intrinsic_type. This in turn determines the
corresponding signed integer type to be 'signed char'. Depending on whether
'is_unsigned_v<char>' is true, it subsequently applies 'make_unsigned_t'. It
then uses the __intrinsic_type_t of that, which is either int8x16_t or
uint8x16_t depending on 'is_unsigned_v<char>'.

This

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-05-31  8:47 ` mkretz at gcc dot gnu.org
@ 2024-05-31 10:59 ` aoliva at gcc dot gnu.org
  2024-05-31 11:45 ` aoliva at gcc dot gnu.org
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: aoliva at gcc dot gnu.org @ 2024-05-31 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
FWIW, I can trigger the problem on arm-eabi (and presumably also on
aarch64-elf, but I haven't tried that) with -D__clang__.

(our vxworks toolchains have to define that macro, for complicated reasons)

here's a reduced testcase:

arm-eabi-g++ ~/pr114803.cc -mfpu=neon -mfloat-abi=hard -O0 -std=gnu++17
-D__clang__ [-funsigned-char]

include <experimental/simd>

template <typename T>
void
test()
{
  using V = std::experimental::simd<T,
std::experimental::simd_abi::_VecBuiltin<16> >;
  if constexpr (std::is_signed_v<T>)
    static_cast<int8x16_t>(V{});
  else
    static_cast<uint8x16_t>(V{});
}

int main()
{
  test<char>();
}

pr114803.cc: In instantiation of ‘void test() [with T = char]’:
pr114803.cc:16:   required from here
pr114803.cc:11: error: invalid ‘static_cast’ from type
‘std::experimental::parallelism_v2::simd<char,
std::experimental::parallelism_v2::simd_abi::_VecBuiltin<16> >’ to type
‘uint8x16_t’

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2024-05-31 10:59 ` aoliva at gcc dot gnu.org
@ 2024-05-31 11:45 ` aoliva at gcc dot gnu.org
  2024-05-31 13:42 ` mkretz at gcc dot gnu.org
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: aoliva at gcc dot gnu.org @ 2024-05-31 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
it's the first test for __clang__ in __int_for_sizeof(), that ends up returning
char() rather than _Schar().

I guess that places the problem entirely on our need for defining __clang__ :-(

Sorry about the noise.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2024-05-31 11:45 ` aoliva at gcc dot gnu.org
@ 2024-05-31 13:42 ` mkretz at gcc dot gnu.org
  2024-05-31 14:18 ` mkretz at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-05-31 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
I noticed that weird special case for __clang__ and don't recall why it was
needed. I should dig up the reason or remove it, I guess.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2024-05-31 13:42 ` mkretz at gcc dot gnu.org
@ 2024-05-31 14:18 ` mkretz at gcc dot gnu.org
  2024-05-31 17:16 ` aoliva at gcc dot gnu.org
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ 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=114803

--- Comment #13 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
I opened PR115308 for the __clang__ issue.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2024-05-31 14:18 ` mkretz at gcc dot gnu.org
@ 2024-05-31 17:16 ` aoliva at gcc dot gnu.org
  2024-06-02 15:05 ` mkretz at gcc dot gnu.org
  2024-06-06  7:50 ` aoliva at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: aoliva at gcc dot gnu.org @ 2024-05-31 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Thanks.

The other problem the testcase in this PR evidenced was that simd_math.h and
simd_scalar.h seem to disregard _GLIBCXX_USE_C99_MATH_TR1, and on newlib-using
targets, that don't declare in math.h enough for this macro to be defined,
compiling the testcase complains about numerous such functions not being
declared in std::.

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2024-05-31 17:16 ` aoliva at gcc dot gnu.org
@ 2024-06-02 15:05 ` mkretz at gcc dot gnu.org
  2024-06-06  7:50 ` aoliva at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: mkretz at gcc dot gnu.org @ 2024-06-02 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
I don't know _GLIBCXX_USE_C99_MATH_TR1. AFAIK the simd headers are relying on
standard C++ <cmath>. But with <cmath> it's easy to make incorrect assumptions.

Other tests have a line:
// { dg-require-cmath "" }

If you add it then the test is skipped? But <experimental/simd> is still broken
- just not exposed in a test?

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

* [Bug libstdc++/114803] simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h
  2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2024-06-02 15:05 ` mkretz at gcc dot gnu.org
@ 2024-06-06  7:50 ` aoliva at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: aoliva at gcc dot gnu.org @ 2024-06-06  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
That macro is used within libstdc++ to avoid relying on C99 functions when the
target C library is not C99-compliant.  It involves leaving out C++ standard
bits that would depend on functions that the C library doesn't offer, including
some of the <cmath> declarations in ::std::.

IMHO it would make sense to omit simd functions corresponding to C99/TR1 ones
known to be missing.  Now, it's unclear to me whether we'd be better off
omitting the entire set of C99/TR1 math functions as a block, or whether
there'd be any benefit from considering individual functions separately. 
newlib, for example, exports a number of the C99/TR1 functions, but not all of
them, so the macro is not defined.

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

end of thread, other threads:[~2024-06-06  7:50 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22 12:56 [Bug libstdc++/114803] New: simd conversion to [[gnu::vector_size(N)]] type hits invalid code in experimental/bits/simd_builtin.h mkretz at gcc dot gnu.org
2024-04-22 12:58 ` [Bug libstdc++/114803] " mkretz at gcc dot gnu.org
2024-04-22 18:56 ` cvs-commit at gcc dot gnu.org
2024-04-22 18:58 ` mkretz at gcc dot gnu.org
2024-05-07 16:19 ` cvs-commit at gcc dot gnu.org
2024-05-08 16:15 ` cvs-commit at gcc dot gnu.org
2024-05-10 14:07 ` cvs-commit at gcc dot gnu.org
2024-05-10 14:24 ` mkretz at gcc dot gnu.org
2024-05-30  8:14 ` aoliva at gcc dot gnu.org
2024-05-30 12:04 ` aoliva at gcc dot gnu.org
2024-05-31  8:47 ` mkretz at gcc dot gnu.org
2024-05-31 10:59 ` aoliva at gcc dot gnu.org
2024-05-31 11:45 ` aoliva at gcc dot gnu.org
2024-05-31 13:42 ` mkretz at gcc dot gnu.org
2024-05-31 14:18 ` mkretz at gcc dot gnu.org
2024-05-31 17:16 ` aoliva at gcc dot gnu.org
2024-06-02 15:05 ` mkretz at gcc dot gnu.org
2024-06-06  7:50 ` aoliva 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).