From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7857) id 4C102385735E; Thu, 16 Feb 2023 21:04:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C102385735E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676581460; bh=wJGS+Lv8kwnLHX8v5o0pi4Za6y1GPOcn4Zp1y3hMaa8=; h=From:To:Subject:Date:From; b=TYFK5MNJ8thBZDWcHlapvrqBCr4TTAokzsEGMRvhnW5PaVbx1zUERYZC12UEjiqRG Vjn0mdTYayuKPHWcPpeN3MWYBdKzJYx75Hqz6y6Ap1GiDhiu42tHVv2ZfCuJ33UbAl JaFfNXvIrgLkUIKT63duVTrNG3vpj6QQipCXnleY= 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 r12-9183] libstdc++: Fix incorrect __builtin_is_constant_evaluated calls X-Act-Checkin: gcc X-Git-Author: Matthias Kretz X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 3273df31ec73c4d9587ef72352eee12faffbf09b X-Git-Newrev: 16162ac2250943af3fa710496f066bf2af35ca9f Message-Id: <20230216210420.4C102385735E@sourceware.org> Date: Thu, 16 Feb 2023 21:04:20 +0000 (GMT) List-Id: https://gcc.gnu.org/g:16162ac2250943af3fa710496f066bf2af35ca9f commit r12-9183-g16162ac2250943af3fa710496f066bf2af35ca9f Author: Matthias Kretz Date: Thu Feb 2 12:29:33 2023 +0100 libstdc++: Fix incorrect __builtin_is_constant_evaluated calls Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_x86.h (_SimdImplX86::_S_not_equal_to, _SimdImplX86::_S_less) (_SimdImplX86::_S_less_equal): Do not call __builtin_is_constant_evaluated in constexpr-if. (cherry picked from commit 1fd3836463c65f695831ef04c7dbda1e7a1794ba) Diff: --- libstdc++-v3/include/experimental/bits/simd_x86.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/include/experimental/bits/simd_x86.h b/libstdc++-v3/include/experimental/bits/simd_x86.h index baa978bffda..c809520dcdd 100644 --- a/libstdc++-v3/include/experimental/bits/simd_x86.h +++ b/libstdc++-v3/include/experimental/bits/simd_x86.h @@ -2340,15 +2340,16 @@ template else __assert_unreachable<_Tp>(); } // }}} - else if constexpr (!__builtin_is_constant_evaluated() // {{{ - && sizeof(__x) == 8) + else if (__builtin_is_constant_evaluated()) + return _Base::_S_not_equal_to(__x, __y); + else if constexpr (sizeof(__x) == 8) { const auto __r128 = __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__x) != __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__y); _MaskMember<_Tp> __r64; __builtin_memcpy(&__r64._M_data, &__r128, sizeof(__r64)); return __r64; - } // }}} + } else return _Base::_S_not_equal_to(__x, __y); } @@ -2447,15 +2448,16 @@ template else __assert_unreachable<_Tp>(); } // }}} - else if constexpr (!__builtin_is_constant_evaluated() // {{{ - && sizeof(__x) == 8) + else if (__builtin_is_constant_evaluated()) + return _Base::_S_less(__x, __y); + else if constexpr (sizeof(__x) == 8) { const auto __r128 = __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__x) < __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__y); _MaskMember<_Tp> __r64; __builtin_memcpy(&__r64._M_data, &__r128, sizeof(__r64)); return __r64; - } // }}} + } else return _Base::_S_less(__x, __y); } @@ -2554,15 +2556,16 @@ template else __assert_unreachable<_Tp>(); } // }}} - else if constexpr (!__builtin_is_constant_evaluated() // {{{ - && sizeof(__x) == 8) + else if (__builtin_is_constant_evaluated()) + return _Base::_S_less_equal(__x, __y); + else if constexpr (sizeof(__x) == 8) { const auto __r128 = __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__x) <= __vector_bitcast<_Tp, 16 / sizeof(_Tp)>(__y); _MaskMember<_Tp> __r64; __builtin_memcpy(&__r64._M_data, &__r128, sizeof(__r64)); return __r64; - } // }}} + } else return _Base::_S_less_equal(__x, __y); }