Avoid
-Wnarrowing in C code;
-Wtautological-compare in unconditional static_assert (necessary for
faking a dependency on a template parameter)
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
* include/experimental/bits/simd.h: Ignore -Wnarrowing for
arm_neon.h.
(__int_for_sizeof): Replace tautological compare with checking
for invalid template parameter value.
* include/experimental/bits/simd_builtin.h (__extract_part):
Remove tautological compare by combining two static_assert.
(cherry picked from commit
e7a3ad29c9c832b6ae999cbfb0af89e121959030)
#if _GLIBCXX_SIMD_X86INTRIN
#include <x86intrin.h>
#elif _GLIBCXX_SIMD_HAVE_NEON
+#pragma GCC diagnostic push
+// narrowing conversion of '__a' from 'uint64_t' {aka 'long long unsigned int'} to
+// 'int64x1_t' {aka 'long long int'} [-Wnarrowing]
+#pragma GCC diagnostic ignored "-Wnarrowing"
#include <arm_neon.h>
+#pragma GCC diagnostic pop
#endif
/** @ingroup ts_simd
constexpr auto
__int_for_sizeof()
{
+ static_assert(_Bytes > 0);
if constexpr (_Bytes == sizeof(int))
return int();
#ifdef __clang__
return _Ip{};
}
else
- static_assert(_Bytes != _Bytes, "this should be unreachable");
+ static_assert(_Bytes == 0, "this should be unreachable");
}
#pragma GCC diagnostic pop
__extract_part(const _SimdWrapper<bool, _Np> __x)
{
static_assert(_Combine == 1, "_Combine != 1 not implemented");
- static_assert(__have_avx512f && _Np == _Np);
- static_assert(_Total >= 2 && _Index + _Combine <= _Total && _Index >= 0);
+ static_assert(__have_avx512f && _Total >= 2 && _Index + _Combine <= _Total && _Index >= 0);
return __x._M_data >> (_Index * _Np / _Total);
}