From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7857) id 4692B3858C5E; Thu, 23 Feb 2023 14:03:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4692B3858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677161037; bh=m/PZLePJr19pGTkBpIYSLUTxpoi2IofmK8iFYW8OK4o=; h=From:To:Subject:Date:From; b=aT6es5RcR0n8kQlVzEJKydnNZ5LWGVdchW5BWHmFDmmmavq20YNjuipDHwRzfm6qk KPgzW/zpwwwqJ+t8m8s13zMGerixBjW2OUwT1qQbI1Ykq3i0yB+RFU4XHSJS71MD7C XtKkeKpTNLw74f//zLY8x/kF+Z1aynBQllt0WfVA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Matthias Kretz To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-6298] libstdc++: Simplify three helper functions into one X-Act-Checkin: gcc X-Git-Author: Matthias Kretz X-Git-Refname: refs/heads/master X-Git-Oldrev: af46073dbe83d88e2d93d967da447346b22c70bb X-Git-Newrev: 2e29e2fbeb8936e5c85cefaf547cba42e17e137b Message-Id: <20230223140357.4692B3858C5E@sourceware.org> Date: Thu, 23 Feb 2023 14:03:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2e29e2fbeb8936e5c85cefaf547cba42e17e137b commit r13-6298-g2e29e2fbeb8936e5c85cefaf547cba42e17e137b Author: Matthias Kretz Date: Sat Jan 14 23:32:38 2023 +0100 libstdc++: Simplify three helper functions into one 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 of __call_with_n_evaluations + 2 lambdas. (__vector_broadcast_impl): New. Diff: --- libstdc++-v3/include/experimental/bits/simd.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h index 2f615d13b73..7482d109291 100644 --- a/libstdc++-v3/include/experimental/bits/simd.h +++ b/libstdc++-v3/include/experimental/bits/simd.h @@ -1798,15 +1798,15 @@ template // }}} // __vector_broadcast{{{ +template + _GLIBCXX_SIMD_INTRINSIC constexpr __vector_type_t<_Tp, _Np> + __vector_broadcast_impl(_Tp __x, index_sequence<_I...>) + { return __vector_type_t<_Tp, _Np>{((void)_I, __x)...}; } + template _GLIBCXX_SIMD_INTRINSIC constexpr __vector_type_t<_Tp, _Np> __vector_broadcast(_Tp __x) - { - return __call_with_n_evaluations<_Np>( - [](auto... __xx) _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA { - return __vector_type_t<_Tp, _Np>{__xx...}; - }, [&__x](int) _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA { return __x; }); - } + { return __vector_broadcast_impl<_Np, _Tp>(__x, make_index_sequence<_Np>()); } // }}} // __generate_vector{{{