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< double > Class Reference

#include <256.h>

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

Public Types

using storage_t = std::uint64_t
 
using storage_t = std::uint8_t
 

Public Member Functions

 Mask (bool a, bool b, bool c, bool d)
 
 Mask (std::uint64_t a, std::uint64_t b, std::uint64_t c, std::uint64_t d)
 
 Mask (std::uint64_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 (bool b0, bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7)
 
 Mask (std::uint8_t *ptr)
 
 Mask (storage_t *ptr, std::size_t iCell)
 
 Mask (__mmask8 reg)
 
 operator __mmask8 ()
 
__mmask8 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 = 1l << 63
 
static constexpr storage_t false_v = 0l
 

Detailed Description

Definition at line 42 of file 256.h.

Member Typedef Documentation

◆ storage_t [1/2]

using olb::cpu::simd::Mask< double >::storage_t = std::uint64_t

Definition at line 47 of file 256.h.

◆ storage_t [2/2]

using olb::cpu::simd::Mask< double >::storage_t = std::uint8_t

Definition at line 47 of file 512.h.

Constructor & Destructor Documentation

◆ Mask() [1/11]

olb::cpu::simd::Mask< double >::Mask ( bool a,
bool b,
bool c,
bool d )
inline

Definition at line 63 of file 256.h.

63 :
64 _reg(_mm256_set_epi64x(encode(d),encode(c),encode(b),encode(a))) { }
static storage_t encode(bool value)
Definition 256.h:53

◆ Mask() [2/11]

olb::cpu::simd::Mask< double >::Mask ( std::uint64_t a,
std::uint64_t b,
std::uint64_t c,
std::uint64_t d )
inline

Definition at line 66 of file 256.h.

66 :
67 _reg(_mm256_set_epi64x(d,c,b,a)) { }

◆ Mask() [3/11]

olb::cpu::simd::Mask< double >::Mask ( std::uint64_t * ptr)
inline

Definition at line 69 of file 256.h.

69 :
70 _reg(_mm256_loadu_si256(reinterpret_cast<__m256i*>(ptr))) { }

◆ Mask() [4/11]

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

Definition at line 72 of file 256.h.

72 :
73 Mask(ptr + iCell) { }
Mask(bool a, bool b, bool c, bool d)
Definition 256.h:63

◆ Mask() [5/11]

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

Definition at line 75 of file 256.h.

75 :
76 Mask(ptr[0],ptr[1],ptr[2],ptr[3]) { }

◆ Mask() [6/11]

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

Definition at line 78 of file 256.h.

78 :
79 Mask(ptr + iCell) { }

◆ Mask() [7/11]

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

Definition at line 81 of file 256.h.

81 :
82 _reg(reg) { }

◆ Mask() [8/11]

olb::cpu::simd::Mask< double >::Mask ( bool b0,
bool b1,
bool b2,
bool b3,
bool b4,
bool b5,
bool b6,
bool b7 )
inline

Definition at line 59 of file 512.h.

59 :
60 _reg(std::uint16_t(b0 | b1<<1 | b2<<2 | b3<<3 | b4<<4 | b5<<5 | b6<<6 | b7<<7)) { }

◆ Mask() [9/11]

olb::cpu::simd::Mask< double >::Mask ( std::uint8_t * ptr)
inline

Definition at line 62 of file 512.h.

62 :
63 _reg(_load_mask16(reinterpret_cast<std::uint16_t*>(ptr))) { }

◆ Mask() [10/11]

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

Definition at line 65 of file 512.h.

65 :
66 Mask(ptr + iCell / storage_size) { }
static constexpr unsigned storage_size
Definition 256.h:48

◆ Mask() [11/11]

olb::cpu::simd::Mask< double >::Mask ( __mmask8 reg)
inline

Definition at line 68 of file 512.h.

68 :
69 _reg(reg) { }

Member Function Documentation

◆ encode() [1/3]

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

Definition at line 58 of file 256.h.

59 {
60 return encode(*value);
61 }

◆ encode() [2/3]

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

Definition at line 50 of file 512.h.

51 {
52 storage_t mask = value[0];
53 for (unsigned j=1; j < storage_size; ++j) {
54 mask |= value[j] << j;
55 }
56 return mask;
57 }
std::uint64_t storage_t
Definition 256.h:47
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< double >::encode ( bool value)
inlinestatic

Definition at line 53 of file 256.h.

54 {
55 return value ? true_v : false_v;
56 }
static constexpr storage_t false_v
Definition 256.h:51
static constexpr storage_t true_v
Definition 256.h:50

◆ neg() [1/2]

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

Definition at line 89 of file 256.h.

90 {
91 return _mm256_sub_epi64(_mm256_set1_epi64x(true_v), _reg);
92 }

◆ neg() [2/2]

__mmask8 olb::cpu::simd::Mask< double >::neg ( ) const
inline

Definition at line 76 of file 512.h.

77 {
78 return _knot_mask8(_reg);
79 }

◆ operator __m256i()

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

Definition at line 84 of file 256.h.

85 {
86 return _reg;
87 }

◆ operator __mmask8()

olb::cpu::simd::Mask< double >::operator __mmask8 ( )
inline

Definition at line 71 of file 512.h.

72 {
73 return _reg;
74 }

◆ operator bool() [1/2]

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

Definition at line 94 of file 256.h.

95 {
96 const std::uint64_t* values = reinterpret_cast<const std::uint64_t*>(&_reg);
97 return values[0] == true_v
98 || values[1] == true_v
99 || values[2] == true_v
100 || values[3] == true_v;
101 }

◆ operator bool() [2/2]

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

Definition at line 81 of file 512.h.

82 {
83 const std::uint8_t* value = reinterpret_cast<const std::uint8_t*>(&_reg);
84 return value[0] != 0;
85 }

Member Data Documentation

◆ false_v

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

Definition at line 51 of file 256.h.

◆ storage_size

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

Definition at line 48 of file 256.h.

◆ true_v

constexpr storage_t olb::cpu::simd::Mask< double >::true_v = 1l << 63
staticconstexpr

Definition at line 50 of file 256.h.


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