libstc++: Implement hmin and hmax
authorMatthias Kretz <kretz@kde.org>
Wed, 3 Feb 2021 15:49:30 +0000 (15:49 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 3 Feb 2021 15:49:30 +0000 (15:49 +0000)
commit4b940ccee19496d8f494b7ad0b850f08c177d5bf
treeac685840bdb79eb56722242d0abf0b4a62d2b828
parentaf60e4bd4b69f39173a8347aa2dcdaa40227ec67
libstc++: Implement hmin and hmax

From 9.7.4 in Parallelism TS 2. For some reason I overlooked these two
functions. Implement them via call to _S_reduce.

libstdc++-v3/ChangeLog:

* include/experimental/bits/simd.h: Add __detail::_Minimum and
__detail::_Maximum to use them as _BinaryOperation to _S_reduce.
Add hmin and hmax overloads for simd and const_where_expression.
* include/experimental/bits/simd_scalar.h
(_SimdImplScalar::_S_reduce): Make unused _BinaryOperation
parameter const-ref to allow calling _S_reduce with an rvalue.
* testsuite/experimental/simd/tests/reductions.cc: Add tests for
hmin and hmax. Since the compiler statically determined that all
tests pass, repeat the test after a call to make_value_unknown.
libstdc++-v3/include/experimental/bits/simd.h
libstdc++-v3/include/experimental/bits/simd_scalar.h
libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc