Botan 3.11.0
Crypto and TLS for C&
Botan::SIMD_4x64 Class Referencefinal

#include <simd_4x64.h>

Public Member Functions

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 bswap () const
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 operator& (const SIMD_4x64 &other) const
BOTAN_FN_ISA_SIMD_4X64 void operator&= (const SIMD_4x64 &other)
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 operator+ (const SIMD_4x64 &other) const
BOTAN_FN_ISA_SIMD_4X64 void operator+= (const SIMD_4x64 &other)
SIMD_4x64operator= (const SIMD_4x64 &other)=default
SIMD_4x64operator= (SIMD_4x64 &&other)=default
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 operator^ (const SIMD_4x64 &other) const
BOTAN_FN_ISA_SIMD_4X64 void operator^= (const SIMD_4x64 &other)
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 operator| (const SIMD_4x64 &other) const
BOTAN_FN_ISA_SIMD_4X64 void operator|= (const SIMD_4x64 &other)
__m256i BOTAN_FN_ISA_SIMD_4X64 raw () const noexcept
template<size_t ROT>
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 rotl () const
template<size_t ROT>
requires (ROT > 0 && ROT < 64)
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 rotr () const
template<int SHIFT>
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 shl () const noexcept
template<int SHIFT>
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 shr () const noexcept
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 ()
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 (__m256i x)
 SIMD_4x64 (const SIMD_4x64 &other)=default
 SIMD_4x64 (SIMD_4x64 &&other)=default
BOTAN_FN_ISA_SIMD_4X64 void store_be (uint8_t out[]) const
void BOTAN_FN_ISA_SIMD_4X64 store_le (uint64_t out[4]) const
BOTAN_FN_ISA_SIMD_4X64 void store_le (uint8_t out[]) const
BOTAN_FN_ISA_SIMD_4X64 void store_le2 (void *outh, void *outl)
 ~SIMD_4x64 ()=default

Static Public Member Functions

static SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 alignr8 (const SIMD_4x64 &a, const SIMD_4x64 &b)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 broadcast_2x64 (const uint64_t *in)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_be (const void *in)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_be2 (const void *lo, const void *hi)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_le (const void *in)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_le2 (const void *lo, const void *hi)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 mul2_32 (SIMD_4x64 x, SIMD_4x64 y)
template<uint8_t CTRL>
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 permute_4x64 (SIMD_4x64 x)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 splat (uint64_t v)
static void BOTAN_FN_ISA_SIMD_4X64 twist (SIMD_4x64 &B, SIMD_4x64 &C, SIMD_4x64 &D)
static void BOTAN_FN_ISA_SIMD_4X64 untwist (SIMD_4x64 &B, SIMD_4x64 &C, SIMD_4x64 &D)

Detailed Description

Definition at line 23 of file simd_4x64.h.

Constructor & Destructor Documentation

◆ SIMD_4x64() [1/4]

◆ SIMD_4x64() [2/4]

Botan::SIMD_4x64::SIMD_4x64 ( SIMD_4x64 && other)
default

References SIMD_4x64().

◆ ~SIMD_4x64()

Botan::SIMD_4x64::~SIMD_4x64 ( )
default

◆ SIMD_4x64() [3/4]

BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::SIMD_4x64 ( )
inline

Definition at line 34 of file simd_4x64.h.

34: m_simd(_mm256_setzero_si256()) {}

Referenced by alignr8(), broadcast_2x64(), bswap(), load_le(), load_le2(), mul2_32(), permute_4x64(), rotr(), shl(), shr(), and splat().

◆ SIMD_4x64() [4/4]

BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::SIMD_4x64 ( __m256i x)
inlineexplicit

Definition at line 196 of file simd_4x64.h.

196: m_simd(x) {}

Member Function Documentation

◆ alignr8()

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::alignr8 ( const SIMD_4x64 & a,
const SIMD_4x64 & b )
inlinestatic

Definition at line 162 of file simd_4x64.h.

162 {
163 return SIMD_4x64(_mm256_alignr_epi8(a.m_simd, b.m_simd, 8));
164 }
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64()
Definition simd_4x64.h:34

References SIMD_4x64(), and SIMD_4x64().

◆ broadcast_2x64()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::broadcast_2x64 ( const uint64_t * in)
inlinestatic

Definition at line 52 of file simd_4x64.h.

52 {
53 return SIMD_4x64(_mm256_broadcastsi128_si256(_mm_loadu_si128(reinterpret_cast<const __m128i*>(in))));
54 }

References SIMD_4x64(), and SIMD_4x64().

◆ bswap()

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::bswap ( ) const
inline

Definition at line 56 of file simd_4x64.h.

56 {
57 const auto idx = _mm256_set_epi8(
58 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7);
59
60 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, idx));
61 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by load_be(), load_be2(), and store_be().

◆ load_be()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::load_be ( const void * in)
inlinestatic

Definition at line 50 of file simd_4x64.h.

50{ return SIMD_4x64::load_le(in).bswap(); }
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 bswap() const
Definition simd_4x64.h:56
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_le(const void *in)
Definition simd_4x64.h:46

References bswap(), load_le(), and SIMD_4x64().

◆ load_be2()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::load_be2 ( const void * lo,
const void * hi )
inlinestatic

Definition at line 42 of file simd_4x64.h.

42 {
43 return SIMD_4x64::load_le2(lo, hi).bswap();
44 }
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_le2(const void *lo, const void *hi)
Definition simd_4x64.h:37

References bswap(), load_le2(), and SIMD_4x64().

◆ load_le()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::load_le ( const void * in)
inlinestatic

Definition at line 46 of file simd_4x64.h.

46 {
47 return SIMD_4x64(_mm256_loadu_si256(reinterpret_cast<const __m256i*>(in)));
48 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by load_be().

◆ load_le2()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::load_le2 ( const void * lo,
const void * hi )
inlinestatic

Definition at line 37 of file simd_4x64.h.

37 {
38 return SIMD_4x64(
39 _mm256_loadu2_m128i(reinterpret_cast<const __m128i*>(lo), reinterpret_cast<const __m128i*>(hi)));
40 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by load_be2().

◆ mul2_32()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::mul2_32 ( SIMD_4x64 x,
SIMD_4x64 y )
inlinestatic

Definition at line 167 of file simd_4x64.h.

167 {
168 const __m256i m = _mm256_mul_epu32(x.m_simd, y.m_simd);
169 return SIMD_4x64(_mm256_add_epi64(m, m));
170 }

References SIMD_4x64(), and SIMD_4x64().

◆ operator&()

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::operator& ( const SIMD_4x64 & other) const
inline

Definition at line 87 of file simd_4x64.h.

87 {
88 SIMD_4x64 retval(*this);
89 retval &= other;
90 return retval;
91 }
SIMD_4x64(const SIMD_4x64 &other)=default

References SIMD_4x64().

◆ operator&=()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::operator&= ( const SIMD_4x64 & other)
inline

Definition at line 107 of file simd_4x64.h.

107 {
108 m_simd = _mm256_and_si256(m_simd, other.m_simd);
109 }

References SIMD_4x64().

◆ operator+()

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::operator+ ( const SIMD_4x64 & other) const
inline

Definition at line 75 of file simd_4x64.h.

75 {
76 SIMD_4x64 retval(*this);
77 retval += other;
78 return retval;
79 }

References SIMD_4x64().

◆ operator+=()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::operator+= ( const SIMD_4x64 & other)
inline

Definition at line 99 of file simd_4x64.h.

99 {
100 m_simd = _mm256_add_epi64(m_simd, other.m_simd);
101 }

References SIMD_4x64().

◆ operator=() [1/2]

SIMD_4x64 & Botan::SIMD_4x64::operator= ( const SIMD_4x64 & other)
default

References SIMD_4x64().

◆ operator=() [2/2]

SIMD_4x64 & Botan::SIMD_4x64::operator= ( SIMD_4x64 && other)
default

References SIMD_4x64().

◆ operator^()

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::operator^ ( const SIMD_4x64 & other) const
inline

Definition at line 81 of file simd_4x64.h.

81 {
82 SIMD_4x64 retval(*this);
83 retval ^= other;
84 return retval;
85 }

References SIMD_4x64().

◆ operator^=()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::operator^= ( const SIMD_4x64 & other)
inline

Definition at line 103 of file simd_4x64.h.

103 {
104 m_simd = _mm256_xor_si256(m_simd, other.m_simd);
105 }

References SIMD_4x64().

◆ operator|()

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::operator| ( const SIMD_4x64 & other) const
inline

Definition at line 93 of file simd_4x64.h.

93 {
94 SIMD_4x64 retval(*this);
95 retval |= other;
96 return retval;
97 }

References SIMD_4x64().

◆ operator|=()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::operator|= ( const SIMD_4x64 & other)
inline

Definition at line 111 of file simd_4x64.h.

111{ m_simd = _mm256_or_si256(m_simd, other.m_simd); }

References SIMD_4x64().

◆ permute_4x64()

template<uint8_t CTRL>
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::permute_4x64 ( SIMD_4x64 x)
inlinestatic

Definition at line 173 of file simd_4x64.h.

173 {
174 return SIMD_4x64(_mm256_permute4x64_epi64(x.m_simd, CTRL));
175 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by twist(), and untwist().

◆ raw()

__m256i BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::raw ( ) const
inlinenoexcept

Definition at line 194 of file simd_4x64.h.

194{ return m_simd; }

◆ rotl()

template<size_t ROT>
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::rotl ( ) const
inline

Definition at line 148 of file simd_4x64.h.

148 {
149 return this->rotr<64 - ROT>();
150 }
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 rotr() const
Definition simd_4x64.h:114

References rotr(), and SIMD_4x64().

◆ rotr()

template<size_t ROT>
requires (ROT > 0 && ROT < 64)
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::rotr ( ) const
inline

Definition at line 114 of file simd_4x64.h.

116 {
117#if defined(__AVX512VL__)
118 return SIMD_4x64(_mm256_ror_epi64(m_simd, ROT));
119#else
120 if constexpr(ROT == 8) {
121 auto shuf_rot_8 =
122 _mm256_set_epi64x(0x080f0e0d0c0b0a09, 0x0007060504030201, 0x080f0e0d0c0b0a09, 0x0007060504030201);
123
124 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, shuf_rot_8));
125 } else if constexpr(ROT == 16) {
126 auto shuf_rot_16 =
127 _mm256_set_epi64x(0x09080f0e0d0c0b0a, 0x0100070605040302, 0x09080f0e0d0c0b0a, 0x0100070605040302);
128
129 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, shuf_rot_16));
130 } else if constexpr(ROT == 24) {
131 auto shuf_rot_24 =
132 _mm256_set_epi64x(0x0a09080f0e0d0c0b, 0x0201000706050403, 0x0a09080f0e0d0c0b, 0x0201000706050403);
133
134 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, shuf_rot_24));
135 } else if constexpr(ROT == 32) {
136 auto shuf_rot_32 =
137 _mm256_set_epi64x(0x0b0a09080f0e0d0c, 0x0302010007060504, 0x0b0a09080f0e0d0c, 0x0302010007060504);
138
139 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, shuf_rot_32));
140 } else {
141 return SIMD_4x64(_mm256_or_si256(_mm256_srli_epi64(m_simd, static_cast<int>(ROT)),
142 _mm256_slli_epi64(m_simd, static_cast<int>(64 - ROT))));
143 }
144#endif
145 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by rotl().

◆ shl()

template<int SHIFT>
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::shl ( ) const
inlinenoexcept

Definition at line 158 of file simd_4x64.h.

158 {
159 return SIMD_4x64(_mm256_slli_epi64(m_simd, SHIFT));
160 }

References SIMD_4x64(), and SIMD_4x64().

◆ shr()

template<int SHIFT>
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::shr ( ) const
inlinenoexcept

Definition at line 153 of file simd_4x64.h.

153 {
154 return SIMD_4x64(_mm256_srli_epi64(m_simd, SHIFT));
155 }

References SIMD_4x64(), and SIMD_4x64().

◆ splat()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::splat ( uint64_t v)
inlinestatic

Definition at line 192 of file simd_4x64.h.

192{ return SIMD_4x64(_mm256_set1_epi64x(v)); }

References SIMD_4x64(), and SIMD_4x64().

◆ store_be()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::store_be ( uint8_t out[]) const
inline

Definition at line 73 of file simd_4x64.h.

73{ bswap().store_le(out); }
void BOTAN_FN_ISA_SIMD_4X64 store_le(uint64_t out[4]) const
Definition simd_4x64.h:63

References bswap(), and store_le().

◆ store_le() [1/2]

void BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::store_le ( uint64_t out[4]) const
inline

Definition at line 63 of file simd_4x64.h.

63{ this->store_le(reinterpret_cast<uint8_t*>(out)); }

References store_le().

Referenced by store_be(), and store_le().

◆ store_le() [2/2]

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::store_le ( uint8_t out[]) const
inline

Definition at line 65 of file simd_4x64.h.

65 {
66 _mm256_storeu_si256(reinterpret_cast<__m256i*>(out), m_simd);
67 }

◆ store_le2()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::store_le2 ( void * outh,
void * outl )
inline

Definition at line 69 of file simd_4x64.h.

69 {
70 _mm256_storeu2_m128i(reinterpret_cast<__m128i*>(outh), reinterpret_cast<__m128i*>(outl), m_simd);
71 }

◆ twist()

void BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::twist ( SIMD_4x64 & B,
SIMD_4x64 & C,
SIMD_4x64 & D )
inlinestatic

Definition at line 178 of file simd_4x64.h.

178 {
182 }
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 permute_4x64(SIMD_4x64 x)
Definition simd_4x64.h:173

References permute_4x64(), and SIMD_4x64().

◆ untwist()

void BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::untwist ( SIMD_4x64 & B,
SIMD_4x64 & C,
SIMD_4x64 & D )
inlinestatic

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