Skip to content

Commit 02ba1b5

Browse files
committed
Fix set
1 parent 5d95b20 commit 02ba1b5

1 file changed

Lines changed: 42 additions & 41 deletions

File tree

include/xsimd/arch/xsimd_neon.hpp

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -106,47 +106,6 @@ namespace xsimd
106106
return vdupq_n_f32(val);
107107
}
108108

109-
/*******
110-
* set *
111-
*******/
112-
113-
template <class A, class T, class... Args, detail::enable_integral_t<T> = 0>
114-
XSIMD_INLINE batch<T, A> set(batch<T, A> const&, requires_arch<neon>, Args... args) noexcept
115-
{
116-
return xsimd::types::detail::neon_vector_type<T> { args... };
117-
}
118-
119-
template <class A, class T, class... Args, detail::enable_integral_t<T> = 0>
120-
XSIMD_INLINE batch_bool<T, A> set(batch_bool<T, A> const&, requires_arch<neon>, Args... args) noexcept
121-
{
122-
using unsigned_type = as_unsigned_integer_t<T>;
123-
auto const out = batch<unsigned_type, A> { static_cast<unsigned_type>(args ? -1LL : 0LL)... };
124-
return { out.data };
125-
}
126-
127-
template <class A>
128-
XSIMD_INLINE batch<float, A> set(batch<float, A> const&, requires_arch<neon>, float f0, float f1, float f2, float f3) noexcept
129-
{
130-
return float32x4_t { f0, f1, f2, f3 };
131-
}
132-
133-
template <class A>
134-
XSIMD_INLINE batch<std::complex<float>, A> set(batch<std::complex<float>, A> const&, requires_arch<neon>,
135-
std::complex<float> c0, std::complex<float> c1,
136-
std::complex<float> c2, std::complex<float> c3) noexcept
137-
{
138-
return batch<std::complex<float>, A>(float32x4_t { c0.real(), c1.real(), c2.real(), c3.real() },
139-
float32x4_t { c0.imag(), c1.imag(), c2.imag(), c3.imag() });
140-
}
141-
142-
template <class A, class... Args>
143-
XSIMD_INLINE batch_bool<float, A> set(batch_bool<float, A> const&, requires_arch<neon>, Args... args) noexcept
144-
{
145-
using register_type = typename batch_bool<float, A>::register_type;
146-
using unsigned_type = as_unsigned_integer_t<float>;
147-
return register_type { static_cast<unsigned_type>(args ? -1LL : 0LL)... };
148-
}
149-
150109
/*************
151110
* from_bool *
152111
*************/
@@ -547,6 +506,48 @@ namespace xsimd
547506
store(batch_bool<uint32_t, A>(b.data), mem, A {});
548507
}
549508

509+
/*******
510+
* set *
511+
*******/
512+
513+
template <class A, class T, class... Args, detail::enable_integral_t<T> = 0>
514+
XSIMD_INLINE batch<T, A> set(batch<T, A> const&, requires_arch<neon> req, Args... args) noexcept
515+
{
516+
alignas(A::alignment()) T data[] = { static_cast<T>(args)... };
517+
return load_aligned<A, T>(data, {}, req);
518+
}
519+
520+
template <class A, class T, class... Args, detail::enable_integral_t<T> = 0>
521+
XSIMD_INLINE batch_bool<T, A> set(batch_bool<T, A> const&, requires_arch<neon>, Args... args) noexcept
522+
{
523+
using unsigned_type = as_unsigned_integer_t<T>;
524+
auto const out = batch<unsigned_type, A> { static_cast<unsigned_type>(args ? -1LL : 0LL)... };
525+
return { out.data };
526+
}
527+
528+
template <class A>
529+
XSIMD_INLINE batch<float, A> set(batch<float, A> const&, requires_arch<neon>, float f0, float f1, float f2, float f3) noexcept
530+
{
531+
return float32x4_t { f0, f1, f2, f3 };
532+
}
533+
534+
template <class A>
535+
XSIMD_INLINE batch<std::complex<float>, A> set(batch<std::complex<float>, A> const&, requires_arch<neon>,
536+
std::complex<float> c0, std::complex<float> c1,
537+
std::complex<float> c2, std::complex<float> c3) noexcept
538+
{
539+
return batch<std::complex<float>, A>(float32x4_t { c0.real(), c1.real(), c2.real(), c3.real() },
540+
float32x4_t { c0.imag(), c1.imag(), c2.imag(), c3.imag() });
541+
}
542+
543+
template <class A, class... Args>
544+
XSIMD_INLINE batch_bool<float, A> set(batch_bool<float, A> const&, requires_arch<neon>, Args... args) noexcept
545+
{
546+
using register_type = typename batch_bool<float, A>::register_type;
547+
using unsigned_type = as_unsigned_integer_t<float>;
548+
return register_type { static_cast<unsigned_type>(args ? -1LL : 0LL)... };
549+
}
550+
550551
/*******
551552
* neg *
552553
*******/

0 commit comments

Comments
 (0)