public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Matthias Kretz <mkretz@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-10529] libstdc++: Ensure __builtin_constant_p isn't lost on the way Date: Thu, 16 Feb 2023 15:14:36 +0000 (GMT) [thread overview] Message-ID: <20230216151436.08F583858D33@sourceware.org> (raw) https://gcc.gnu.org/g:e4ddaf9dd48763227ab93c8fe93f7d04080c07a1 commit r11-10529-ge4ddaf9dd48763227ab93c8fe93f7d04080c07a1 Author: Matthias Kretz <m.kretz@gsi.de> Date: Fri Jan 13 16:20:36 2023 +0100 libstdc++: Ensure __builtin_constant_p isn't lost on the way The more expensive code path should only be taken if it can be optimized away. Signed-off-by: Matthias Kretz <m.kretz@gsi.de> libstdc++-v3/ChangeLog: * include/experimental/bits/simd.h (_SimdWrapper::_M_is_constprop_none_of) (_SimdWrapper::_M_is_constprop_all_of): Return false unless the computed result still satisfies __builtin_constant_p. (cherry picked from commit fea34ee491104f325682cc5fb75683b7d74a0a3b) Diff: --- libstdc++-v3/include/experimental/bits/simd.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h index 0e58ae01b17..e9a07018cf0 100644 --- a/libstdc++-v3/include/experimental/bits/simd.h +++ b/libstdc++-v3/include/experimental/bits/simd.h @@ -2546,7 +2546,8 @@ template <typename _Tp, size_t _Width> else __execute_n_times<_Width>( [&](auto __i) { __r &= _M_data[__i.value] == _Tp(); }); - return __r; + if (__builtin_constant_p(__r)) + return __r; } return false; } @@ -2566,7 +2567,8 @@ template <typename _Tp, size_t _Width> else __execute_n_times<_Width>( [&](auto __i) { __r &= _M_data[__i.value] == ~_Tp(); }); - return __r; + if (__builtin_constant_p(__r)) + return __r; } return false; }
reply other threads:[~2023-02-16 15:14 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230216151436.08F583858D33@sourceware.org \ --to=mkretz@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@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: linkBe 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).