public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-9180] libstdc++: Ensure __builtin_constant_p isn't lost on the way
@ 2023-02-16 21:04 Matthias Kretz
0 siblings, 0 replies; only message in thread
From: Matthias Kretz @ 2023-02-16 21:04 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:d1084be3151d447cffe2d36667e67939dcdf3e75
commit r12-9180-gd1084be3151d447cffe2d36667e67939dcdf3e75
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 b0226fa4c53..2b1e5bcbe94 100644
--- a/libstdc++-v3/include/experimental/bits/simd.h
+++ b/libstdc++-v3/include/experimental/bits/simd.h
@@ -2673,7 +2673,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;
}
@@ -2693,7 +2694,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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-16 21:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16 21:04 [gcc r12-9180] libstdc++: Ensure __builtin_constant_p isn't lost on the way Matthias Kretz
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).