Skip to content

Commit d50057f

Browse files
author
iburylov
committed
make stdx::sin work for float
1 parent 959de34 commit d50057f

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

experimental/bits/simd.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ template <typename _Tp>
13501350
struct _VectorTraitsImpl<_Tp, enable_if_t<__is_vector_type_v<_Tp>>>
13511351
{
13521352
using type = _Tp;
1353-
using value_type = decltype(std::declval<_Tp>()[0]);
1353+
using value_type = std::remove_reference_t<decltype(std::declval<_Tp>()[0])>;
13541354
static constexpr int _S_width = sizeof(_Tp) / sizeof(value_type);
13551355
using _Wrapper = _SimdWrapper<value_type, _S_width>;
13561356
template <typename _Up, int _W = _S_width>
@@ -1610,11 +1610,16 @@ __or(_Tp __a, _Tp __b) noexcept
16101610

16111611
// }}}
16121612
// __and{{{
1613-
template <typename _Tp, typename _TVT = _VectorTraits<_Tp>, typename... _Dummy>
1614-
_GLIBCXX_SIMD_INTRINSIC constexpr _Tp
1615-
__and(_Tp __a, typename _TVT::type __b, _Dummy...) noexcept
1613+
template <typename _Tp>
1614+
constexpr auto __test_and_operator(int) -> decltype(_Tp() & _Tp(), std::true_type{});
1615+
1616+
template <typename _Tp>
1617+
constexpr std::false_type __test_and_operator(...);
1618+
1619+
template <typename _Tp, typename _TVT = _VectorTraits<_Tp>>
1620+
_GLIBCXX_SIMD_INTRINSIC constexpr std::enable_if_t<!decltype(__test_and_operator<_Tp>(0))::value, _Tp>
1621+
__and(_Tp __a, typename _TVT::type __b) noexcept
16161622
{
1617-
static_assert(sizeof...(_Dummy) == 0);
16181623
using _Up = typename _TVT::value_type;
16191624
using _Ip = make_unsigned_t<__int_for_sizeof_t<_Up>>;
16201625
return __vector_bitcast<_Up>(__vector_bitcast<_Ip>(__a)

experimental/bits/simd_builtin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,7 @@ template <typename _Abi> struct _SimdImplBuiltin
21162116
const _V __absx = __and(__x, _S_absmask<_V>);
21172117
static_assert(CHAR_BIT * sizeof(1ull)
21182118
>= std::numeric_limits<value_type>::digits);
2119-
constexpr _V __shifter_abs
2119+
_GLIBCXX_SIMD_USE_CONSTEXPR _V __shifter_abs
21202120
= _V() + (1ull << (std::numeric_limits<value_type>::digits - 1));
21212121
const _V __shifter = __or(__and(_S_signmask<_V>, __x), __shifter_abs);
21222122
_V __shifted = __x + __shifter;

0 commit comments

Comments
 (0)