Skip to content

Commit 2d7ad38

Browse files
committed
Introduce [parallel.simd.mask.overview]
1 parent a3b8d12 commit 2d7ad38

File tree

1 file changed

+125
-0
lines changed

1 file changed

+125
-0
lines changed

data_parallel_types.html

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,131 @@ <h1><ins><code>simd</code> math library</ins></h1>
23962396
</ins>
23972397
</p>
23982398
</cxx-section>
2399+
2400+
<cxx-section id="parallel.simd.mask.class">
2401+
<h1><ins>Class template <code>simd_mask</code></ins></h1>
2402+
2403+
<cxx-section id="parallel.simd.mask.overview">
2404+
<h1><ins>Class template <code>simd_mask</code> overview</ins></h1>
2405+
2406+
<pre>
2407+
<ins>
2408+
namespace std::experimental {
2409+
inline namespace parallelism_v2 {
2410+
template&lt;class T, class Abi&gt; class simd_mask {
2411+
public:
2412+
using value_type = bool;
2413+
using reference = <em>see-below</em>;
2414+
using simd_type = simd&lt;T, Abi&gt;;
2415+
using abi_type = Abi;
2416+
2417+
static constexpr size_t size() noexcept;
2418+
2419+
simd_mask() = default;
2420+
2421+
// broadcast constructor
2422+
explicit simd_mask(value_type) noexcept;
2423+
2424+
// implicit type conversion constructor
2425+
template&lt;class U&gt; simd_mask(const simd_mask&lt;U, simd_abi::fixed_size&lt;size()&gt;&gt;&) noexcept;
2426+
2427+
// load constructor
2428+
template&lt;class Flags&gt; simd_mask(const value_Type* mem, Flags);
2429+
2430+
<cxx-ref insynopsis="" to="parallel.simd.mask.copy"></cxx-ref> loads
2431+
template&lt;class Flags&gt; void copy_from(const value_type* mem, Flags);
2432+
template&lt;class Flags&gt; void copy_to(value_type* mem, Flags);
2433+
2434+
<cxx-ref insynopsis="" to="parallel.simd.mask.subscr"></cxx-ref> scalar access
2435+
reference operator[](size_t);
2436+
value_type operator[](size_t) const;
2437+
2438+
<cxx-ref insynopsis="" to="parallel.simd.mask.unary"></cxx-ref> unary operators
2439+
simd_mask operator!() const noexcept;
2440+
2441+
<cxx-ref insynopsis="" to="parallel.simd.mask.binary"></cxx-ref> simd_mask binary operators
2442+
friend simd_mask operator&&(const simd_mask&, const simd_mask&) noexcept;
2443+
friend simd_mask operator||(const simd_mask&, const simd_mask&) noexcept;
2444+
friend simd_mask operator&(const simd_mask&, const simd_mask&) noexcept;
2445+
friend simd_mask operator|(const simd_mask&, const simd_mask&) noexcept;
2446+
friend simd_mask operator^(const simd_mask&, const simd_mask&) noexcept;
2447+
2448+
<cxx-ref insynopsis="" to="parallel.simd.mask.cassign"></cxx-ref> simd_mask compound assignment
2449+
friend simd_mask& operator&=(simd_mask&, const simd_mask&) noexcept;
2450+
friend simd_mask& operator|=(simd_mask&, const simd_mask&) noexcept;
2451+
friend simd_mask& operator^=(simd_mask&, const simd_mask&) noexcept;
2452+
2453+
<cxx-ref insynopsis="" to="parallel.simd.mask.comparison"></cxx-ref> simd_mask compares
2454+
friend simd_mask operator==(const simd_mask&, const simd_mask&) noexcept;
2455+
friend simd_mask operator!=(const simd_mask&, const simd_mask&) noexcept;
2456+
};
2457+
}
2458+
}</ins></pre>
2459+
2460+
<p>
2461+
<ins>
2462+
The class template <code>simd_mask</code> is a data-parallel type with the element type <code>bool</code>. The width of a given <code>simd_mask</code> specialization is a constant expression, determined by the template parameters. Specifically, <code>simd_mask&lt;T, Abi&gt;::size() == simd&lt;T, Abi&gt;::size()</code>.
2463+
</ins>
2464+
</p>
2465+
2466+
<p>
2467+
<ins>
2468+
Every specialization of <code>simd_mask</code> shall be a complete type. The specialization <code>simd_mask&lt;T, Abi&gt;</code> is supported if <code>T</code> is a vectorizable type and
2469+
2470+
<bl>
2471+
<li>
2472+
<ins>
2473+
<code>Abi</code> is <code>simd_abi::scalar</code>, or
2474+
</ins>
2475+
</li>
2476+
2477+
<li>
2478+
<ins>
2479+
<code>Abi</code> is <code>simd_abi::fixed_size&lt;N&gt;</code>, with <code>N</code> constrained as defined in <a href="#parallel.simd.abi">[parallel.simd.abi]</a>.
2480+
</ins>
2481+
</li>
2482+
</bl>
2483+
2484+
<ins>
2485+
If <code>Abi</code> is an extended ABI tag, it is implementation-defined whether <code>simd_mask&lt;T, Abi&gt;</code> is supported. <cxx-note>The intent is for implementations to decide on the basis of the currently targeted system.</cxx-note>
2486+
If <code>simd_mask&lt;T, Abi&gt;</code> is not supported, the specialization shall have a deleted default constructor, deleted destructor, deleted copy constructor, and deleted copy assignment.
2487+
</ins>
2488+
</ins>
2489+
<br>
2490+
2491+
<p>
2492+
<ins>
2493+
Default initialization performs no intialization of the elements; value-initialization initializes each element with <code>false</code>. <cxx-note>Thus, default initialization leaves the elements in an indeterminate state.</cxx-note>
2494+
</ins>
2495+
</p>
2496+
2497+
<cxx-function>
2498+
<cxx-signature><ins>static constexpr size_t size() noexcept;</ins></cxx-signature>
2499+
2500+
<cxx-returns>
2501+
<ins>
2502+
The width of <code>simd&lt;T, Abi&gt;</code>.
2503+
</ins>
2504+
</cxx-returns>
2505+
</cxx-function>
2506+
2507+
<p>
2508+
<ins>
2509+
Implementations should enable explicit conversion from and to implementation-defined types. This adds one or more of the following declarations to class <code>simd_mask</code>:
2510+
2511+
<pre>
2512+
<ins>
2513+
explicit operator <em>implementation-defined</em>() const;
2514+
explicit simd_mask(const <em>implementation-defined</em>& init) const;</ins></pre>
2515+
<br>
2516+
2517+
<p>
2518+
<ins>
2519+
The member type <code>reference</code> has the same interface as <code>simd&lt;T, Abi&gt;::reference</code>, except its <code>value_type</code> is <code>bool</code>. (<a href="#parallel.simd.reference">[parallel.simd.reference]</a>)
2520+
</ins>
2521+
</p>
2522+
</cxx-section>
2523+
</cxx-section>
23992524
</cxx-section>
24002525
</cxx-clause>
24012526

0 commit comments

Comments
 (0)