Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions include/xsimd/arch/common/xsimd_common_memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,39 @@ namespace xsimd
store_complex_aligned<A>(dst, src, A {});
}

template <class A, class T, class Mode>
XSIMD_INLINE void
store_complex_masked(std::complex<T>* mem, batch<std::complex<T>, A> const& src, batch_bool<T, A> mask, Mode mode, requires_arch<common>) noexcept
{
// Generic fallback: mask and real /imag part are zipped before
// calling the generic masked store routine.
using mask_register_type = typename batch_bool<T, A>::register_type;
mask_register_type nmask = mask.to_native();
batch_bool<T, A> lo_mask;
batch_bool<T, A> hi_mask;

// Generic zip_lo/hi of batch_bool depending on native register type {
if constexpr (A::has_scalar_mask())
{
constexpr mask_register_type lo_bitmask = xsimd::utils::make_low_mask<mask_register_type>(src.size / 2);
constexpr mask_register_type hi_bitmask = lo_bitmask << (src.size / 2);
lo_mask = nmask & lo_bitmask;
lo_mask |= lo_mask << (src.size / 2);
hi_mask = nmask & hi_bitmask;
hi_mask |= hi_mask >> (src.size / 2);
}
else
{
lo_mask = zip_lo(batch<T, A>(nmask), batch<T, A>(nmask)).to_native();
hi_mask = zip_hi(batch<T, A>(nmask), batch<T, A>(nmask)).to_native();
}
// }.
batch<T, A> src_lo = zip_lo(src.real(), src.imag());
batch<T, A> src_hi = zip_hi(src.real(), src.imag());
src_lo.store(reinterpret_cast<T*>(mem), lo_mask, mode);
src_hi.store(reinterpret_cast<T*>(mem) + src.size, hi_mask, mode);
}

// transpose
template <class A, class T>
XSIMD_INLINE void transpose(batch<T, A>* matrix_begin, batch<T, A>* matrix_end, requires_arch<common>) noexcept
Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_avx512f_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace xsimd
static constexpr bool available() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 64; }
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr bool has_scalar_mask() noexcept { return true; }
static constexpr char const* name() noexcept { return "avx512f"; }
};

Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_avx_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace xsimd
static constexpr std::size_t alignment() noexcept { return 32; }
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr char const* name() noexcept { return "avx"; }
static constexpr bool has_scalar_mask() noexcept { return false; }
};

/**
Expand Down
8 changes: 2 additions & 6 deletions include/xsimd/types/xsimd_batch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1512,13 +1512,9 @@ namespace xsimd

template <class T, class A>
template <class Mode>
XSIMD_INLINE void batch<std::complex<T>, A>::store(value_type* mem, batch_bool<T, A> mask, Mode) const noexcept
XSIMD_INLINE void batch<std::complex<T>, A>::store(value_type* mem, batch_bool<T, A> mask, Mode mode) const noexcept
{
alignas(A::alignment()) std::array<value_type, size> buffer;
store_aligned(buffer.data());
for (std::size_t i = 0; i < size; ++i)
if (mask.get(i))
mem[i] = buffer[i];
kernel::store_complex_masked<A>(mem, *this, mask, mode, A { });
}

template <class T, class A>
Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_emulated_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace xsimd
static constexpr bool requires_alignment() noexcept { return false; }
static constexpr std::size_t alignment() noexcept { return 8; }
static constexpr char const* name() noexcept { return "emulated"; }
static constexpr bool has_scalar_mask() noexcept { return false; }
};

namespace types
Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_neon_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace xsimd
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 16; }
static constexpr char const* name() noexcept { return "arm32+neon"; }
static constexpr bool has_scalar_mask() noexcept { return false; }
};

#if XSIMD_WITH_NEON
Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_rvv_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace xsimd
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 16; }
static constexpr char const* name() noexcept { return "riscv+rvv"; }
static constexpr bool has_scalar_mask() noexcept { return true; }
};
}

Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_sse2_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace xsimd
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 16; }
static constexpr char const* name() noexcept { return "sse2"; }
static constexpr bool has_scalar_mask() noexcept { return false; }
};

#if XSIMD_WITH_SSE2
Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_sve_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace xsimd
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 16; }
static constexpr char const* name() noexcept { return "arm64+sve"; }
static constexpr bool has_scalar_mask() noexcept { return false; }
};
}

Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_vsx_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace xsimd
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 16; }
static constexpr char const* name() noexcept { return "vmx+vsx"; }
static constexpr bool has_scalar_mask() noexcept { return true; }
};

#if XSIMD_WITH_VSX
Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_vxe_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace xsimd
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 16; }
static constexpr char const* name() noexcept { return "vxe"; }
static constexpr bool has_scalar_mask() noexcept { return true; }
};

#if XSIMD_WITH_VXE
Expand Down
1 change: 1 addition & 0 deletions include/xsimd/types/xsimd_wasm_register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace xsimd
static constexpr bool requires_alignment() noexcept { return true; }
static constexpr std::size_t alignment() noexcept { return 16; }
static constexpr char const* name() noexcept { return "wasm"; }
static constexpr bool has_scalar_mask() noexcept { return false; }
};

#if XSIMD_WITH_WASM
Expand Down
Loading