OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
olb::cpu::simd::Mask< float > Class Reference

#include <256.h>

+ Collaboration diagram for olb::cpu::simd::Mask< float >:

Public Types

using storage_t = std::uint32_t
 
using storage_t = std::uint16_t
 

Public Member Functions

 Mask (bool a, bool b, bool c, bool d, bool e, bool f, bool g, bool h)
 
 Mask (storage_t *ptr)
 
 Mask (storage_t *ptr, std::size_t iCell)
 
 Mask (bool *ptr)
 
 Mask (bool *ptr, std::size_t iCell)
 
 Mask (__m256i reg)
 
 operator __m256i ()
 
__m256i neg () const
 
 operator bool () const
 
 Mask (std::uint16_t *ptr)
 
 Mask (storage_t *ptr, std::size_t iCell)
 
 Mask (__mmask16 reg)
 
 operator __mmask16 ()
 
__mmask16 neg () const
 
 operator bool () const
 

Static Public Member Functions

static storage_t encode (bool value)
 
static storage_t encode (bool *value)
 
static storage_t encode (bool *value)
 

Static Public Attributes

static constexpr unsigned storage_size = 1
 
static constexpr storage_t true_v = 1 << 31
 
static constexpr storage_t false_v = 0
 

Detailed Description

Definition at line 105 of file 256.h.

Member Typedef Documentation

◆ storage_t [1/2]

using olb::cpu::simd::Mask< float >::storage_t = std::uint32_t

Definition at line 110 of file 256.h.

◆ storage_t [2/2]

using olb::cpu::simd::Mask< float >::storage_t = std::uint16_t

Definition at line 94 of file 512.h.

Constructor & Destructor Documentation

◆ Mask() [1/9]

olb::cpu::simd::Mask< float >::Mask ( bool a,
bool b,
bool c,
bool d,
bool e,
bool f,
bool g,
bool h )
inline

Definition at line 126 of file 256.h.

126 :
127 _reg(_mm256_set_epi32(encode(h),encode(g),encode(f),encode(e),encode(d),encode(c),encode(b),encode(a))) { }
static storage_t encode(bool value)
Definition 256.h:116

◆ Mask() [2/9]

olb::cpu::simd::Mask< float >::Mask ( storage_t * ptr)
inline

Definition at line 129 of file 256.h.

129 :
130 _reg(_mm256_loadu_si256(reinterpret_cast<__m256i*>(ptr))) { }

◆ Mask() [3/9]

olb::cpu::simd::Mask< float >::Mask ( storage_t * ptr,
std::size_t iCell )
inline

Definition at line 132 of file 256.h.

132 :
133 Mask(ptr + iCell) { }
Mask(bool a, bool b, bool c, bool d, bool e, bool f, bool g, bool h)
Definition 256.h:126

◆ Mask() [4/9]

olb::cpu::simd::Mask< float >::Mask ( bool * ptr)
inline

Definition at line 135 of file 256.h.

135 :
136 Mask(ptr[0],ptr[1],ptr[2],ptr[3],ptr[4],ptr[5],ptr[6],ptr[7]) { }

◆ Mask() [5/9]

olb::cpu::simd::Mask< float >::Mask ( bool * ptr,
std::size_t iCell )
inline

Definition at line 138 of file 256.h.

138 :
139 Mask(ptr + iCell) { }

◆ Mask() [6/9]

olb::cpu::simd::Mask< float >::Mask ( __m256i reg)
inline

Definition at line 141 of file 256.h.

141 :
142 _reg(reg) { }

◆ Mask() [7/9]

olb::cpu::simd::Mask< float >::Mask ( std::uint16_t * ptr)
inline

Definition at line 106 of file 512.h.

106 :
107 _reg(_load_mask16(ptr)) { }

◆ Mask() [8/9]

olb::cpu::simd::Mask< float >::Mask ( storage_t * ptr,
std::size_t iCell )
inline

Definition at line 109 of file 512.h.

109 :
110 Mask(ptr + iCell / storage_size) { }
static constexpr unsigned storage_size
Definition 256.h:111

◆ Mask() [9/9]

olb::cpu::simd::Mask< float >::Mask ( __mmask16 reg)
inline

Definition at line 112 of file 512.h.

112 :
113 _reg(reg) { }

Member Function Documentation

◆ encode() [1/3]

static storage_t olb::cpu::simd::Mask< float >::encode ( bool * value)
inlinestatic

Definition at line 121 of file 256.h.

122 {
123 return encode(*value);
124 }

◆ encode() [2/3]

static storage_t olb::cpu::simd::Mask< float >::encode ( bool * value)
inlinestatic

Definition at line 97 of file 512.h.

98 {
99 storage_t mask = value[0];
100 for (unsigned j=1; j < storage_size; ++j) {
101 mask |= value[j] << j;
102 }
103 return mask;
104 }
std::uint32_t storage_t
Definition 256.h:110
typename std::integral_constant< TYPE, VALUE >::type value
Identity type to wrap non-type template arguments.
Definition meta.h:96

◆ encode() [3/3]

static storage_t olb::cpu::simd::Mask< float >::encode ( bool value)
inlinestatic

Definition at line 116 of file 256.h.

117 {
118 return value ? true_v : false_v;
119 }
static constexpr storage_t false_v
Definition 256.h:114
static constexpr storage_t true_v
Definition 256.h:113

◆ neg() [1/2]

__m256i olb::cpu::simd::Mask< float >::neg ( ) const
inline

Definition at line 149 of file 256.h.

150 {
151 return _mm256_sub_epi32(_mm256_set1_epi32(true_v), _reg);
152 }

◆ neg() [2/2]

__mmask16 olb::cpu::simd::Mask< float >::neg ( ) const
inline

Definition at line 120 of file 512.h.

121 {
122 return _knot_mask16(_reg);
123 }

◆ operator __m256i()

olb::cpu::simd::Mask< float >::operator __m256i ( )
inline

Definition at line 144 of file 256.h.

145 {
146 return _reg;
147 }

◆ operator __mmask16()

olb::cpu::simd::Mask< float >::operator __mmask16 ( )
inline

Definition at line 115 of file 512.h.

116 {
117 return _reg;
118 }

◆ operator bool() [1/2]

olb::cpu::simd::Mask< float >::operator bool ( ) const
inline

Definition at line 154 of file 256.h.

155 {
156 const std::uint32_t* values = reinterpret_cast<const std::uint32_t*>(&_reg);
157 return values[0] == true_v
158 || values[1] == true_v
159 || values[2] == true_v
160 || values[3] == true_v
161 || values[4] == true_v
162 || values[5] == true_v
163 || values[6] == true_v
164 || values[7] == true_v;
165 }

◆ operator bool() [2/2]

olb::cpu::simd::Mask< float >::operator bool ( ) const
inline

Definition at line 125 of file 512.h.

126 {
127 const std::uint16_t* value = reinterpret_cast<const std::uint16_t*>(&_reg);
128 return value[0] != 0;
129 }

Member Data Documentation

◆ false_v

constexpr storage_t olb::cpu::simd::Mask< float >::false_v = 0
staticconstexpr

Definition at line 114 of file 256.h.

◆ storage_size

static constexpr unsigned olb::cpu::simd::Mask< float >::storage_size = 1
staticconstexpr

Definition at line 111 of file 256.h.

◆ true_v

constexpr storage_t olb::cpu::simd::Mask< float >::true_v = 1 << 31
staticconstexpr

Definition at line 113 of file 256.h.


The documentation for this class was generated from the following files: