Botan 3.9.0
Crypto and TLS for C&
Botan::SIMD_8x32 Class Referencefinal

#include <simd_avx2.h>

Public Member Functions

BOTAN_FN_ISA_AVX2 SIMD_8x32 andc (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_AVX2 SIMD_8x32 bswap () const noexcept
BOTAN_FN_ISA_AVX2 SIMD_8x32 operator& (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_AVX2 void operator&= (const SIMD_8x32 &other)
BOTAN_FN_ISA_AVX2 SIMD_8x32 operator+ (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_AVX2 void operator+= (const SIMD_8x32 &other)
BOTAN_FN_ISA_AVX2 SIMD_8x32 operator- (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_AVX2 void operator-= (const SIMD_8x32 &other)
SIMD_8x32operator= (const SIMD_8x32 &other)=default
SIMD_8x32operator= (SIMD_8x32 &&other)=default
BOTAN_FN_ISA_AVX2 SIMD_8x32 operator^ (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_AVX2 void operator^= (const SIMD_8x32 &other)
BOTAN_FN_ISA_AVX2 void operator^= (uint32_t other)
BOTAN_FN_ISA_AVX2 SIMD_8x32 operator| (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_AVX2 void operator|= (const SIMD_8x32 &other)
BOTAN_FN_ISA_AVX2 SIMD_8x32 operator~ () const noexcept
__m256i BOTAN_FN_ISA_AVX2 raw () const noexcept
BOTAN_FN_ISA_AVX2 SIMD_8x32 rev_words () const noexcept
BOTAN_FN_ISA_AVX2 SIMD_8x32 reverse () const noexcept
template<size_t ROT>
requires (ROT > 0 && ROT < 32)
BOTAN_FN_ISA_AVX2 SIMD_8x32 rotl () const noexcept
template<size_t ROT>
BOTAN_FN_ISA_AVX2 SIMD_8x32 rotr () const noexcept
template<int SHIFT>
BOTAN_FN_ISA_AVX2 SIMD_8x32 shl () const noexcept
template<int SHIFT>
BOTAN_FN_ISA_AVX2 SIMD_8x32 shr () const noexcept
SIMD_8x32 BOTAN_FN_ISA_AVX2 sigma0 () const noexcept
SIMD_8x32 BOTAN_FN_ISA_AVX2 sigma1 () const noexcept
BOTAN_FN_ISA_AVX2 BOTAN_FORCE_INLINE SIMD_8x32 () noexcept
BOTAN_FN_ISA_AVX2 SIMD_8x32 (__m256i x) noexcept
 SIMD_8x32 (const SIMD_8x32 &other)=default
BOTAN_FN_ISA_AVX2 SIMD_8x32 (const uint32_t B[8]) noexcept
 SIMD_8x32 (SIMD_8x32 &&other)=default
BOTAN_FN_ISA_AVX2 SIMD_8x32 (uint32_t B0, uint32_t B1, uint32_t B2, uint32_t B3) noexcept
BOTAN_FN_ISA_AVX2 SIMD_8x32 (uint32_t B0, uint32_t B1, uint32_t B2, uint32_t B3, uint32_t B4, uint32_t B5, uint32_t B6, uint32_t B7) noexcept
BOTAN_FN_ISA_AVX2 void store_be (uint8_t out[]) const noexcept
BOTAN_FN_ISA_AVX2 void store_le (uint32_t out[]) const noexcept
BOTAN_FN_ISA_AVX2 void store_le (uint8_t out[]) const noexcept
BOTAN_FN_ISA_AVX2 void store_le128 (uint32_t out1[], uint32_t out2[]) const noexcept
BOTAN_FN_ISA_AVX2 void store_le128 (uint8_t out[]) const noexcept
 ~SIMD_8x32 ()=default

Static Public Member Functions

static SIMD_8x32 BOTAN_FN_ISA_AVX2 byte_shuffle (const SIMD_8x32 &tbl, const SIMD_8x32 &idx)
static BOTAN_FN_ISA_AVX2 SIMD_8x32 choose (const SIMD_8x32 &mask, const SIMD_8x32 &a, const SIMD_8x32 &b) noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 load_be (const uint8_t *in) noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 load_be128 (const uint8_t in1[], const uint8_t in2[]) noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 load_le (const uint32_t *in) noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 load_le (const uint8_t *in) noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 load_le128 (const uint32_t *in) noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 load_le128 (const uint32_t in1[], const uint32_t in2[]) noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 load_le128 (const uint8_t *in) noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 majority (const SIMD_8x32 &x, const SIMD_8x32 &y, const SIMD_8x32 &z) noexcept
static BOTAN_FN_ISA_AVX2 void reset_registers () noexcept
static BOTAN_FN_ISA_AVX2 SIMD_8x32 splat (uint32_t B) noexcept
static BOTAN_FN_ISA_AVX2 void transpose (SIMD_8x32 &B0, SIMD_8x32 &B1, SIMD_8x32 &B2, SIMD_8x32 &B3) noexcept
static BOTAN_FN_ISA_AVX2 void transpose (SIMD_8x32 &B0, SIMD_8x32 &B1, SIMD_8x32 &B2, SIMD_8x32 &B3, SIMD_8x32 &B4, SIMD_8x32 &B5, SIMD_8x32 &B6, SIMD_8x32 &B7) noexcept
static BOTAN_FN_ISA_AVX2 void zero_registers () noexcept

Detailed Description

Definition at line 19 of file simd_avx2.h.

Constructor & Destructor Documentation

◆ SIMD_8x32() [1/7]

◆ SIMD_8x32() [2/7]

Botan::SIMD_8x32::SIMD_8x32 ( SIMD_8x32 && other)
default

References SIMD_8x32().

◆ ~SIMD_8x32()

Botan::SIMD_8x32::~SIMD_8x32 ( )
default

◆ SIMD_8x32() [3/7]

BOTAN_FN_ISA_AVX2 BOTAN_FORCE_INLINE Botan::SIMD_8x32::SIMD_8x32 ( )
inlinenoexcept

Definition at line 30 of file simd_avx2.h.

30: m_avx2(_mm256_setzero_si256()) {}

References BOTAN_FORCE_INLINE.

Referenced by andc(), bswap(), byte_shuffle(), choose(), load_be128(), load_le(), load_le(), load_le128(), load_le128(), load_le128(), majority(), operator~(), rev_words(), reverse(), rotl(), shl(), shr(), and splat().

◆ SIMD_8x32() [4/7]

BOTAN_FN_ISA_AVX2 Botan::SIMD_8x32::SIMD_8x32 ( const uint32_t B[8])
inlineexplicitnoexcept

Definition at line 33 of file simd_avx2.h.

33 {
34 // NOLINTNEXTLINE(*-prefer-member-initializer)
35 m_avx2 = _mm256_loadu_si256(reinterpret_cast<const __m256i*>(B));
36 }

◆ SIMD_8x32() [5/7]

BOTAN_FN_ISA_AVX2 Botan::SIMD_8x32::SIMD_8x32 ( uint32_t B0,
uint32_t B1,
uint32_t B2,
uint32_t B3,
uint32_t B4,
uint32_t B5,
uint32_t B6,
uint32_t B7 )
inlineexplicitnoexcept

Definition at line 39 of file simd_avx2.h.

46 {
47 // NOLINTNEXTLINE(*-prefer-member-initializer)
48 m_avx2 = _mm256_set_epi32(B7, B6, B5, B4, B3, B2, B1, B0);
49 }

◆ SIMD_8x32() [6/7]

BOTAN_FN_ISA_AVX2 Botan::SIMD_8x32::SIMD_8x32 ( uint32_t B0,
uint32_t B1,
uint32_t B2,
uint32_t B3 )
inlineexplicitnoexcept

Definition at line 52 of file simd_avx2.h.

52 {
53 // NOLINTNEXTLINE(*-prefer-member-initializer)
54 m_avx2 = _mm256_set_epi32(B3, B2, B1, B0, B3, B2, B1, B0);
55 }

◆ SIMD_8x32() [7/7]

BOTAN_FN_ISA_AVX2 Botan::SIMD_8x32::SIMD_8x32 ( __m256i x)
inlineexplicitnoexcept

Definition at line 325 of file simd_avx2.h.

325: m_avx2(x) {}

Member Function Documentation

◆ andc()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::andc ( const SIMD_8x32 & other) const
inlinenoexcept

Definition at line 233 of file simd_avx2.h.

233 {
234 return SIMD_8x32(_mm256_andnot_si256(m_avx2, other.m_avx2));
235 }
BOTAN_FN_ISA_AVX2 BOTAN_FORCE_INLINE SIMD_8x32() noexcept
Definition simd_avx2.h:30

References SIMD_8x32(), and SIMD_8x32().

◆ bswap()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::bswap ( ) const
inlinenoexcept

Definition at line 238 of file simd_avx2.h.

238 {
239 alignas(32) const uint8_t BSWAP_TBL[32] = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12,
240 19, 18, 17, 16, 23, 22, 21, 20, 27, 26, 25, 24, 31, 30, 29, 28};
241
242 const __m256i bswap = _mm256_load_si256(reinterpret_cast<const __m256i*>(BSWAP_TBL));
243
244 const __m256i output = _mm256_shuffle_epi8(m_avx2, bswap);
245
246 return SIMD_8x32(output);
247 }
BOTAN_FN_ISA_AVX2 SIMD_8x32 bswap() const noexcept
Definition simd_avx2.h:238

References bswap(), SIMD_8x32(), and SIMD_8x32().

Referenced by bswap(), load_be(), reverse(), and store_be().

◆ byte_shuffle()

SIMD_8x32 BOTAN_FN_ISA_AVX2 Botan::SIMD_8x32::byte_shuffle ( const SIMD_8x32 & tbl,
const SIMD_8x32 & idx )
inlinestatic

Definition at line 312 of file simd_avx2.h.

312 {
313 return SIMD_8x32(_mm256_shuffle_epi8(tbl.raw(), idx.raw()));
314 }

References raw(), SIMD_8x32(), and SIMD_8x32().

◆ choose()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::choose ( const SIMD_8x32 & mask,
const SIMD_8x32 & a,
const SIMD_8x32 & b )
inlinestaticnoexcept

Definition at line 295 of file simd_avx2.h.

295 {
296#if defined(__AVX512VL__)
297 return SIMD_8x32(_mm256_ternarylogic_epi32(mask.raw(), a.raw(), b.raw(), 0xca));
298#else
299 return (mask & a) ^ mask.andc(b);
300#endif
301 }

References SIMD_8x32(), and SIMD_8x32().

Referenced by majority().

◆ load_be()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::load_be ( const uint8_t * in)
inlinestaticnoexcept

Definition at line 81 of file simd_avx2.h.

81{ return load_le(in).bswap(); }
static BOTAN_FN_ISA_AVX2 SIMD_8x32 load_le(const uint8_t *in) noexcept
Definition simd_avx2.h:61

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

◆ load_be128()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::load_be128 ( const uint8_t in1[],
const uint8_t in2[] )
inlinestaticnoexcept

Definition at line 101 of file simd_avx2.h.

101 {
102 return SIMD_8x32(
103 _mm256_loadu2_m128i(reinterpret_cast<const __m128i*>(in2), reinterpret_cast<const __m128i*>(in1)))
104 .bswap();
105 }

References SIMD_8x32(), and SIMD_8x32().

◆ load_le() [1/2]

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::load_le ( const uint32_t * in)
inlinestaticnoexcept

Definition at line 66 of file simd_avx2.h.

66 {
67 return SIMD_8x32(_mm256_loadu_si256(reinterpret_cast<const __m256i*>(in)));
68 }

References SIMD_8x32(), and SIMD_8x32().

◆ load_le() [2/2]

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::load_le ( const uint8_t * in)
inlinestaticnoexcept

Definition at line 61 of file simd_avx2.h.

61 {
62 return SIMD_8x32(_mm256_loadu_si256(reinterpret_cast<const __m256i*>(in)));
63 }

References SIMD_8x32(), and SIMD_8x32().

Referenced by load_be().

◆ load_le128() [1/3]

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::load_le128 ( const uint32_t * in)
inlinestaticnoexcept

Definition at line 76 of file simd_avx2.h.

76 {
77 return SIMD_8x32(_mm256_broadcastsi128_si256(_mm_loadu_si128(reinterpret_cast<const __m128i*>(in))));
78 }

References SIMD_8x32(), and SIMD_8x32().

◆ load_le128() [2/3]

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::load_le128 ( const uint32_t in1[],
const uint32_t in2[] )
inlinestaticnoexcept

Definition at line 95 of file simd_avx2.h.

95 {
96 return SIMD_8x32(
97 _mm256_loadu2_m128i(reinterpret_cast<const __m128i*>(in2), reinterpret_cast<const __m128i*>(in1)));
98 }

References SIMD_8x32(), and SIMD_8x32().

◆ load_le128() [3/3]

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::load_le128 ( const uint8_t * in)
inlinestaticnoexcept

Definition at line 71 of file simd_avx2.h.

71 {
72 return SIMD_8x32(_mm256_broadcastsi128_si256(_mm_loadu_si128(reinterpret_cast<const __m128i*>(in))));
73 }

References SIMD_8x32(), and SIMD_8x32().

◆ majority()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::majority ( const SIMD_8x32 & x,
const SIMD_8x32 & y,
const SIMD_8x32 & z )
inlinestaticnoexcept

Definition at line 304 of file simd_avx2.h.

304 {
305#if defined(__AVX512VL__)
306 return SIMD_8x32(_mm256_ternarylogic_epi32(x.raw(), y.raw(), z.raw(), 0xe8));
307#else
308 return SIMD_8x32::choose(x ^ y, z, y);
309#endif
310 }
static BOTAN_FN_ISA_AVX2 SIMD_8x32 choose(const SIMD_8x32 &mask, const SIMD_8x32 &a, const SIMD_8x32 &b) noexcept
Definition simd_avx2.h:295

References choose(), SIMD_8x32(), and SIMD_8x32().

◆ operator&()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::operator& ( const SIMD_8x32 & other) const
inlinenoexcept

Definition at line 192 of file simd_avx2.h.

192 {
193 SIMD_8x32 retval(*this);
194 retval &= other;
195 return retval;
196 }
SIMD_8x32(const SIMD_8x32 &other)=default

References SIMD_8x32().

◆ operator&=()

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::operator&= ( const SIMD_8x32 & other)
inline

Definition at line 214 of file simd_avx2.h.

214{ m_avx2 = _mm256_and_si256(m_avx2, other.m_avx2); }

References SIMD_8x32().

◆ operator+()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::operator+ ( const SIMD_8x32 & other) const
inlinenoexcept

Definition at line 164 of file simd_avx2.h.

164 {
165 SIMD_8x32 retval(*this);
166 retval += other;
167 return retval;
168 }

References SIMD_8x32().

◆ operator+=()

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::operator+= ( const SIMD_8x32 & other)
inline

Definition at line 199 of file simd_avx2.h.

199{ m_avx2 = _mm256_add_epi32(m_avx2, other.m_avx2); }

References SIMD_8x32().

◆ operator-()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::operator- ( const SIMD_8x32 & other) const
inlinenoexcept

Definition at line 171 of file simd_avx2.h.

171 {
172 SIMD_8x32 retval(*this);
173 retval -= other;
174 return retval;
175 }

References SIMD_8x32().

◆ operator-=()

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::operator-= ( const SIMD_8x32 & other)
inline

Definition at line 202 of file simd_avx2.h.

202{ m_avx2 = _mm256_sub_epi32(m_avx2, other.m_avx2); }

References SIMD_8x32().

◆ operator=() [1/2]

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

References SIMD_8x32().

◆ operator=() [2/2]

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

References SIMD_8x32().

◆ operator^()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::operator^ ( const SIMD_8x32 & other) const
inlinenoexcept

Definition at line 178 of file simd_avx2.h.

178 {
179 SIMD_8x32 retval(*this);
180 retval ^= other;
181 return retval;
182 }

References SIMD_8x32().

◆ operator^=() [1/2]

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::operator^= ( const SIMD_8x32 & other)
inline

Definition at line 205 of file simd_avx2.h.

205{ m_avx2 = _mm256_xor_si256(m_avx2, other.m_avx2); }

References SIMD_8x32().

◆ operator^=() [2/2]

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::operator^= ( uint32_t other)
inline

Definition at line 208 of file simd_avx2.h.

208{ *this ^= SIMD_8x32::splat(other); }
static BOTAN_FN_ISA_AVX2 SIMD_8x32 splat(uint32_t B) noexcept
Definition simd_avx2.h:58

References splat().

◆ operator|()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::operator| ( const SIMD_8x32 & other) const
inlinenoexcept

Definition at line 185 of file simd_avx2.h.

185 {
186 SIMD_8x32 retval(*this);
187 retval |= other;
188 return retval;
189 }

References SIMD_8x32().

◆ operator|=()

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::operator|= ( const SIMD_8x32 & other)
inline

Definition at line 211 of file simd_avx2.h.

211{ m_avx2 = _mm256_or_si256(m_avx2, other.m_avx2); }

References SIMD_8x32().

◆ operator~()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::operator~ ( ) const
inlinenoexcept

Definition at line 227 of file simd_avx2.h.

227 {
228 return SIMD_8x32(_mm256_xor_si256(m_avx2, _mm256_set1_epi32(0xFFFFFFFF)));
229 }

References SIMD_8x32(), and SIMD_8x32().

◆ raw()

__m256i BOTAN_FN_ISA_AVX2 Botan::SIMD_8x32::raw ( ) const
inlinenoexcept

Definition at line 322 of file simd_avx2.h.

322{ return m_avx2; }

Referenced by byte_shuffle(), Botan::gf2p8affine(), Botan::gf2p8affineinv(), Botan::gf2p8mul(), rev_words(), store_le128(), and store_le128().

◆ reset_registers()

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::reset_registers ( )
inlinestaticnoexcept

Definition at line 317 of file simd_avx2.h.

317{ _mm256_zeroupper(); }

◆ rev_words()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::rev_words ( ) const
inlinenoexcept

Definition at line 261 of file simd_avx2.h.

261{ return SIMD_8x32(_mm256_shuffle_epi32(raw(), 0b00011011)); }
__m256i BOTAN_FN_ISA_AVX2 raw() const noexcept
Definition simd_avx2.h:322

References raw(), SIMD_8x32(), and SIMD_8x32().

◆ reverse()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::reverse ( ) const
inlinenoexcept

Definition at line 251 of file simd_avx2.h.

251 {
252 alignas(32) const uint8_t REV_TBL[32] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
253 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
254
255 const __m256i bswap = _mm256_load_si256(reinterpret_cast<const __m256i*>(REV_TBL));
256 const __m256i output = _mm256_shuffle_epi8(m_avx2, bswap);
257 return SIMD_8x32(output);
258 }

References bswap(), SIMD_8x32(), and SIMD_8x32().

◆ rotl()

template<size_t ROT>
requires (ROT > 0 && ROT < 32)
BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::rotl ( ) const
inlinenoexcept

Definition at line 116 of file simd_avx2.h.

118 {
119#if defined(__AVX512VL__)
120 return SIMD_8x32(_mm256_rol_epi32(m_avx2, ROT));
121#else
122 if constexpr(ROT == 8) {
123 const __m256i shuf_rotl_8 =
124 _mm256_set_epi64x(0x0e0d0c0f'0a09080b, 0x06050407'02010003, 0x0e0d0c0f'0a09080b, 0x06050407'02010003);
125
126 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_8));
127 } else if constexpr(ROT == 16) {
128 const __m256i shuf_rotl_16 =
129 _mm256_set_epi64x(0x0d0c0f0e'09080b0a, 0x05040706'01000302, 0x0d0c0f0e'09080b0a, 0x05040706'01000302);
130
131 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_16));
132 } else if constexpr(ROT == 24) {
133 const __m256i shuf_rotl_24 =
134 _mm256_set_epi64x(0x0c0f0e0d'080b0a09, 0x04070605'00030201, 0x0c0f0e0d'080b0a09, 0x04070605'00030201);
135
136 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_24));
137 } else {
138 return SIMD_8x32(_mm256_or_si256(_mm256_slli_epi32(m_avx2, static_cast<int>(ROT)),
139 _mm256_srli_epi32(m_avx2, static_cast<int>(32 - ROT))));
140 }
141#endif
142 }

References SIMD_8x32(), and SIMD_8x32().

Referenced by Botan::rotl(), and rotr().

◆ rotr()

template<size_t ROT>
BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::rotr ( ) const
inlinenoexcept

Definition at line 145 of file simd_avx2.h.

145 {
146 return this->rotl<32 - ROT>();
147 }
BOTAN_FN_ISA_AVX2 SIMD_8x32 rotl() const noexcept
Definition simd_avx2.h:116

References rotl(), and SIMD_8x32().

Referenced by Botan::rotr(), sigma0(), and sigma1().

◆ shl()

template<int SHIFT>
BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::shl ( ) const
inlinenoexcept

Definition at line 217 of file simd_avx2.h.

217 {
218 return SIMD_8x32(_mm256_slli_epi32(m_avx2, SHIFT));
219 }

References SIMD_8x32(), and SIMD_8x32().

Referenced by Botan::shl().

◆ shr()

template<int SHIFT>
BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::shr ( ) const
inlinenoexcept

Definition at line 222 of file simd_avx2.h.

222 {
223 return SIMD_8x32(_mm256_srli_epi32(m_avx2, SHIFT));
224 }

References SIMD_8x32(), and SIMD_8x32().

◆ sigma0()

SIMD_8x32 BOTAN_FN_ISA_AVX2 Botan::SIMD_8x32::sigma0 ( ) const
inlinenoexcept

Definition at line 149 of file simd_avx2.h.

149 {
150 const SIMD_8x32 rot1 = this->rotr<2>();
151 const SIMD_8x32 rot2 = this->rotr<13>();
152 const SIMD_8x32 rot3 = this->rotr<22>();
153 return rot1 ^ rot2 ^ rot3;
154 }
BOTAN_FN_ISA_AVX2 SIMD_8x32 rotr() const noexcept
Definition simd_avx2.h:145

References rotr(), and SIMD_8x32().

◆ sigma1()

SIMD_8x32 BOTAN_FN_ISA_AVX2 Botan::SIMD_8x32::sigma1 ( ) const
inlinenoexcept

Definition at line 156 of file simd_avx2.h.

156 {
157 const SIMD_8x32 rot1 = this->rotr<6>();
158 const SIMD_8x32 rot2 = this->rotr<11>();
159 const SIMD_8x32 rot3 = this->rotr<25>();
160 return rot1 ^ rot2 ^ rot3;
161 }

References rotr(), and SIMD_8x32().

◆ splat()

BOTAN_FN_ISA_AVX2 SIMD_8x32 Botan::SIMD_8x32::splat ( uint32_t B)
inlinestaticnoexcept

Definition at line 58 of file simd_avx2.h.

58{ return SIMD_8x32(_mm256_set1_epi32(B)); }

References SIMD_8x32(), and SIMD_8x32().

Referenced by operator^=().

◆ store_be()

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::store_be ( uint8_t out[]) const
inlinenoexcept

Definition at line 113 of file simd_avx2.h.

113{ bswap().store_le(out); }
BOTAN_FN_ISA_AVX2 void store_le(uint8_t out[]) const noexcept
Definition simd_avx2.h:84

References bswap(), and store_le().

◆ store_le() [1/2]

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::store_le ( uint32_t out[]) const
inlinenoexcept

Definition at line 87 of file simd_avx2.h.

87{ _mm256_storeu_si256(reinterpret_cast<__m256i*>(out), m_avx2); }

◆ store_le() [2/2]

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::store_le ( uint8_t out[]) const
inlinenoexcept

Definition at line 84 of file simd_avx2.h.

84{ _mm256_storeu_si256(reinterpret_cast<__m256i*>(out), m_avx2); }

Referenced by store_be().

◆ store_le128() [1/2]

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::store_le128 ( uint32_t out1[],
uint32_t out2[] ) const
inlinenoexcept

Definition at line 108 of file simd_avx2.h.

108 {
109 _mm256_storeu2_m128i(reinterpret_cast<__m128i*>(out2), reinterpret_cast<__m128i*>(out1), raw());
110 }

References raw().

◆ store_le128() [2/2]

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::store_le128 ( uint8_t out[]) const
inlinenoexcept

Definition at line 90 of file simd_avx2.h.

90 {
91 _mm_storeu_si128(reinterpret_cast<__m128i*>(out), _mm256_extracti128_si256(raw(), 0));
92 }

References raw().

◆ transpose() [1/2]

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::transpose ( SIMD_8x32 & B0,
SIMD_8x32 & B1,
SIMD_8x32 & B2,
SIMD_8x32 & B3 )
inlinestaticnoexcept

Definition at line 264 of file simd_avx2.h.

264 {
265 const __m256i T0 = _mm256_unpacklo_epi32(B0.m_avx2, B1.m_avx2);
266 const __m256i T1 = _mm256_unpacklo_epi32(B2.m_avx2, B3.m_avx2);
267 const __m256i T2 = _mm256_unpackhi_epi32(B0.m_avx2, B1.m_avx2);
268 const __m256i T3 = _mm256_unpackhi_epi32(B2.m_avx2, B3.m_avx2);
269
270 B0.m_avx2 = _mm256_unpacklo_epi64(T0, T1);
271 B1.m_avx2 = _mm256_unpackhi_epi64(T0, T1);
272 B2.m_avx2 = _mm256_unpacklo_epi64(T2, T3);
273 B3.m_avx2 = _mm256_unpackhi_epi64(T2, T3);
274 }

References SIMD_8x32().

Referenced by transpose().

◆ transpose() [2/2]

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::transpose ( SIMD_8x32 & B0,
SIMD_8x32 & B1,
SIMD_8x32 & B2,
SIMD_8x32 & B3,
SIMD_8x32 & B4,
SIMD_8x32 & B5,
SIMD_8x32 & B6,
SIMD_8x32 & B7 )
inlinestaticnoexcept

Definition at line 277 of file simd_avx2.h.

284 {
285 transpose(B0, B1, B2, B3);
286 transpose(B4, B5, B6, B7);
287
288 swap_tops(B0, B4);
289 swap_tops(B1, B5);
290 swap_tops(B2, B6);
291 swap_tops(B3, B7);
292 }
static BOTAN_FN_ISA_AVX2 void transpose(SIMD_8x32 &B0, SIMD_8x32 &B1, SIMD_8x32 &B2, SIMD_8x32 &B3) noexcept
Definition simd_avx2.h:264

References SIMD_8x32(), and transpose().

◆ zero_registers()

BOTAN_FN_ISA_AVX2 void Botan::SIMD_8x32::zero_registers ( )
inlinestaticnoexcept

Definition at line 320 of file simd_avx2.h.

320{ _mm256_zeroall(); }

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