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

Matthias Kretz m.kretz@gsi.de
Tue Jun 6 14:13:52 GMT 2023


Last part to resolve test failure introduced with PR109822.

OK for master and backports (gcc-11 doesn't have __builtin_shufflevector, 
though)?

Tested on x86_64-pc-linux-gnu and powerpc64le-linux-gnu

----- >8 -----

Fix SFINAE on __is_intrinsic_type for 64-bit element types on non-VSX
POWER 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 <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	PR libstdc++/109822
	* include/experimental/bits/simd.h: Include <bits/stl_algo.h>
	for min(initializer_list).
	Define __intrinsic_type_impl for all vectorizable types, but
	without type member, if the target doesn't support it.
	* include/experimental/bits/simd_builtin.h (__idx_permute): New.
	(__shift_elements_right): Removed.
	(__extract_part): Rewrite using __idx_permute.
	(_S_reduce): Avoid unconditional cast to 64-bit element type
	when the element type is known to be smaller.
---
 libstdc++-v3/include/experimental/bits/simd.h |  34 ++-
 .../include/experimental/bits/simd_builtin.h  | 250 +++++-------------
 2 files changed, 96 insertions(+), 188 deletions(-)


--
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
 stdₓ::simd
──────────────────────────────────────────────────────────────────────────
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libstdc-Rewrite-or-avoid-casts-to-64-bit-element-typ.patch
Type: text/x-patch
Size: 13840 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20230606/51918c32/attachment.bin>


More information about the Libstdc++ mailing list