libstdc++: Add std::experimental::simd from the Parallelism TS 2
authorMatthias Kretz <kretz@kde.org>
Thu, 21 Jan 2021 11:45:15 +0000 (11:45 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 27 Jan 2021 16:37:26 +0000 (16:37 +0000)
commit2bcceb6fc59fcdaf51006d4fcfc71c2d26761396
tree5eb5d4554985a44e2cc30a4284e432990b61cf97
parentc91db798ec65b3e55f2380ca1530ecb71544f1bb
libstdc++: Add std::experimental::simd from the Parallelism TS 2

Adds <experimental/simd>.

This implements the simd and simd_mask class templates via
[[gnu::vector_size(N)]] data members. It implements overloads for all of
<cmath> for simd. Explicit vectorization of the <cmath> functions is not
finished.

The majority of functions are marked as [[gnu::always_inline]] to enable
quasi-ODR-conforming linking of TUs with different -m flags.
Performance optimization was done for x86_64.  ARM, Aarch64, and POWER
rely on the compiler to recognize reduction, conversion, and shuffle
patterns.

Besides verification using many different machine flages, the code was
also verified with different fast-math flags.

libstdc++-v3/ChangeLog:

* doc/xml/manual/status_cxx2017.xml: Add implementation status
of the Parallelism TS 2. Document implementation-defined types
and behavior.
* include/Makefile.am: Add new headers.
* include/Makefile.in: Regenerate.
* include/experimental/simd: New file. New header for
Parallelism TS 2.
* include/experimental/bits/numeric_traits.h: New file.
Implementation of P1841R1 using internal naming. Addition of
missing IEC559 functionality query.
* include/experimental/bits/simd.h: New file. Definition of the
public simd interfaces and general implementation helpers.
* include/experimental/bits/simd_builtin.h: New file.
Implementation of the _VecBuiltin simd_abi.
* include/experimental/bits/simd_converter.h: New file. Generic
simd conversions.
* include/experimental/bits/simd_detail.h: New file. Internal
macros for the simd implementation.
* include/experimental/bits/simd_fixed_size.h: New file. Simd
fixed_size ABI specific implementations.
* include/experimental/bits/simd_math.h: New file. Math
overloads for simd.
* include/experimental/bits/simd_neon.h: New file. Simd NEON
specific implementations.
* include/experimental/bits/simd_ppc.h: New file. Implement bit
shifts to avoid invalid results for integral types smaller than
int.
* include/experimental/bits/simd_scalar.h: New file. Simd scalar
ABI specific implementations.
* include/experimental/bits/simd_x86.h: New file. Simd x86
specific implementations.
* include/experimental/bits/simd_x86_conversions.h: New file.
x86 specific conversion optimizations. The conversion patterns
work around missing conversion patterns in the compiler and
should be removed as soon as PR85048 is resolved.
* testsuite/experimental/simd/standard_abi_usable.cc: New file.
Test that all (not all fixed_size<N>, though) standard simd and
simd_mask types are usable.
* testsuite/experimental/simd/standard_abi_usable_2.cc: New
file. As above but with -ffast-math.
* testsuite/libstdc++-dg/conformance.exp: Don't build simd tests
from the standard test loop. Instead use
check_vect_support_and_set_flags to build simd tests with the
relevant machine flags.
19 files changed:
libstdc++-v3/doc/xml/manual/status_cxx2017.xml
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/experimental/bits/numeric_traits.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_builtin.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_converter.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_detail.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_fixed_size.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_math.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_neon.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_ppc.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_scalar.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_x86.h [new file with mode: 0644]
libstdc++-v3/include/experimental/bits/simd_x86_conversions.h [new file with mode: 0644]
libstdc++-v3/include/experimental/simd [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/simd/standard_abi_usable.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/simd/standard_abi_usable_2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/libstdc++-dg/conformance.exp