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

#include <simd_8x32.h>

Public Member Functions

BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 andc (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 bswap () const noexcept
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 operator& (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void operator&= (const SIMD_8x32 &other)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 operator+ (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void operator+= (const SIMD_8x32 &other)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 operator- (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void operator-= (const SIMD_8x32 &other)
SIMD_8x32 & operator= (const SIMD_8x32 &other)=default
SIMD_8x32 & operator= (SIMD_8x32 &&other)=default
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 operator^ (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void operator^= (const SIMD_8x32 &other)
BOTAN_FN_ISA_SIMD_8X32 void operator^= (uint32_t other)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 operator| (const SIMD_8x32 &other) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void operator|= (const SIMD_8x32 &other)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 operator~ () const noexcept
__m256i BOTAN_FN_ISA_SIMD_8X32 raw () const noexcept
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 rev_words () const noexcept
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 reverse () const noexcept
template<size_t ROT>
requires (ROT > 0 && ROT < 32)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 rotl () const noexcept
template<size_t ROT>
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 rotr () const noexcept
template<size_t I>
requires (I > 0 && I <= 3)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 shift_elems_left () const noexcept
template<size_t I>
requires (I > 0 && I <= 3)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 shift_elems_right () const noexcept
template<int SHIFT>
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 shl () const noexcept
template<int SHIFT>
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 shr () const noexcept
SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 sigma0 () const noexcept
SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 sigma1 () const noexcept
BOTAN_FN_ISA_SIMD_8X32 BOTAN_FORCE_INLINE SIMD_8x32 () noexcept
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 (__m256i x) noexcept
 SIMD_8x32 (const SIMD_8x32 &other)=default
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 (const uint32_t B[8]) noexcept
 SIMD_8x32 (SIMD_8x32 &&other)=default
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 (uint32_t B0, uint32_t B1, uint32_t B2, uint32_t B3) noexcept
BOTAN_FN_ISA_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) noexcept
BOTAN_FN_ISA_SIMD_8X32 void store_be (uint8_t out[]) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void store_le (uint32_t out[]) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void store_le (uint8_t out[]) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void store_le128 (uint32_t out1[], uint32_t out2[]) const noexcept
BOTAN_FN_ISA_SIMD_8X32 void store_le128 (uint8_t out[]) const noexcept
SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 swap_halves () const noexcept
SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 unsigned_lt (const SIMD_8x32 &other) const noexcept
template<uint8_t POLY>
SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 xtime () const noexcept
 ~SIMD_8x32 ()=default

Static Public Member Functions

static SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 alignr8 (const SIMD_8x32 &a, const SIMD_8x32 &b)
static SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 byte_shuffle (const SIMD_8x32 &tbl, const SIMD_8x32 &idx)
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 choose (const SIMD_8x32 &mask, const SIMD_8x32 &a, const SIMD_8x32 &b) noexcept
template<size_t Stride>
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_be (const uint8_t *const *ptrs, size_t i, size_t n, size_t offset=0)
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_be (const uint8_t *in) noexcept
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_be128 (const uint8_t in1[], const uint8_t in2[]) noexcept
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_le (const uint32_t *in) noexcept
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_le (const uint8_t *in) noexcept
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_le128 (const uint32_t *in) noexcept
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_le128 (const uint32_t in1[], const uint32_t in2[]) noexcept
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_le128 (const uint8_t *in) noexcept
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 majority (const SIMD_8x32 &x, const SIMD_8x32 &y, const SIMD_8x32 &z) noexcept
static SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 masked_byte_shuffle (const SIMD_8x32 &tbl, const SIMD_8x32 &idx)
static BOTAN_FN_ISA_SIMD_8X32 void reset_registers () noexcept
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 splat (uint32_t B) noexcept
static BOTAN_FN_ISA_SIMD_8X32 void transpose (SIMD_8x32 &B0, SIMD_8x32 &B1, SIMD_8x32 &B2, SIMD_8x32 &B3) noexcept
static BOTAN_FN_ISA_SIMD_8X32 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_SIMD_8X32 void zero_registers () noexcept

Detailed Description

Definition at line 19 of file simd_8x32.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_SIMD_8X32 BOTAN_FORCE_INLINE Botan::SIMD_8x32::SIMD_8x32 ( )
inlinenoexcept

◆ SIMD_8x32() [4/7]

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

Definition at line 33 of file simd_8x32.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_SIMD_8X32 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_8x32.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_SIMD_8X32 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_8x32.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_SIMD_8X32 Botan::SIMD_8x32::SIMD_8x32 ( __m256i x)
inlineexplicitnoexcept

Definition at line 393 of file simd_8x32.h.

393: m_avx2(x) {}

Member Function Documentation

◆ alignr8()

SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 Botan::SIMD_8x32::alignr8 ( const SIMD_8x32 & a,
const SIMD_8x32 & b )
inlinestatic

Definition at line 286 of file simd_8x32.h.

286 {
287 return SIMD_8x32(_mm256_alignr_epi8(a.raw(), b.raw(), 8));
288 }
BOTAN_FN_ISA_SIMD_8X32 BOTAN_FORCE_INLINE SIMD_8x32() noexcept
Definition simd_8x32.h:30

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

◆ andc()

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

Definition at line 243 of file simd_8x32.h.

243 {
244 return SIMD_8x32(_mm256_andnot_si256(m_avx2, other.m_avx2));
245 }

References SIMD_8x32(), and SIMD_8x32().

◆ bswap()

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

Definition at line 248 of file simd_8x32.h.

248 {
249 alignas(32) const uint8_t BSWAP_TBL[32] = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12,
250 19, 18, 17, 16, 23, 22, 21, 20, 27, 26, 25, 24, 31, 30, 29, 28};
251
252 const __m256i bswap = _mm256_load_si256(reinterpret_cast<const __m256i*>(BSWAP_TBL));
253
254 const __m256i output = _mm256_shuffle_epi8(m_avx2, bswap);
255
256 return SIMD_8x32(output);
257 }
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 bswap() const noexcept
Definition simd_8x32.h:248

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

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

◆ byte_shuffle()

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

Definition at line 351 of file simd_8x32.h.

351 {
352 return SIMD_8x32(_mm256_shuffle_epi8(tbl.raw(), idx.raw()));
353 }

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

◆ choose()

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

Definition at line 334 of file simd_8x32.h.

334 {
335#if defined(__AVX512VL__)
336 return SIMD_8x32(_mm256_ternarylogic_epi32(mask.raw(), a.raw(), b.raw(), 0xca));
337#else
338 return (mask & a) ^ mask.andc(b);
339#endif
340 }

References SIMD_8x32(), and SIMD_8x32().

Referenced by majority().

◆ load_be() [1/2]

template<size_t Stride>
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 Botan::SIMD_8x32::load_be ( const uint8_t *const * ptrs,
size_t i,
size_t n,
size_t offset = 0 )
inlinestatic

Load in big endian order from ptrs[i] + Stride * n + offset, gathering lane i's n'th block out of a set of per lane buffers

Definition at line 89 of file simd_8x32.h.

89 {
90 return load_be(ptrs[i] + Stride * n + offset);
91 }
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 load_be(const uint8_t *in) noexcept
Definition simd_8x32.h:81

References load_be().

◆ load_be() [2/2]

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

Definition at line 81 of file simd_8x32.h.

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

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

Referenced by load_be(), and Botan::sha2_32_mb_compress_x8().

◆ load_be128()

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

Definition at line 111 of file simd_8x32.h.

111 {
112 return SIMD_8x32(
113 _mm256_loadu2_m128i(reinterpret_cast<const __m128i*>(in2), reinterpret_cast<const __m128i*>(in1)))
114 .bswap();
115 }

References SIMD_8x32(), and SIMD_8x32().

◆ load_le() [1/2]

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

Definition at line 66 of file simd_8x32.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_SIMD_8X32 SIMD_8x32 Botan::SIMD_8x32::load_le ( const uint8_t * in)
inlinestaticnoexcept

Definition at line 61 of file simd_8x32.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(), Botan::sha2_32_mb_compress_x8(), and Botan::sha2_32_mb_extract_x8().

◆ load_le128() [1/3]

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

Definition at line 76 of file simd_8x32.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_SIMD_8X32 SIMD_8x32 Botan::SIMD_8x32::load_le128 ( const uint32_t in1[],
const uint32_t in2[] )
inlinestaticnoexcept

Definition at line 105 of file simd_8x32.h.

105 {
106 return SIMD_8x32(
107 _mm256_loadu2_m128i(reinterpret_cast<const __m128i*>(in2), reinterpret_cast<const __m128i*>(in1)));
108 }

References SIMD_8x32(), and SIMD_8x32().

◆ load_le128() [3/3]

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

Definition at line 71 of file simd_8x32.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_SIMD_8X32 SIMD_8x32 Botan::SIMD_8x32::majority ( const SIMD_8x32 & x,
const SIMD_8x32 & y,
const SIMD_8x32 & z )
inlinestaticnoexcept

Definition at line 343 of file simd_8x32.h.

343 {
344#if defined(__AVX512VL__)
345 return SIMD_8x32(_mm256_ternarylogic_epi32(x.raw(), y.raw(), z.raw(), 0xe8));
346#else
347 return SIMD_8x32::choose(x ^ y, z, y);
348#endif
349 }
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 choose(const SIMD_8x32 &mask, const SIMD_8x32 &a, const SIMD_8x32 &b) noexcept
Definition simd_8x32.h:334

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

◆ masked_byte_shuffle()

SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 Botan::SIMD_8x32::masked_byte_shuffle ( const SIMD_8x32 & tbl,
const SIMD_8x32 & idx )
inlinestatic

Byte shuffle with masking, performed within each half

If the top bit of an index byte is set the output byte is zero, otherwise the low 4 bits select a byte from the same half of tbl.

Definition at line 361 of file simd_8x32.h.

361 {
362 return SIMD_8x32(_mm256_shuffle_epi8(tbl.raw(), idx.raw()));
363 }

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

◆ operator&()

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

Definition at line 202 of file simd_8x32.h.

202 {
203 SIMD_8x32 retval(*this);
204 retval &= other;
205 return retval;
206 }
SIMD_8x32(const SIMD_8x32 &other)=default

References SIMD_8x32().

◆ operator&=()

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

Definition at line 224 of file simd_8x32.h.

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

References SIMD_8x32().

◆ operator+()

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

Definition at line 174 of file simd_8x32.h.

174 {
175 SIMD_8x32 retval(*this);
176 retval += other;
177 return retval;
178 }

References SIMD_8x32().

◆ operator+=()

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

Definition at line 209 of file simd_8x32.h.

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

References SIMD_8x32().

◆ operator-()

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

Definition at line 181 of file simd_8x32.h.

181 {
182 SIMD_8x32 retval(*this);
183 retval -= other;
184 return retval;
185 }

References SIMD_8x32().

◆ operator-=()

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

Definition at line 212 of file simd_8x32.h.

212{ 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_SIMD_8X32 SIMD_8x32 Botan::SIMD_8x32::operator^ ( const SIMD_8x32 & other) const
inlinenoexcept

Definition at line 188 of file simd_8x32.h.

188 {
189 SIMD_8x32 retval(*this);
190 retval ^= other;
191 return retval;
192 }

References SIMD_8x32().

◆ operator^=() [1/2]

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

Definition at line 215 of file simd_8x32.h.

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

References SIMD_8x32().

◆ operator^=() [2/2]

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

Definition at line 218 of file simd_8x32.h.

218{ *this ^= SIMD_8x32::splat(other); }
static BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 splat(uint32_t B) noexcept
Definition simd_8x32.h:58

References splat().

◆ operator|()

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

Definition at line 195 of file simd_8x32.h.

195 {
196 SIMD_8x32 retval(*this);
197 retval |= other;
198 return retval;
199 }

References SIMD_8x32().

◆ operator|=()

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

Definition at line 221 of file simd_8x32.h.

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

References SIMD_8x32().

◆ operator~()

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

Definition at line 237 of file simd_8x32.h.

237 {
238 return SIMD_8x32(_mm256_xor_si256(m_avx2, _mm256_set1_epi32(0xFFFFFFFF)));
239 }

References SIMD_8x32(), and SIMD_8x32().

◆ raw()

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

◆ reset_registers()

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

Definition at line 385 of file simd_8x32.h.

385{ _mm256_zeroupper(); }

◆ rev_words()

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

Definition at line 271 of file simd_8x32.h.

271{ return SIMD_8x32(_mm256_shuffle_epi32(raw(), 0b00011011)); }
__m256i BOTAN_FN_ISA_SIMD_8X32 raw() const noexcept
Definition simd_8x32.h:390

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

◆ reverse()

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

Definition at line 261 of file simd_8x32.h.

261 {
262 alignas(32) const uint8_t REV_TBL[32] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
263 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
264
265 const __m256i bswap = _mm256_load_si256(reinterpret_cast<const __m256i*>(REV_TBL));
266 const __m256i output = _mm256_shuffle_epi8(m_avx2, bswap);
267 return SIMD_8x32(output);
268 }

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

◆ rotl()

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

Definition at line 126 of file simd_8x32.h.

128 {
129#if defined(__AVX512VL__)
130 return SIMD_8x32(_mm256_rol_epi32(m_avx2, ROT));
131#else
132 if constexpr(ROT == 8) {
133 const __m256i shuf_rotl_8 =
134 _mm256_set_epi64x(0x0e0d0c0f'0a09080b, 0x06050407'02010003, 0x0e0d0c0f'0a09080b, 0x06050407'02010003);
135
136 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_8));
137 } else if constexpr(ROT == 16) {
138 const __m256i shuf_rotl_16 =
139 _mm256_set_epi64x(0x0d0c0f0e'09080b0a, 0x05040706'01000302, 0x0d0c0f0e'09080b0a, 0x05040706'01000302);
140
141 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_16));
142 } else if constexpr(ROT == 24) {
143 const __m256i shuf_rotl_24 =
144 _mm256_set_epi64x(0x0c0f0e0d'080b0a09, 0x04070605'00030201, 0x0c0f0e0d'080b0a09, 0x04070605'00030201);
145
146 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_24));
147 } else {
148 return SIMD_8x32(_mm256_xor_si256(_mm256_slli_epi32(m_avx2, static_cast<int>(ROT)),
149 _mm256_srli_epi32(m_avx2, static_cast<int>(32 - ROT))));
150 }
151#endif
152 }

References SIMD_8x32(), and SIMD_8x32().

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

◆ rotr()

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

Definition at line 155 of file simd_8x32.h.

155 {
156 return this->rotl<32 - ROT>();
157 }
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 rotl() const noexcept
Definition simd_8x32.h:126

References rotl(), and SIMD_8x32().

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

◆ shift_elems_left()

template<size_t I>
requires (I > 0 && I <= 3)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 Botan::SIMD_8x32::shift_elems_left ( ) const
inlinenoexcept

Definition at line 291 of file simd_8x32.h.

293 {
294 return SIMD_8x32(_mm256_slli_si256(raw(), 4 * I));
295 }

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

◆ shift_elems_right()

template<size_t I>
requires (I > 0 && I <= 3)
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 Botan::SIMD_8x32::shift_elems_right ( ) const
inlinenoexcept

Definition at line 298 of file simd_8x32.h.

300 {
301 return SIMD_8x32(_mm256_srli_si256(raw(), 4 * I));
302 }

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

◆ shl()

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

Definition at line 227 of file simd_8x32.h.

227 {
228 return SIMD_8x32(_mm256_slli_epi32(m_avx2, SHIFT));
229 }

References SIMD_8x32(), and SIMD_8x32().

Referenced by Botan::shl().

◆ shr()

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

Definition at line 232 of file simd_8x32.h.

232 {
233 return SIMD_8x32(_mm256_srli_epi32(m_avx2, SHIFT));
234 }

References SIMD_8x32(), and SIMD_8x32().

◆ sigma0()

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

Definition at line 159 of file simd_8x32.h.

159 {
160 const SIMD_8x32 r1 = this->rotr<2>();
161 const SIMD_8x32 r2 = this->rotr<13>();
162 const SIMD_8x32 r3 = this->rotr<22>();
163 return r1 ^ r2 ^ r3;
164 }
BOTAN_FN_ISA_SIMD_8X32 SIMD_8x32 rotr() const noexcept
Definition simd_8x32.h:155

References rotr(), and SIMD_8x32().

◆ sigma1()

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

Definition at line 166 of file simd_8x32.h.

166 {
167 const SIMD_8x32 r1 = this->rotr<6>();
168 const SIMD_8x32 r2 = this->rotr<11>();
169 const SIMD_8x32 r3 = this->rotr<25>();
170 return r1 ^ r2 ^ r3;
171 }

References rotr(), and SIMD_8x32().

◆ splat()

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

Definition at line 58 of file simd_8x32.h.

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

References SIMD_8x32(), and SIMD_8x32().

Referenced by operator^=().

◆ store_be()

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

Definition at line 123 of file simd_8x32.h.

123{ bswap().store_le(out); }
BOTAN_FN_ISA_SIMD_8X32 void store_le(uint8_t out[]) const noexcept
Definition simd_8x32.h:94

References bswap(), and store_le().

Referenced by Botan::sha2_32_mb_extract_x8().

◆ store_le() [1/2]

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

Definition at line 97 of file simd_8x32.h.

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

◆ store_le() [2/2]

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

Definition at line 94 of file simd_8x32.h.

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

Referenced by Botan::sha2_32_mb_compress_x8(), and store_be().

◆ store_le128() [1/2]

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

Definition at line 118 of file simd_8x32.h.

118 {
119 _mm256_storeu2_m128i(reinterpret_cast<__m128i*>(out2), reinterpret_cast<__m128i*>(out1), raw());
120 }

References raw().

◆ store_le128() [2/2]

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

Definition at line 100 of file simd_8x32.h.

100 {
101 _mm_storeu_si128(reinterpret_cast<__m128i*>(out), _mm256_extracti128_si256(raw(), 0));
102 }

References raw().

◆ swap_halves()

SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 Botan::SIMD_8x32::swap_halves ( ) const
inlinenoexcept

Swap the two 128-bit halves of the register

Definition at line 368 of file simd_8x32.h.

368 {
369 return SIMD_8x32(_mm256_permute2x128_si256(raw(), raw(), 0x01));
370 }

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

◆ transpose() [1/2]

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

Definition at line 274 of file simd_8x32.h.

274 {
275 const __m256i T0 = _mm256_unpacklo_epi32(B0.m_avx2, B1.m_avx2);
276 const __m256i T1 = _mm256_unpacklo_epi32(B2.m_avx2, B3.m_avx2);
277 const __m256i T2 = _mm256_unpackhi_epi32(B0.m_avx2, B1.m_avx2);
278 const __m256i T3 = _mm256_unpackhi_epi32(B2.m_avx2, B3.m_avx2);
279
280 B0.m_avx2 = _mm256_unpacklo_epi64(T0, T1);
281 B1.m_avx2 = _mm256_unpackhi_epi64(T0, T1);
282 B2.m_avx2 = _mm256_unpacklo_epi64(T2, T3);
283 B3.m_avx2 = _mm256_unpackhi_epi64(T2, T3);
284 }

References SIMD_8x32().

Referenced by Botan::sha2_32_mb_compress_x8(), Botan::sha2_32_mb_extract_x8(), and transpose().

◆ transpose() [2/2]

BOTAN_FN_ISA_SIMD_8X32 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 305 of file simd_8x32.h.

312 {
313 transpose(B0, B1, B2, B3);
314 transpose(B4, B5, B6, B7);
315
316 swap_tops(B0, B4);
317 swap_tops(B1, B5);
318 swap_tops(B2, B6);
319 swap_tops(B3, B7);
320 }
static BOTAN_FN_ISA_SIMD_8X32 void transpose(SIMD_8x32 &B0, SIMD_8x32 &B1, SIMD_8x32 &B2, SIMD_8x32 &B3) noexcept
Definition simd_8x32.h:274

References SIMD_8x32(), and transpose().

◆ unsigned_lt()

SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 Botan::SIMD_8x32::unsigned_lt ( const SIMD_8x32 & other) const
inlinenoexcept

Unsigned lane comparison; returns a mask with all bits set in each 32-bit lane that is (unsigned) less than the corresponding lane of other, and all bits cleared otherwise.

Definition at line 327 of file simd_8x32.h.

327 {
328 // No unsigned comparison before AVX-512; bias into the signed domain
329 const __m256i bias = _mm256_set1_epi32(static_cast<int32_t>(0x80000000));
330 return SIMD_8x32(_mm256_cmpgt_epi32(_mm256_xor_si256(other.raw(), bias), _mm256_xor_si256(raw(), bias)));
331 }

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

◆ xtime()

template<uint8_t POLY>
SIMD_8x32 BOTAN_FN_ISA_SIMD_8X32 Botan::SIMD_8x32::xtime ( ) const
inlinenoexcept

Multiply each byte by x in GF(2^8) using the reduction polynomial given by POLY (which omits the implicit x^8 term)

Definition at line 377 of file simd_8x32.h.

377 {
378 const auto poly = _mm256_set1_epi8(static_cast<char>(POLY));
379 const auto shifted = _mm256_add_epi8(raw(), raw());
380 // blendv selects using the top bit of each byte of the mask argument
381 return SIMD_8x32(_mm256_blendv_epi8(shifted, _mm256_xor_si256(shifted, poly), raw()));
382 }

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

◆ zero_registers()

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

Definition at line 388 of file simd_8x32.h.

388{ _mm256_zeroall(); }

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