public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/109261] std::experimental::simd is not usable in several constant expressions
Date: Thu, 25 May 2023 07:05:29 +0000	[thread overview]
Message-ID: <bug-109261-4-qCyabVK6Uv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109261-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109261

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Matthias Kretz
<mkretz@gcc.gnu.org>:

https://gcc.gnu.org/g:7e289c12ce0da962ef258c992f7c52710198e3a6

commit r11-10824-g7e289c12ce0da962ef258c992f7c52710198e3a6
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Thu Mar 23 09:32:58 2023 +0100

    libstdc++: Add missing constexpr to simd

    The constexpr API is only available with -std=gnu++XX (and proposed for
    C++26). The proposal is to have the complete simd API usable in constant
    expressions.

    This patch resolves several issues with using simd in constant
    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 <m.kretz@gsi.de>

    libstdc++-v3/ChangeLog:

            PR libstdc++/109261
            * include/experimental/bits/simd.h (_SimdWrapper::_M_set):
            Avoid vector builtin subscripting in constant expressions.
            (resizing_simd_cast): Avoid memcpy if constant_evaluated.
            (const_where_expression, where_expression, where)
            (__extract_part, simd_mask, _SimdIntOperators, simd): Add either
            _GLIBCXX_SIMD_CONSTEXPR (on public APIs), or constexpr (on
            internal APIs).
            * include/experimental/bits/simd_builtin.h (__vector_permute)
            (__vector_shuffle, __extract_part, _GnuTraits::_SimdCastType1)
            (_GnuTraits::_SimdCastType2, _SimdImplBuiltin)
            (_MaskImplBuiltin::_S_store): Add constexpr.
            (_CommonImplBuiltin::_S_store_bool_array)
            (_SimdImplBuiltin::_S_load, _SimdImplBuiltin::_S_store)
            (_SimdImplBuiltin::_S_reduce, _MaskImplBuiltin::_S_load): Add
            constant_evaluated case.
            * include/experimental/bits/simd_fixed_size.h
            (_S_masked_load): Reword comment.
            (__tuple_element_meta, __make_meta, _SimdTuple::_M_apply_r)
            (_SimdTuple::_M_subscript_read, _SimdTuple::_M_subscript_write)
            (__make_simd_tuple, __optimize_simd_tuple, __extract_part)
            (__autocvt_to_simd, _Fixed::__traits::_SimdBase)
            (_Fixed::__traits::_SimdCastType, _SimdImplFixedSize): Add
            constexpr.
            (_SimdTuple::operator[], _M_set): Add constexpr and add
            constant_evaluated case.
            (_MaskImplFixedSize::_S_load): Add constant_evaluated case.
            * include/experimental/bits/simd_scalar.h: Add constexpr.
            * include/experimental/bits/simd_x86.h (_CommonImplX86): Add
            constexpr and add constant_evaluated case.
            (_SimdImplX86::_S_equal_to, _S_not_equal_to, _S_less)
            (_S_less_equal): Value-initialize to satisfy constexpr
            evaluation.
            (_MaskImplX86::_S_load): Add constant_evaluated case.
            (_MaskImplX86::_S_store): Add constexpr and constant_evaluated
            case. Value-initialize local variables.
            (_MaskImplX86::_S_logical_and, _S_logical_or, _S_bit_not)
            (_S_bit_and, _S_bit_or, _S_bit_xor): Add constant_evaluated
            case.
            * testsuite/experimental/simd/pr109261_constexpr_simd.cc: New
            test.

    (cherry picked from commit da579188807ede4ee9466d0b5bf51559c96a0b51)

  parent reply	other threads:[~2023-05-25  7:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 10:02 [Bug libstdc++/109261] New: " mkretz at gcc dot gnu.org
2023-03-23 10:02 ` [Bug libstdc++/109261] " mkretz at gcc dot gnu.org
2023-04-26  6:58 ` rguenth at gcc dot gnu.org
2023-05-23  7:27 ` cvs-commit at gcc dot gnu.org
2023-05-23 10:03 ` cvs-commit at gcc dot gnu.org
2023-05-23 15:14 ` clyon at gcc dot gnu.org
2023-05-23 15:37 ` mkretz at gcc dot gnu.org
2023-05-23 16:19 ` clyon at gcc dot gnu.org
2023-05-23 22:08 ` mkretz at gcc dot gnu.org
2023-05-24  8:28 ` clyon at gcc dot gnu.org
2023-05-24 11:06 ` cvs-commit at gcc dot gnu.org
2023-05-24 11:06 ` cvs-commit at gcc dot gnu.org
2023-05-24 12:31 ` clyon at gcc dot gnu.org
2023-05-24 19:41 ` cvs-commit at gcc dot gnu.org
2023-05-24 19:41 ` cvs-commit at gcc dot gnu.org
2023-05-25  7:03 ` cvs-commit at gcc dot gnu.org
2023-05-25  7:03 ` cvs-commit at gcc dot gnu.org
2023-05-25  7:04 ` cvs-commit at gcc dot gnu.org
2023-05-25  7:05 ` cvs-commit at gcc dot gnu.org
2023-05-25  7:05 ` cvs-commit at gcc dot gnu.org
2023-05-25  7:05 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-25  7:07 ` mkretz at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109261-4-qCyabVK6Uv@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).