Skip to content

Commit 98521f3

Browse files
committed
WIP
1 parent 516e302 commit 98521f3

File tree

3 files changed

+25
-95
lines changed

3 files changed

+25
-95
lines changed

include/xsimd/arch/common/xsimd_common_memory.hpp

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -389,26 +389,14 @@ namespace xsimd
389389
}
390390

391391
template <class A, bool... Values, class Mode>
392-
XSIMD_INLINE batch<int32_t, A> load_masked(int32_t const* mem,
393-
batch_bool_constant<int32_t, A, Values...>,
394-
convert<int32_t>,
395-
Mode,
396-
requires_arch<A>) noexcept
392+
XSIMD_INLINE batch<int32_t, A> load_masked(int32_t const* mem, batch_bool_constant<int32_t, A, Values...>, convert<int32_t>, Mode, requires_arch<A>) noexcept
397393
{
398-
const auto f = load_masked<A>(reinterpret_cast<const float*>(mem),
399-
batch_bool_constant<float, A, Values...> {},
400-
convert<float> {},
401-
Mode {},
402-
A {});
394+
const auto f = load_masked<A>(reinterpret_cast<const float*>(mem), batch_bool_constant<float, A, Values...> {}, convert<float> {}, Mode {}, A {});
403395
return bitwise_cast<int32_t>(f);
404396
}
405397

406398
template <class A, bool... Values, class Mode>
407-
XSIMD_INLINE batch<uint32_t, A> load_masked(uint32_t const* mem,
408-
batch_bool_constant<uint32_t, A, Values...>,
409-
convert<uint32_t>,
410-
Mode,
411-
requires_arch<A>) noexcept
399+
XSIMD_INLINE batch<uint32_t, A> load_masked(uint32_t const* mem, batch_bool_constant<uint32_t, A, Values...>, convert<uint32_t>, Mode, requires_arch<A>) noexcept
412400
{
413401
const auto f = load_masked<A>(reinterpret_cast<const float*>(mem),
414402
batch_bool_constant<float, A, Values...> {},
@@ -419,11 +407,8 @@ namespace xsimd
419407
}
420408

421409
template <class A, bool... Values, class Mode>
422-
XSIMD_INLINE batch<int64_t, A> load_masked(int64_t const* mem,
423-
batch_bool_constant<int64_t, A, Values...>,
424-
convert<int64_t>,
425-
Mode,
426-
requires_arch<A>) noexcept
410+
XSIMD_INLINE typename std::enable_if<has_simd_register<double, A>::value, batch<int64_t, A>>::type
411+
load_masked(int64_t const* mem, batch_bool_constant<int64_t, A, Values...>, convert<int64_t>, Mode, requires_arch<A>) noexcept
427412
{
428413
const auto d = load_masked<A>(reinterpret_cast<const double*>(mem),
429414
batch_bool_constant<double, A, Values...> {},
@@ -434,11 +419,8 @@ namespace xsimd
434419
}
435420

436421
template <class A, bool... Values, class Mode>
437-
XSIMD_INLINE batch<uint64_t, A> load_masked(uint64_t const* mem,
438-
batch_bool_constant<uint64_t, A, Values...>,
439-
convert<uint64_t>,
440-
Mode,
441-
requires_arch<A>) noexcept
422+
XSIMD_INLINE typename std::enable_if<has_simd_register<double, A>::value, batch<uint64_t, A>>::type
423+
load_masked(uint64_t const* mem, batch_bool_constant<uint64_t, A, Values...>, convert<uint64_t>, Mode, requires_arch<A>) noexcept
442424
{
443425
const auto d = load_masked<A>(reinterpret_cast<const double*>(mem),
444426
batch_bool_constant<double, A, Values...> {},
@@ -449,11 +431,7 @@ namespace xsimd
449431
}
450432

451433
template <class A, bool... Values, class Mode>
452-
XSIMD_INLINE void store_masked(int32_t* mem,
453-
batch<int32_t, A> const& src,
454-
batch_bool_constant<int32_t, A, Values...>,
455-
Mode,
456-
requires_arch<A>) noexcept
434+
XSIMD_INLINE void store_masked(int32_t* mem, batch<int32_t, A> const& src, batch_bool_constant<int32_t, A, Values...>, Mode, requires_arch<A>) noexcept
457435
{
458436
store_masked<A>(reinterpret_cast<float*>(mem),
459437
bitwise_cast<float>(src),
@@ -463,11 +441,7 @@ namespace xsimd
463441
}
464442

465443
template <class A, bool... Values, class Mode>
466-
XSIMD_INLINE void store_masked(uint32_t* mem,
467-
batch<uint32_t, A> const& src,
468-
batch_bool_constant<uint32_t, A, Values...>,
469-
Mode,
470-
requires_arch<A>) noexcept
444+
XSIMD_INLINE void store_masked(uint32_t* mem, batch<uint32_t, A> const& src, batch_bool_constant<uint32_t, A, Values...>, Mode, requires_arch<A>) noexcept
471445
{
472446
store_masked<A>(reinterpret_cast<float*>(mem),
473447
bitwise_cast<float>(src),
@@ -477,11 +451,8 @@ namespace xsimd
477451
}
478452

479453
template <class A, bool... Values, class Mode>
480-
XSIMD_INLINE void store_masked(int64_t* mem,
481-
batch<int64_t, A> const& src,
482-
batch_bool_constant<int64_t, A, Values...>,
483-
Mode,
484-
requires_arch<A>) noexcept
454+
XSIMD_INLINE typename std::enable_if<has_simd_register<double, A>::value, void>::type
455+
store_masked(int64_t* mem, batch<int64_t, A> const& src, batch_bool_constant<int64_t, A, Values...>, Mode, requires_arch<A>) noexcept
485456
{
486457
store_masked<A>(reinterpret_cast<double*>(mem),
487458
bitwise_cast<double>(src),
@@ -491,11 +462,8 @@ namespace xsimd
491462
}
492463

493464
template <class A, bool... Values, class Mode>
494-
XSIMD_INLINE void store_masked(uint64_t* mem,
495-
batch<uint64_t, A> const& src,
496-
batch_bool_constant<uint64_t, A, Values...>,
497-
Mode,
498-
requires_arch<A>) noexcept
465+
XSIMD_INLINE typename std::enable_if<has_simd_register<double, A>::value, void>::type
466+
store_masked(uint64_t* mem, batch<uint64_t, A> const& src, batch_bool_constant<uint64_t, A, Values...>, Mode, requires_arch<A>) noexcept
499467
{
500468
store_masked<A>(reinterpret_cast<double*>(mem),
501469
bitwise_cast<double>(src),

include/xsimd/arch/xsimd_common_fwd.hpp

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
#ifndef XSIMD_COMMON_FWD_HPP
1414
#define XSIMD_COMMON_FWD_HPP
1515

16+
#include "../type_traits"
1617
#include "../types/xsimd_batch_constant.hpp"
1718

18-
#include <cstddef>
19-
#include <type_traits>
20-
2119
namespace xsimd
2220
{
2321
namespace kernel
@@ -58,58 +56,26 @@ namespace xsimd
5856
template <class A, class T>
5957
XSIMD_INLINE batch<T, A> load(T const* mem, unaligned_mode, requires_arch<A>) noexcept;
6058
template <class A, class T_in, class T_out, bool... Values, class alignment>
61-
XSIMD_INLINE batch<T_out, A> load_masked(T_in const* mem,batch_bool_constant<T_out, A, Values...> mask,convert<T_out>,alignment,requires_arch<common>) noexcept;
59+
XSIMD_INLINE batch<T_out, A> load_masked(T_in const* mem, batch_bool_constant<T_out, A, Values...> mask, convert<T_out>, alignment, requires_arch<common>) noexcept;
6260
template <class A, class T_in, class T_out, bool... Values, class alignment>
63-
XSIMD_INLINE void store_masked(T_out* mem,batch<T_in, A> const& src,batch_bool_constant<T_in, A, Values...> mask,alignment,requires_arch<common>) noexcept;
61+
XSIMD_INLINE void store_masked(T_out* mem, batch<T_in, A> const& src, batch_bool_constant<T_in, A, Values...> mask, alignment, requires_arch<common>) noexcept;
6462
template <class A, bool... Values, class Mode>
65-
XSIMD_INLINE batch<int32_t, A> load_masked(int32_t const* mem,
66-
batch_bool_constant<int32_t, A, Values...> mask,
67-
convert<int32_t>,
68-
Mode,
69-
requires_arch<A>) noexcept;
63+
XSIMD_INLINE batch<int32_t, A> load_masked(int32_t const* mem, batch_bool_constant<int32_t, A, Values...> mask, convert<int32_t>, Mode, requires_arch<A>) noexcept;
7064
template <class A, bool... Values, class Mode>
71-
XSIMD_INLINE batch<uint32_t, A> load_masked(uint32_t const* mem,
72-
batch_bool_constant<uint32_t, A, Values...> mask,
73-
convert<uint32_t>,
74-
Mode,
75-
requires_arch<A>) noexcept;
65+
XSIMD_INLINE batch<uint32_t, A> load_masked(uint32_t const* mem, batch_bool_constant<uint32_t, A, Values...> mask, convert<uint32_t>, Mode, requires_arch<A>) noexcept;
7666
template <class A, bool... Values, class Mode>
77-
XSIMD_INLINE batch<int64_t, A> load_masked(int64_t const* mem,
78-
batch_bool_constant<int64_t, A, Values...> mask,
79-
convert<int64_t>,
80-
Mode,
81-
requires_arch<A>) noexcept;
67+
XSIMD_INLINE typename std::enable_if<types::has_simd_register<double, A>::value, batch<int64_t, A>>::type load_masked(int64_t const*, batch_bool_constant<int64_t, A, Values...>, convert<int64_t>, Mode, requires_arch<A>) noexcept;
8268
template <class A, bool... Values, class Mode>
83-
XSIMD_INLINE batch<uint64_t, A> load_masked(uint64_t const* mem,
84-
batch_bool_constant<uint64_t, A, Values...> mask,
85-
convert<uint64_t>,
86-
Mode,
87-
requires_arch<A>) noexcept;
88-
69+
XSIMD_INLINE typename std::enable_if<types::has_simd_register<double, A>::value, batch<uint64_t, A>>::type load_masked(uint64_t const*, batch_bool_constant<uint64_t, A, Values...>, convert<uint64_t>, Mode, requires_arch<A>) noexcept;
8970
template <class A, bool... Values, class Mode>
90-
XSIMD_INLINE void store_masked(int32_t* mem,
91-
batch<int32_t, A> const& src,
92-
batch_bool_constant<int32_t, A, Values...> mask,
93-
Mode,
94-
requires_arch<A>) noexcept;
71+
XSIMD_INLINE void store_masked(int32_t* mem, batch<int32_t, A> const& src, batch_bool_constant<int32_t, A, Values...> mask, Mode, requires_arch<A>) noexcept;
9572
template <class A, bool... Values, class Mode>
96-
XSIMD_INLINE void store_masked(uint32_t* mem,
97-
batch<uint32_t, A> const& src,
98-
batch_bool_constant<uint32_t, A, Values...> mask,
99-
Mode,
100-
requires_arch<A>) noexcept;
73+
XSIMD_INLINE void store_masked(uint32_t* mem, batch<uint32_t, A> const& src, batch_bool_constant<uint32_t, A, Values...> mask, Mode, requires_arch<A>) noexcept;
10174
template <class A, bool... Values, class Mode>
102-
XSIMD_INLINE void store_masked(int64_t* mem,
103-
batch<int64_t, A> const& src,
104-
batch_bool_constant<int64_t, A, Values...> mask,
105-
Mode,
106-
requires_arch<A>) noexcept;
75+
XSIMD_INLINE typename std::enable_if<types::has_simd_register<double, A>::value, void>::type store_masked(int64_t*, batch<int64_t, A> const&, batch_bool_constant<int64_t, A, Values...>, Mode, requires_arch<A>) noexcept;
10776
template <class A, bool... Values, class Mode>
108-
XSIMD_INLINE void store_masked(uint64_t* mem,
109-
batch<uint64_t, A> const& src,
110-
batch_bool_constant<uint64_t, A, Values...> mask,
111-
Mode,
112-
requires_arch<A>) noexcept;
77+
XSIMD_INLINE typename std::enable_if<types::has_simd_register<double, A>::value, void>::type store_masked(uint64_t*, batch<uint64_t, A> const&, batch_bool_constant<uint64_t, A, Values...>, Mode, requires_arch<A>) noexcept;
78+
11379
// Forward declarations for pack-level helpers
11480
namespace detail
11581
{

include/xsimd/types/xsimd_batch.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ namespace xsimd
722722
return load_unaligned(mem);
723723
}
724724

725-
// Compile-time mask overloads for load (member functions)
726725
template <class T, class A>
727726
template <class U, bool... Values>
728727
XSIMD_INLINE batch<T, A> batch<T, A>::load(U const* mem,
@@ -743,9 +742,6 @@ namespace xsimd
743742
return kernel::load_masked<A>(mem, mask, kernel::convert<T> {}, unaligned_mode {}, A {});
744743
}
745744

746-
// masked load free functions are provided in xsimd_api.hpp
747-
748-
// Compile-time mask overloads for scalar batch store (aligned/unaligned)
749745
template <class T, class A>
750746
template <class U, bool... Values>
751747
XSIMD_INLINE void batch<T, A>::store(U* mem,

0 commit comments

Comments
 (0)