[PATCH] libstdc++: Avoid MMX return types from __builtin_shufflevector

2024-05-15 Thread Matthias Kretz
ves a regression on i686 that was introduced with r15-429-gfb1649f8b4ad50. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/114958 * include/experimental/bits/simd.h (__as_vector): Don't use vector_size(8) on __i386__. (__vec_shuffle): Never ret

Re: [r15-429 Regression] FAIL: experimental/simd/pr109261_constexpr_simd.cc -msse2 -O2 -Wno-psabi (test for excess errors) on Linux/x86_64

2024-05-15 Thread Matthias Kretz
On Mittwoch, 15. Mai 2024 09:06:57 MESZ Matthias Kretz wrote: > On Mittwoch, 15. Mai 2024 04:20:51 MESZ Jiang, Haochen wrote: > > I am little concerned about the file size, but let me give a try if you > > can > > see the attachment. > > [...] > But now that

Re: [r15-429 Regression] FAIL: experimental/simd/pr109261_constexpr_simd.cc -msse2 -O2 -Wno-psabi (test for excess errors) on Linux/x86_64

2024-05-15 Thread Matthias Kretz
. I've tested x86_64 multilib with -m32 and even -mx32 locally and cannot find any issue.  - Matthias -- ── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Center for Heavy Ion Re

Re: [r15-429 Regression] FAIL: experimental/simd/pr109261_constexpr_simd.cc -msse2 -O2 -Wno-psabi (test for excess errors) on Linux/x86_64

2024-05-14 Thread Matthias Kretz
tor(2) wchar_t' to '_SimdWrapper' And _SimdWrapper has an implicit constructor taking one __vector(2) wchar_t argument. So I potentially need all of the context to make sense of it. - Matthias -- ── Dr. Ma

Re: [r15-429 Regression] FAIL: experimental/simd/pr109261_constexpr_simd.cc -msse2 -O2 -Wno-psabi (test for excess errors) on Linux/x86_64

2024-05-14 Thread Matthias Kretz
On Montag, 13. Mai 2024 18:55:13 MESZ haochen. jiang wrote: > On Linux/x86_64, > > fb1649f8b4ad5043dd0e65e4e3a643a0ced018a9 is the first bad commit > commit fb1649f8b4ad5043dd0e65e4e3a643a0ced018a9 > Author: Matthias Kretz > Date: Mon May 6 12:13:55 2024 +0200 >

[PATCH] libstdc++: Use __builtin_shufflevector for simd split and concat

2024-05-07 Thread Matthias Kretz
Tested on x86_64-linux-gnu and aarch64-linux-gnu and with Clang 18 on x86_64- linux-gnu. OK for trunk and backport(s)? -- 8< Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/114958 * include/experimental/b

[PATCH] libstdc++: Fix conversion of simd to vector builtin

2024-04-22 Thread Matthias Kretz
Tested on x86_64-linux-gnu, powerpc64le-linux-gnu, aarch64-linux-gnu, arm- linux-gnueabihf OK for trunk and backports? - 8< - Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/114803 * incl

[PATCH] libstdc++: Silence irrelevant warnings in

2024-04-22 Thread Matthias Kretz
ing a dependency on a template parameter) Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h: Ignore -Wnarrowing for arm_neon.h. (__int_for_sizeof): Replace tautological compare with checking for invalid template parameter va

[PATCH] libstdc++: Add include guard to simd-internal header

2024-04-17 Thread Matthias Kretz
This never showed up as an issue because it's an internal header and implicitly guarded by bits/simd.h. OK for trunk? Any reason to backport? - 8< -- Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/b

[PATCH] libstdc++: Avoid ill-formed types on ARM

2024-04-17 Thread Matthias Kretz
Tested on arm-linux-gnueabihf, powerpc64le-linux-gnu, and aarch64-linux-gnu. OK for trunk and backports? - 8< -- This resolves failing tests in check-simd. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/114

Re: [PATCH] libstdc++: add ARM SVE support to std::experimental::simd

2024-03-28 Thread Matthias Kretz
On Mittwoch, 27. März 2024 14:34:52 CET Richard Sandiford wrote: > Matthias Kretz writes: > > The big issue here is that, IIUC, a user (and the simd library) cannot do > > the right thing at the moment. There simply isn't enough context > > information available when par

Re: [PATCH v2] libstdc++: add ARM SVE support to std::experimental::simd

2024-03-27 Thread Matthias Kretz
tached. -- ── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Center for Heavy Ion Research https://gsi.de std::simd ── commit 9ac3119fec81fb64d11dee8f853145f937389366

[PATCH] libstdc++: Add masked ++/-- implementation for sizeof < 16

2024-03-27 Thread Matthias Kretz
And one more to fix follow-up / remaining failures. Tested on x86_64-linux- gnu. OK for trunk and 13? 8< -- This resolves further failures (-Wreturn-type warnings) and test failures for where-* tests targeting AVX-512. Signed-off-by: Matthias Kretz libstdc++

Re: [PATCH] libstdc++: add ARM SVE support to std::experimental::simd

2024-03-27 Thread Matthias Kretz
gt; I believe the same is true for A64FX. That's good to know.  > FWIW, GCC has already started using SVE in this way. E.g. SVE provides > a wider range of immediate constants for logic operations, so we now use > them for Advanced SIMD logic where beneficial. I will consider these optimiz

Re: [PATCH v2] libstdc++: add ARM SVE support to std::experimental::simd

2024-03-27 Thread Matthias Kretz
he spec and implementation is to gather experience. Best, Matthias -- ────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz

[PATCH] libstdc++: Fix call signature of builtins from masked ++/--

2024-03-27 Thread Matthias Kretz
le changed, 9 insertions(+), 3 deletions(-) -- ────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.d

Re: [PATCH v2] libstdc++: add ARM SVE support to std::experimental::simd

2024-03-08 Thread Matthias Kretz
Hi, I applied and did extended testing on x86_64 (no regressions) and aarch64 using qemu testing SVE 256, 512, and 1024. Looks good! While going through the applied patch I noticed a few style issues that I simply turned into a patch (attached). A few comments inline. Sorry for not seeing

Re: [PATCH] libstdc++: add ARM SVE support to std::experimental::simd

2024-01-18 Thread Matthias Kretz
On Thursday, 18 January 2024 08:40:48 CET Andrew Pinski wrote: > On Wed, Jan 17, 2024 at 11:28 PM Matthias Kretz wrote: > > template > > struct Point > > { > > T x, y, z; > > > > T distance_to_origin() { > > return sqrt(x * x + y * y +

Re: [PATCH] libstdc++: add ARM SVE support to std::experimental::simd

2024-01-17 Thread Matthias Kretz
rom a NEON register to an SVE register and back (which each requires a store-load, IIUC). So are you thinking of implementing everything via SVE? That would break ABI, no? - Matthias -- ── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Center for Heavy Ion Research https://gsi.de std::simd ──

Re: [PATCH] libstdc++: add ARM SVE support to std::experimental::simd

2024-01-17 Thread Matthias Kretz
re > and being meanful in any way. I'd love to. In the same way I'd love to *not depend* on __AVX__, __AVX512F__ etc. - Matthias -- ────── Dr. Matthias Kretz https://mattkretz.github.

Re: libstdc++: Speed up push_back

2023-11-23 Thread Matthias Kretz
f() { std::vector x; x.reserve(10); for (int i = 0; i < 10; ++i) x.push_back(0); return x; } auto g() { return std::vector(10, 0); } -- ────── Dr. Matthias Kretz https://mattkretz.github

Re: [RFC] GNU Vector Extension -- Packed Boolean Vectors

2023-10-05 Thread Matthias Kretz
. -Matthias -- ── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Center for Heavy Ion Research https://gsi.de std::simd ──

[PATCH] libstdc++: Rewrite or avoid casts to 64-bit element types

2023-06-06 Thread Matthias Kretz via Gcc-patches
WER targets. Replace __extract_part implementation (which was the only user of __shift_elements_right) by relying on __builtin_shufflevector (not available in GCC 11). This removes another cast to 64-bit element type, which breaks on non-VSX POWER. Signed-off-by: Matthias Kretz libstdc++-v3/Change

[PATCH] libstdc++: Avoid vector casts while still avoiding PR90424

2023-06-06 Thread Matthias Kretz via Gcc-patches
ned-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/109822 * include/experimental/bits/simd_builtin.h (_S_store): Rewrite to avoid casts to other vector types. Implement store as succession of power-of-2 sized memcpy to avoid PR90424. --- .../incl

[PATCH] libstdc++: Replace use of incorrect non-temporal store

2023-06-06 Thread Matthias Kretz via Gcc-patches
ent ABI tag's _SimdImpl. This also reduces the number of possible template instantiations. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/110054 * include/experimental/bits/simd_builtin.h (_S_masked_store): Call into deduced ABI's SimdImpl aft

[committed] libstdc++: Protect against macros

2023-06-06 Thread Matthias Kretz via Gcc-patches
pushed to trunk, will backport later tested on x86_64-pc-linux-gnu --- >8 Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h (__bit_cast): Use __gnu__::__vector_size__ instead of gnu::vector_size. --- libstdc++-v3/incl

Re: [PATCH] libstdc++: Correct NTTP and simd_mask ctor call

2023-06-02 Thread Matthias Kretz via Gcc-patches
acros reasonably expect to find them. Is > this known? Should I file a PR about it? I had/have no idea. Is rtems6 using the "freestanding" subset of C++? In which case simd shouldn't be there at all. Otherwise should work, no? - Matthias -- ──

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Matthias Kretz via Gcc-patches
me codes have become dependent on the existing (under-specified) behavior. 路 - Matthias -- ── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de stdₓ::simd ──

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Matthias Kretz via Gcc-patches
ntation of the shift operator depends on the current behavior, even if it is target-dependent. For PPC the simd implementation adds extra code to avoid the "UB". With nailing down shifts > sizeof(T) as UB this extra code now needs to be added for all targets. - Matthias -

Re: [PATCH] libstdc++: Correct NTTP and simd_mask ctor call

2023-06-02 Thread Matthias Kretz via Gcc-patches
Hello Alexandre, On Friday, 2 June 2023 10:32:40 CEST Alexandre Oliva wrote: > On May 26, 2023, Matthias Kretz via Libstdc++ wrote: > > OK for master and all backports (after 11.4 is done)? > > tested on powerpc64le-linux-gnu and x86_64-pc-linux-gnu > > > > *

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Matthias Kretz via Gcc-patches
Revised patch below. This can be considered a breaking change. Does it need a mention in the release notes? - Matthias -- ────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de stdₓ::simd ──

[committed] libstdc++: Fix condition for supported SIMD types on ARMv8

2023-06-01 Thread Matthias Kretz via Gcc-patches
pushed to trunk, will backport tested on arm-linux-gnueabihf -- 8< -- Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/110050 * include/experimental/bits/simd.h (__vectorized_sizeof): With __have_neon_a32 only single-precision fl

[PATCH] libstdc++: Correct NTTP and simd_mask ctor call

2023-05-26 Thread Matthias Kretz via Gcc-patches
OK for master and all backports (after 11.4 is done)? tested on powerpc64le-linux-gnu and x86_64-pc-linux-gnu --- 8< Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/109822 * include/experimental/bits/simd.h (to_native): Use int N

[PATCH] libstdc++: Simplify calculation of expected value in simd test

2023-05-26 Thread Matthias Kretz via Gcc-patches
OK for master and all backports (after 11.4 is done)? tested on powerpc64le-linux-gnu --- 8< This avoids a failure on PR109964. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/tests/integer_operators.cc: Comp

[PATCH] libstdc++: Fix test assumptions on long and long double

2023-05-26 Thread Matthias Kretz via Gcc-patches
OK for master and all backports (after 11.4 is done) tested on powerpc64le-linux-gnu (with 64-bit long double) --- 8< Expect that long might not fit into the long double mantissa bits. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsu

[committed] libstdc++: Resolve -Wsign-compare issue

2023-05-26 Thread Matthias Kretz via Gcc-patches
pushed to master, will backport later tested on x86_64-pc-linux-gnu and powerpc64le-linux-gnu --- 8< Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_ppc.h (_S_bit_shift_left): Negative __y is UB, so prefer sig

[PATCH] libstdc++: Fix type of first argument to vec_cntm call

2023-05-24 Thread Matthias Kretz via Gcc-patches
OK for master and backports? (also a long-standing bug that didn't surface until the new constexpr test was added) tested on powerpc64le-linux-gnu - 8< - Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/109949 * incl

[PATCH] libstdc++: Fix SFINAE for __is_intrinsic_type on ARM

2023-05-24 Thread Matthias Kretz via Gcc-patches
OK for master and all branches? (this issue only surfaced because of the new test) 8< - On ARM NEON doesn't support double, so __is_intrinsic_type_v should say false (instead of being ill-formed). Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog:

[PATCH] libstdc++: Add missing constexpr to simd_neon

2023-05-23 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/109261 * include/experimental/bits/simd_neon.h (_S_reduce): Add constexpr and make NEON implementation conditional on not __builtin_is_constant_evaluated. --- .../include/experimental/bits

[committed] Re: [PATCH] libstdc++: Add missing constexpr to simd

2023-05-23 Thread Matthias Kretz via Gcc-patches
I pushed the attached patch. I kept the operator names... too late, there were already operator names in the stdx::simd implemenation anyway. ;) - Matthias On Monday, 22 May 2023 22:51:49 CEST Jonathan Wakely wrote: > On Mon, 22 May 2023 at 21:27, Matthias Kretz wrote: > > On Monda

Re: [PATCH] libstdc++: Add missing constexpr to simd

2023-05-22 Thread Matthias Kretz via Gcc-patches
; copy? Right, copy Should I simply remove the complete header? - Matthias -- ── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de stdₓ::simd ──

[PATCH] libstdc++: Add missing constexpr to simd

2023-05-22 Thread Matthias Kretz via Gcc-patches
expressions. Issues why constant_evaluated branches are necessary: * subscripting vector builtins is not allowed in constant expressions * if the implementation needs/uses memcpy * if the implementation would otherwise call SIMD intrinsics/builtins Signed-off-by: Matthias Kretz libstdc++-v3

[committed] libstdc++: Resolve -Wunused-variable warnings in stdx::simd and tests

2023-05-22 Thread Matthias Kretz via Gcc-patches
pushed to master, will backport later regtested on x86_64-linux Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_builtin.h (_S_fpclassify): Move __infn into #ifdef'ed block. * testsuite/experimental/simd/tests/fpclassify.cc

[committed] libstdc++: Fix operator% implementation for Clang

2023-03-28 Thread Matthias Kretz via Gcc-patches
This resolves a regression of my previous fix where Clang would ICE on _S_divides. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_x86.h (_SimdImplX86): Use _Base::_S_divides if the optimized _S_divides function is hidden via

[PATCH] libstdc++: Add missing trait is_simd_flag_type

2023-03-28 Thread Matthias Kretz via Gcc-patches
I don't know how, but I forgot to implement the is_simd_flag_type trait. This fixes it. No new check-simd failures on x86_64-pc-linux-gnu --- 8< -- Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h (is_simd_flag_t

[PATCH] libstdc++: Use more precise __RECIPROCAL_MATH__ macro

2023-03-21 Thread Matthias Kretz via Gcc-patches
Tested on x86_64-pc-linux-gnu. - 8< --- Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_x86.h (_SimdImplX86::_S_divides): Replace test for __GCC_IEC_559 == 0 with __RECIPROCAL_MATH__. --- libstdc++-v3/incl

[PATCH] libstdc++: Skip integer division optimization for Clang

2023-03-21 Thread Matthias Kretz via Gcc-patches
Tested on x86_64-pc-linux-gnu. - 8< --- Clang ICEs on _SimdImplX86::_S_divides. The function is only working around a missed optimization and not necessary for correctness. Therefore, don't use it for Clang. Signed-off-by: Matthias Kretz libstdc++-v3/Change

[committed] libstdc++: Fix simd compilation with Clang

2023-03-21 Thread Matthias Kretz via Gcc-patches
do not exist on Clang. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_detail.h: Don't declare the simd API as constexpr with Clang. * include/experimental/bits/simd_x86.h (__movm): New. (_S_blend_avx512): Resolve FI

[PATCH 2/2] libstdc++: Fix simd compilation with Clang

2023-03-21 Thread Matthias Kretz via Gcc-patches
to vector-mask before using a vector blend ?:. A similar change is required for the masked unary implementation, because the GCC builtins do not exist on Clang. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_detail.h: Don't declare

[PATCH 1/2] libstdc++: Fix simd test compilation with Clang

2023-03-21 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/tests/operators.cc: Clang doesn't define __GCC_IEC_559. Use __STDC_IEC_559__ instead. --- .../testsuite/experimental/simd/tests/operators.cc | 9 - 1 file changed, 8 insertions

[PATCH 0/2] Make std::experimental::simd (more) usable with Clang

2023-03-21 Thread Matthias Kretz via Gcc-patches
Up to now, compiling std::experimental::simd with Clang would lead to wrong code, not compiling, or ICEs. After these patches I hope it's only ICEs. Tested on x86_64-pc-linux-gnu. Matthias Kretz (2): libstdc++: Fix simd test compilation with Clang libstdc++: Fix simd compilation with Clang

Re: [PATCH 6/8] libstdc++: Fix formatting

2023-02-24 Thread Matthias Kretz via Gcc-patches
r patches to trunk that came before this one. -- ────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de stdₓ::simd ──

Re: [PATCH 4/8] libstdc++: Add missing constexpr on simd shift implementation

2023-02-23 Thread Matthias Kretz via Gcc-patches
On Thursday, 23 February 2023 12:07:11 CET Jonathan Wakely wrote: > On Thu, 23 Feb 2023 at 08:55, Matthias Kretz via Libstdc++ > > wrote: > > Resolves -Wtautological-compare warnings about `if > > (__builtin_is_constant_evaluated())` in the implementations o

[PATCH 0/8] std::experimental::simd patchset

2023-02-23 Thread Matthias Kretz via Gcc-patches
Tested on x86_64-pc-linux. This patchset provides the final changes for PR108030 and resolves PR108856. The latter is a pure optimization and could wait for Stage 1 (I'm submitting the patch because simd is experimental/TS) Matthias Kretz (8): libstdc++: Simplify three helper functions

[PATCH 1/8] libstdc++: Simplify three helper functions into one

2023-02-23 Thread Matthias Kretz via Gcc-patches
Broadcast is a very common function. This should reduce compile-time effort. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/108030 * include/experimental/bits/simd.h (__vector_broadcast): Implement via __vector_broadcast_impl instead

[PATCH 3/8] libstdc++: More efficient masked inc-/decrement implementation

2023-02-23 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/108856 * include/experimental/bits/simd_builtin.h (_SimdImplBuiltin::_S_masked_unary): More efficient implementation of masked inc-/decrement for integers and floats without AVX2

[PATCH 5/8] libstdc++: Always-inline most of non-cmath fixed_size implementation

2023-02-23 Thread Matthias Kretz via Gcc-patches
For simd, the inlining behavior should be similar to builtin types. (No operator on buitin types is ever translated into a function call.) Therefore, always_inline is the right choice (i.e. inline on -O0 as well). Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc

[PATCH 2/8] libstdc++: Fix simd build failure on clang

2023-02-23 Thread Matthias Kretz via Gcc-patches
Clang does not support __attribute__ on lambdas. Therefore, only set _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA if __clang__ is not defined. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/108030 * include/experimental/bits/simd_detail.h

[PATCH 7/8] libstdc++: Fix -Wsign-compare issue

2023-02-23 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_builtin.h (_S_set): Compare as int. The actual range of these indexes is very small. --- libstdc++-v3/include/experimental/bits/simd_builtin.h | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 6/8] libstdc++: Fix formatting

2023-02-23 Thread Matthias Kretz via Gcc-patches
Whitespace changes only. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h: Line breaks and indenting fixed to follow the libstdc++ standard. * include/experimental/bits/simd_builtin.h: Likewise. * include/experimental

[PATCH 4/8] libstdc++: Add missing constexpr on simd shift implementation

2023-02-23 Thread Matthias Kretz via Gcc-patches
Resolves -Wtautological-compare warnings about `if (__builtin_is_constant_evaluated())` in the implementations of these functions. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_x86.h (_S_bit_shift_left) (_S_bit_shift_right): Declare

[PATCH 8/8] libstdc++: Test that integral simd reductions are precise

2023-02-23 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/tests/reductions.cc: Introduce max_distance as the type-dependent max error. --- libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc | 3 ++- 1 file changed, 2 insertions(+), 1

[committed] libstdc++: Fix uses of non-reserved names in simd header

2023-02-20 Thread Matthias Kretz via Gcc-patches
Tested x86_64-pc-linux. Pushed to trunk. -- >8 -- Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h (__extract_part, split): Use reserved name for template parameter. --- libstdc++-v3/include/experimental/bits/simd.h |

[PATCH 6/7] libstdc++: Fix incorrect __builtin_is_constant_evaluated calls

2023-02-15 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_x86.h (_SimdImplX86::_S_not_equal_to, _SimdImplX86::_S_less) (_SimdImplX86::_S_less_equal): Do not call __builtin_is_constant_evaluated in constexpr-if. --- .../include

[PATCH 4/7] libstdc++: Use a PCH to speed up check-simd

2023-02-15 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/generate_makefile.sh: Generate and pre-compile pch.h, which includes all headers that do not depend on command-line macros. * testsuite/experimental/simd/tests/bits/conversions.h

[PATCH 5/7] libstdc++: printf format string fix in testsuite

2023-02-15 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/tests/bits/verify.h (verify::verify): Use %zx for size_t in format string. --- libstdc++-v3/testsuite/experimental/simd/tests/bits/verify.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 2/7] libstdc++: Annotate most lambdas with always_inline

2023-02-15 Thread Matthias Kretz via Gcc-patches
All of the annotated lambdas are simply a necessary means for implementing these functions and should never result in an actual function call. Many of these lambdas would go away if C++ had better language support for packs. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR

[PATCH 7/7] libstdc++: Fix incorrect function call in -ffast-math optimization

2023-02-15 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_math.h (__hypot): Bitcasting between scalars requires the __bit_cast helper function instead of simd_bit_cast. --- libstdc++-v3/include/experimental/bits/simd_math.h | 4 ++-- 1

[PATCH 3/7] libstdc++: Document timeout and timeout-factor of simd tests

2023-02-15 Thread Matthias Kretz via Gcc-patches
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/README.md: Document the timeout and timeout-factor directives. Minor typo fixed. --- libstdc++-v3/testsuite/experimental/simd/README.md | 10 -- 1 file changed, 8 insertions(+), 2

[PATCH 1/7] libstdc++: Ensure __builtin_constant_p isn't lost on the way

2023-02-15 Thread Matthias Kretz via Gcc-patches
The more expensive code path should only be taken if it can be optimized away. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h (_SimdWrapper::_M_is_constprop_none_of) (_SimdWrapper::_M_is_constprop_all_of): Return false unless

[PATCH 0/7] Work on PR108030 and several simd bugfixes and testsuite improvements

2023-02-15 Thread Matthias Kretz via Gcc-patches
and implemented the use of PCH to speed up the test suite. Matthias Kretz (7): libstdc++: Ensure __builtin_constant_p isn't lost on the way libstdc++: Annotate most lambdas with always_inline libstdc++: Document timeout and timeout-factor of simd tests libstdc++: Use a PCH to speed up check-simd

Re: [PATCH] libstdc++: ppc: conditionalize vsx-only simd intrinsics

2022-04-29 Thread Matthias Kretz via Gcc-patches
r mail. If `__vector double` without VSX was always ill-formed then I must be misremembering something. Cheers, Matthias -- ── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz

Re: [PATCH] libstdc++: ppc: conditionalize vsx-only simd intrinsics

2022-04-28 Thread Matthias Kretz via Gcc-patches
w/o VSX"); The missing condition here was an incorrect omission. With -mlong-double-64 and without VSX no assertion caught the issue. IIRC, a user won't get to see this error message unless there's a bug in the simd library implementation, so the error message is good enough for

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-04-01 Thread Matthias Kretz via Gcc-patches
On Friday, 1 April 2022 13:33:42 CEST Jonathan Wakely wrote: > Matthias didn't like my Princess Bride easter egg :-) > Would the attached be better? LGTM. -- ── Dr. Matthias Kretz

Re: [PATCH] libstdc++: Implement std::unreachable() for C++23 (P0627R6)

2022-03-31 Thread Matthias Kretz via Gcc-patches
defined _GLIBCXX_ASSERTIONS > +__builtin_trap(); > +#else > +__builtin_unreachable(); > +#endif > + } -- ── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de stdₓ::simd ──

Re: [PATCH] libstdc++: Fix for non-constexpr math_errhandling

2022-01-19 Thread Matthias Kretz
On Wednesday, 19 January 2022 16:21:15 CET Jonathan Wakely wrote: > On Wed, 19 Jan 2022, 12:45 Matthias Kretz, wrote: > > On Wednesday, 19 January 2022 13:07:26 CET Jonathan Wakely wrote: > > > So is it a macro or not? > > > > I agree the quote I used is u

Re: [PATCH] libstdc++: Fix for non-constexpr math_errhandling

2022-01-19 Thread Matthias Kretz
On Wednesday, 19 January 2022 13:07:26 CET Jonathan Wakely wrote: > On Wed, 19 Jan 2022 at 08:10, Matthias Kretz wrote: > > Follow-up to my last patch. This one is a more thorough fix. Tested on > > x86_64- > > linux. OK for trunk? > > > > 8<

[PATCH] libstdc++: Fix for non-constexpr math_errhandling

2022-01-19 Thread Matthias Kretz
Follow-up to my last patch. This one is a more thorough fix. Tested on x86_64- linux. OK for trunk? 8< Use SFINAE magic to support: "It is unspecified whether math_errhandling is a macro or an identifier with external linkage." [C Standard] Signed-off-by: Matthias Kretz

[PATCH] libstdc++: Don't fail if math_errhandling is not defined

2022-01-17 Thread Matthias Kretz
Tested on x86_64-linux and powerpc64le-linux. This fixes the powerpc64le-linux failure Jonathan reported. OK for trunk? Older glibc does not define math_errhandling with -ffast-math, in which case floating-point exceptions are not used. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog

[PATCH] c++: don't ICE on NAMESPACE_DECL inside FUNCTION_DECL

2021-12-15 Thread Matthias Kretz
on NAMESPACE_DECL and therefore must be handled first in the assertion. Signed-off-by: Matthias Kretz gcc/cp/ChangeLog: * module.cc (trees_out::get_merge_kind): NAMESPACE_DECLs also cannot have a DECL_TEMPLATE_INFO. --- gcc/cp/module.cc | 5 +++-- 1 file changed, 3 insertions(+), 2

Re: [PATCH] Fix hash_map::traverse overload

2021-12-07 Thread Matthias Kretz
On Tuesday, 7 December 2021 08:43:56 CET Richard Biener wrote: > On Mon, Dec 6, 2021 at 11:47 AM Matthias Kretz wrote: > > While reading the hash_map code I noticed this inconsistency. Bootstrapped > > and regtested on x86_64. OK for trunk? > > I've inspected two u

Re: [PATCH] Fix hash_map::traverse overload

2021-12-07 Thread Matthias Kretz
On Tuesday, 7 December 2021 08:47:56 CET Richard Biener wrote: > On Tue, Dec 7, 2021 at 8:43 AM Richard Biener > wrote: > > > > > > > On Mon, Dec 6, 2021 at 11:47 AM Matthias Kretz wrote: > > > > > > > > > > > While reading the ha

[PATCH] Fix hash_map::traverse overload

2021-12-06 Thread Matthias Kretz
While reading the hash_map code I noticed this inconsistency. Bootstrapped and regtested on x86_64. OK for trunk? The hash_map::traverse overload taking a non-const Value pointer breaks if the callback returns false. The other overload should behave the same. Signed-off-by: Matthias Kretz

Re: [PATCH v2 1/2] c++: Print function template parms when relevant

2021-12-02 Thread Matthias Kretz
On Friday, 26 November 2021 16:23:43 CET Matthias Kretz wrote: > > Hmm, since it walks DECL_TEMPLATE_RESULT, I wouldn't expect it to find > > template parms that aren't in the function signature. > > You were right, walking TREE_TYPE (DECL_TEMPLATE_RESULT (t))

[PATCH 2/2] c++: Print function template parms when relevant [part 2]

2021-11-26 Thread Matthias Kretz
Restore status-quo how function template specializations were diagnosed. Signed-off-by: Matthias Kretz gcc/testsuite/ChangeLog: * g++.dg/diagnostic/default-template-args-1.C: Adjust for different presentation of function template specializations. * g++.dg/ext/pretty1

[PATCH 1/2] c++: Print function template parms when relevant

2021-11-26 Thread Matthias Kretz
-off-by: Matthias Kretz gcc/testsuite/ChangeLog: * g++.dg/debug/dwarf2/template-params-12n.C: Optionally, allow DW_AT_default_value. * g++.dg/diagnostic/default-template-args-1.C: New test. * g++.dg/diagnostic/default-template-args-2.C: New test. * g++.dg

[PATCH 0/2] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-26 Thread Matthias Kretz
On Friday, 19 November 2021 23:26:57 CET Jason Merrill wrote: > On 11/19/21 04:53, Matthias Kretz wrote: > > On Thursday, 18 November 2021 20:24:36 CET Jason Merrill wrote: > >> On 11/17/21 17:51, Matthias Kretz wrote: > >>>>> __FUNCTION__ was 'fun' a

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-19 Thread Matthias Kretz
On Friday, 19 November 2021 23:26:57 CET Jason Merrill wrote: > On 11/19/21 04:53, Matthias Kretz wrote: > > My motivation for printing a function template specialization differently > > is: > > > > 1. It's a different function definition that's being called.

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-19 Thread Matthias Kretz
On Friday, 19 November 2021 10:53:27 CET Matthias Kretz wrote: > > >> Ah, you're trying to omit defaulted parms from the ? I'm not > > >> sure > > >> that's necessary, leaving them out of the [with ...] list should be > > >> sufficient. > &g

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-19 Thread Matthias Kretz
On Thursday, 18 November 2021 20:24:36 CET Jason Merrill wrote: > On 11/17/21 17:51, Matthias Kretz wrote: > > Right, I had already added a `gcc_assert (!TMPL_ARGS_HAVE_MULTIPLE_LEVELS > > (args))` to my new set_non_default_template_args_count function and found > > c

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-17 Thread Matthias Kretz
On Wednesday, 17 November 2021 19:25:46 CET Jason Merrill wrote: > On 11/17/21 04:04, Matthias Kretz wrote: > > On Wednesday, 17 November 2021 07:09:18 CET Jason Merrill wrote: > >>> - if (CHECKING_P) > >>> -SET_NON_DEFAULT_TEMPLA

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-17 Thread Matthias Kretz
of whether they were explicitly given or not. > > + 5. either > > + - t is a member friend template of a template class (see > > DECL_TI_TEMPLATE +documentation), or > > + - > > Missing the last item. :) Oh, I got distracted while trying to figure this

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-16 Thread Matthias Kretz
On Tuesday, 16 November 2021 21:49:31 CET Jason Merrill wrote: > On 11/16/21 15:42, Matthias Kretz wrote: > > On Tuesday, 16 November 2021 21:25:33 CET Jason Merrill wrote: > >> On 11/8/21 15:00, Matthias Kretz wrote: > >>> I forgot to mention why I tagged i

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-16 Thread Matthias Kretz
On Tuesday, 16 November 2021 21:25:33 CET Jason Merrill wrote: > On 11/8/21 15:00, Matthias Kretz wrote: > > I forgot to mention why I tagged it [RFC]: I needed one more bit of > > information on the template args TREE_VEC to encode > > EXPLICIT_TEMPLATE_ARGS_P. Its TREE

[PATCH 2/2] libstdc++: Use diagnose_as attribute to improve simd diagnostics

2021-11-15 Thread Matthias Kretz
Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h: Diagnose 'std::experimental::parallelism_v2::simd_abi' as 'simd_abi'. On x86, diagnose _VecBuiltin<16>, _VecBuiltin<32>, and _VecBltnBtmsk<64>

[PATCH 1/2] libstdc++: Use diagnose_as attribute to improve string diagnostics

2021-11-15 Thread Matthias Kretz
This hides the basic_string template in all diagnostics, reducing the signal-to-noise ratio significantly. It also hides the std::__cxx11 namespace from users by presenting it as std. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR c++/89370 * include/bits/c++config

[PATCH 0/2] Make use of the diagnose_as attribute to improve libstdc++ diagnostics

2021-11-15 Thread Matthias Kretz
After my two C++ patches for template diagnostics and the diagnose_as attribute are in, I'd like to make use of the attribute for std::*string and std::pmr::*string as well as for std::experimental::simd diagnostics. Matthias Kretz (2): libstdc++: Use diagnose_as attribute to improve string

Re: [PATCH 11/11] libstdc++: Fix ODR issues with different -m flags

2021-11-15 Thread Matthias Kretz
ping. OK to push? On Tuesday, 8 June 2021 14:12:23 CET Matthias Kretz wrote: > From: Matthias Kretz > > Explicitly support use of the stdx::simd implementation in situations > where the user links TUs that were compiled with different -m flags. In > general, this is alway

[PATCH v5] c++: Add gnu::diagnose_as attribute

2021-11-14 Thread Matthias Kretz
wrote: > On 7/23/21 4:58 AM, Matthias Kretz wrote: > > gcc/cp/ChangeLog: > > PR c++/89370 > > * cp-tree.h: Add is_alias_template_p declaration. > > * decl2.c (is_alias_template_p): New function. Determines > > wheth

[PATCH v3] c-family: Add __builtin_assoc_barrier

2021-11-11 Thread Matthias Kretz
On Wednesday, 8 September 2021 15:49:27 CET Matthias Kretz wrote: > On Wednesday, 8 September 2021 15:44:28 CEST Jason Merrill wrote: > > On 9/8/21 5:37 AM, Matthias Kretz wrote: > > > On Tuesday, 7 September 2021 19:36:22 CEST Jason Merrill wrote: > > >>> case

  1   2   3   >