FreeBSD Manual Pages
std::experi...k::simd_mask(3) C++ Standard Libarystd::experi...k::simd_mask(3) NAME std::experimental::simd_mask::simd_mask - std::experimen- tal::simd_mask::simd_mask Synopsis simd_mask() noexcept = default; (1) (par- allelism TS v2) explicit simd_mask( bool value ) noexcept; (2) (par- allelism TS v2) template< class U > simd_mask( const simd_mask<U, (3) (par- allelism TS v2) simd_abi::fixed_size<size()>>& other ) noexcept; template< class U, class Flags > (4) (par- allelism TS v2) simd_mask( const bool* mem, Flags flags ); simd_mask( const simd_mask& other ) noexcept = default; (5) (par- allelism TS v2) (im- plicitly declared) simd_mask( simd_mask&& other ) noexcept = default; (6) (par- allelism TS v2) (im- plicitly declared) 1) Constructs a simd_mask using default initialization (constructed without initializer) or value initialization (constructed with an empty ini- tializer). 2) The broadcast constructor constructs a simd_mask with all values initialized to value. 3) Constructs a simd_mask where the i-th element is initialized to other[i] for all i in the range of [0, size()). This overload participates in over- load resolution only if Abi is simd_abi::fixed_size<size()>. 4) The load constructor constructs a simd_mask where the i-th ele- ment is initialized to mem[i] for all i in the range of [0, size()). 5,6) Implicitly declared copy and move constructors. Constructs a simd_mask where each element is initialized from the values of the elements in other. Parameters value - the value used for initialization of all simd_mask elements other - another simd_mask to copy from mem - a pointer into an array where [mem, mem + size()) is a valid range flags - if of type vector_aligned_tag, the load constructor may as- sume mem to point to storage aligned by memory_alignment_v<simd_mask> Type requirements - is_simd_flag_type_v<Flags> must be true. Example // Run this code #include <algorithm> #include <cstddef> #include <experimental/simd> #include <iostream> namespace stdx = std::experimental; int main() { [[maybe_unused]] stdx::native_simd_mask<int> a; // uninitialized stdx::native_simd_mask<int> b(true); // all elements initialized with true stdx::native_simd_mask<int> c{}; // all elements initialized with false alignas(stdx::memory_alignment_v<stdx::native_simd_mask<int>>) std::array<bool, stdx::native_simd_mask<int>::size() * 2> mem = {}; std::ranges::generate(mem, [i{0}] mutable -> bool { return i++ & 1; }); stdx::native_simd_mask<int> d(&mem[0], stdx::vector_aligned); // {0, 1, 0, 1, ...} stdx::native_simd_mask<int> e(&mem[1], stdx::element_aligned); // {1, 0, 1, 0, ...} const auto xored = b ^ c ^ d ^ e; for (std::size_t i{}; i != xored.size(); ++i) std::cout << xored[i] << ' '; std::cout << '\n'; } Possible output: 0 0 0 0 0 0 0 0 See also element_aligned_tag flag indicating alignment of the load/store ad- dress to element element_aligned alignment (parallelism TS v2) (class) vector_aligned_tag flag indicating alignment of the load/store ad- dress to vector vector_aligned alignment (parallelism TS v2) (class) overaligned_tag flag indicating alignment of the load/store ad- dress to the overaligned specified alignment (parallelism TS v2) (class template) memory_alignment obtains an appropriate alignment for vec- tor_aligned (parallelism TS v2) (class template) copy_from loads simd_mask elements from contiguous memory (parallelism TS v2) (public member function) http://cppreference.com 2024.06.10 std::experi...k::simd_mask(3)
NAME | Synopsis | Parameters | Type requirements | Example | Possible output: | See also
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::experimental::simd_mask::simd_mask&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>
