]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Add missing constexpr on simd shift implementation
authorMatthias Kretz <m.kretz@gsi.de>
Mon, 20 Feb 2023 16:35:59 +0000 (17:35 +0100)
committerMatthias Kretz <m.kretz@gsi.de>
Thu, 23 Feb 2023 14:01:49 +0000 (15:01 +0100)
Resolves -Wtautological-compare warnings about `if
(__builtin_is_constant_evaluated())` in the implementations of these
functions.

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* include/experimental/bits/simd_x86.h (_S_bit_shift_left)
(_S_bit_shift_right): Declare constexpr. The implementation was
already expecting constexpr evaluation.

libstdc++-v3/include/experimental/bits/simd_x86.h

index dcfdc2a9496d2457af69ade7cfe8333e113e269d..cd642cb3290f4632da68f395a17e062d324d0f85 100644 (file)
@@ -1526,7 +1526,7 @@ template <typename _Abi, typename>
     // values.
   #ifndef _GLIBCXX_SIMD_NO_SHIFT_OPT
     template <typename _Tp, typename _TVT = _VectorTraits<_Tp>>
-      inline _GLIBCXX_CONST static typename _TVT::type
+      constexpr inline _GLIBCXX_CONST static typename _TVT::type
       _S_bit_shift_left(_Tp __xx, int __y)
       {
        using _V = typename _TVT::type;
@@ -1631,7 +1631,7 @@ template <typename _Abi, typename>
       }
 
     template <typename _Tp, typename _TVT = _VectorTraits<_Tp>>
-      inline _GLIBCXX_CONST static typename _TVT::type
+      constexpr inline _GLIBCXX_CONST static typename _TVT::type
       _S_bit_shift_left(_Tp __xx, typename _TVT::type __y)
       {
        using _V = typename _TVT::type;
@@ -1800,7 +1800,7 @@ template <typename _Abi, typename>
     // _S_bit_shift_right {{{
 #ifndef _GLIBCXX_SIMD_NO_SHIFT_OPT
     template <typename _Tp, typename _TVT = _VectorTraits<_Tp>>
-      inline _GLIBCXX_CONST static typename _TVT::type
+      constexpr inline _GLIBCXX_CONST static typename _TVT::type
       _S_bit_shift_right(_Tp __xx, int __y)
       {
        using _V = typename _TVT::type;
@@ -1850,7 +1850,7 @@ template <typename _Abi, typename>
       }
 
     template <typename _Tp, typename _TVT = _VectorTraits<_Tp>>
-      inline _GLIBCXX_CONST static typename _TVT::type
+      constexpr inline _GLIBCXX_CONST static typename _TVT::type
       _S_bit_shift_right(_Tp __xx, typename _TVT::type __y)
       {
        using _V = typename _TVT::type;