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

#include <simd_avx2.h>

Public Member Functions

 BOTAN_FUNC_ISA ("avx2") BOTAN_FORCE_INLINE SIMD_8x32() noexcept
 
 BOTAN_FUNC_ISA ("avx2") explicit SIMD_8x32(const uint32_t B[8]) noexcept
 
 BOTAN_FUNC_ISA ("avx2") explicit SIMD_8x32(uint32_t B0
 
SIMD_8x32 BOTAN_FUNC_ISA ("avx2") sigma0() const noexcept
 
SIMD_8x32 BOTAN_FUNC_ISA ("avx2") sigma1() const noexcept
 
 BOTAN_FUNC_ISA ("avx2") SIMD_8x32 operator&(const SIMD_8x32 &other) const noexcept
 
 BOTAN_FUNC_ISA ("avx2") SIMD_8x32 operator+(const SIMD_8x32 &other) const noexcept
 
 BOTAN_FUNC_ISA ("avx2") SIMD_8x32 operator-(const SIMD_8x32 &other) const noexcept
 
 BOTAN_FUNC_ISA ("avx2") SIMD_8x32 operator^(const SIMD_8x32 &other) const noexcept
 
 BOTAN_FUNC_ISA ("avx2") SIMD_8x32 operator|(const SIMD_8x32 &other) const noexcept
 
template<size_t ROT>
requires (ROT > 0 && ROT < 32)
 BOTAN_FUNC_ISA ("avx2") SIMD_8x32 rotl() const noexcept
 
template<size_t ROT>
 BOTAN_FUNC_ISA ("avx2") SIMD_8x32 rotr() const noexcept
 
 BOTAN_FUNC_ISA ("avx2") static SIMD_8x32 load_be(const uint8_t *in) noexcept
 
 BOTAN_FUNC_ISA ("avx2") static SIMD_8x32 load_le(const uint8_t *in) noexcept
 
 BOTAN_FUNC_ISA ("avx2") static SIMD_8x32 load_le128(const uint32_t *in) noexcept
 
 BOTAN_FUNC_ISA ("avx2") static SIMD_8x32 load_le128(const uint8_t *in) noexcept
 
 BOTAN_FUNC_ISA ("avx2") static SIMD_8x32 splat(uint32_t B) noexcept
 
 BOTAN_FUNC_ISA ("avx2") void operator+
 
 BOTAN_FUNC_ISA ("avx2") void store_be(uint8_t out[]) const noexcept
 
 BOTAN_FUNC_ISA ("avx2") void store_le(uint8_t out[]) const noexcept
 
 BOTAN_FUNC_ISA ("avx2") void store_le128(uint8_t out[]) const noexcept
 
SIMD_8x32operator= (const SIMD_8x32 &other)=default
 
SIMD_8x32operator= (SIMD_8x32 &&other)=default
 
 SIMD_8x32 (const SIMD_8x32 &other)=default
 
 SIMD_8x32 (SIMD_8x32 &&other)=default
 
 ~SIMD_8x32 ()=default
 

Public Attributes

uint32_t B1
 
uint32_t uint32_t B2
 
uint32_t uint32_t uint32_t B3
 
uint32_t uint32_t uint32_t uint32_t B4
 
uint32_t uint32_t uint32_t uint32_t uint32_t B5
 
uint32_t uint32_t uint32_t uint32_t uint32_t uint32_t B6
 
uint32_t uint32_t uint32_t uint32_t uint32_t uint32_t uint32_t B7 noexcept
 

Detailed Description

Definition at line 18 of file simd_avx2.h.

Constructor & Destructor Documentation

◆ SIMD_8x32() [1/2]

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

◆ SIMD_8x32() [2/2]

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

◆ ~SIMD_8x32()

Botan::SIMD_8x32::~SIMD_8x32 ( )
default

Member Function Documentation

◆ BOTAN_FUNC_ISA() [1/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" )
inlinenoexcept

Definition at line 28 of file simd_avx2.h.

29 { m_avx2 = _mm256_setzero_si256(); }

◆ BOTAN_FUNC_ISA() [2/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 31 of file simd_avx2.h.

32 {
33 m_avx2 = _mm256_loadu_si256(reinterpret_cast<const __m256i*>(B));
34 }

◆ BOTAN_FUNC_ISA() [3/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" )

◆ BOTAN_FUNC_ISA() [4/21]

SIMD_8x32 Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 114 of file simd_avx2.h.

114 {
115 const SIMD_8x32 rot1 = this->rotr<2>();
116 const SIMD_8x32 rot2 = this->rotr<13>();
117 const SIMD_8x32 rot3 = this->rotr<22>();
118 return rot1 ^ rot2 ^ rot3;
119 }
SIMD_8x32(const SIMD_8x32 &other)=default
constexpr T rotr(T input)
Definition rotate.h:33

References Botan::rotr().

◆ BOTAN_FUNC_ISA() [5/21]

SIMD_8x32 Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 121 of file simd_avx2.h.

121 {
122 const SIMD_8x32 rot1 = this->rotr<6>();
123 const SIMD_8x32 rot2 = this->rotr<11>();
124 const SIMD_8x32 rot3 = this->rotr<25>();
125 return rot1 ^ rot2 ^ rot3;
126 }

References Botan::rotr().

◆ BOTAN_FUNC_ISA() [6/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const &
inlinenoexcept

Definition at line 156 of file simd_avx2.h.

157 {
158 SIMD_8x32 retval(*this);
159 retval &= other;
160 return retval;
161 }

◆ BOTAN_FUNC_ISA() [7/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const &
inlinenoexcept

Definition at line 128 of file simd_avx2.h.

129 {
130 SIMD_8x32 retval(*this);
131 retval += other;
132 return retval;
133 }

◆ BOTAN_FUNC_ISA() [8/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const &
inlinenoexcept

Definition at line 135 of file simd_avx2.h.

136 {
137 SIMD_8x32 retval(*this);
138 retval -= other;
139 return retval;
140 }

◆ BOTAN_FUNC_ISA() [9/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const &
inlinenoexcept

Definition at line 142 of file simd_avx2.h.

143 {
144 SIMD_8x32 retval(*this);
145 retval ^= other;
146 return retval;
147 }

◆ BOTAN_FUNC_ISA() [10/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const &
inlinenoexcept

Definition at line 149 of file simd_avx2.h.

150 {
151 SIMD_8x32 retval(*this);
152 retval |= other;
153 return retval;
154 }

◆ BOTAN_FUNC_ISA() [11/21]

template<size_t ROT>
requires (ROT > 0 && ROT < 32)
Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 81 of file simd_avx2.h.

83 {
84#if defined(__AVX512VL__)
85 return SIMD_8x32(_mm256_rol_epi32(m_avx2, ROT));
86#else
87 if constexpr(ROT == 8) {
88 const __m256i shuf_rotl_8 =
89 _mm256_set_epi64x(0x0e0d0c0f'0a09080b, 0x06050407'02010003, 0x0e0d0c0f'0a09080b, 0x06050407'02010003);
90
91 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_8));
92 } else if constexpr(ROT == 16) {
93 const __m256i shuf_rotl_16 =
94 _mm256_set_epi64x(0x0d0c0f0e'09080b0a, 0x05040706'01000302, 0x0d0c0f0e'09080b0a, 0x05040706'01000302);
95
96 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_16));
97 } else if constexpr(ROT == 24) {
98 const __m256i shuf_rotl_24 =
99 _mm256_set_epi64x(0x0c0f0e0d'080b0a09, 0x04070605'00030201, 0x0c0f0e0d'080b0a09, 0x04070605'00030201);
100
101 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_24));
102 } else {
103 return SIMD_8x32(_mm256_or_si256(_mm256_slli_epi32(m_avx2, static_cast<int>(ROT)),
104 _mm256_srli_epi32(m_avx2, static_cast<int>(32 - ROT))));
105 }
106#endif
107 }

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [12/21]

template<size_t ROT>
Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 110 of file simd_avx2.h.

110 {
111 return this->rotl<32 - ROT>();
112 }
constexpr T rotl(T input)
Definition rotate.h:21

References Botan::rotl().

◆ BOTAN_FUNC_ISA() [13/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 66 of file simd_avx2.h.

67 { return load_le(in).bswap(); }
constexpr auto load_le(ParamTs &&... params)
Definition loadstor.h:521

References Botan::load_le().

◆ BOTAN_FUNC_ISA() [14/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 51 of file simd_avx2.h.

52 {
53 return SIMD_8x32(_mm256_loadu_si256(reinterpret_cast<const __m256i*>(in)));
54 }

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [15/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 61 of file simd_avx2.h.

62 {
63 return SIMD_8x32(_mm256_broadcastsi128_si256(_mm_loadu_si128(reinterpret_cast<const __m128i*>(in))));
64 }

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [16/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 56 of file simd_avx2.h.

57 {
58 return SIMD_8x32(_mm256_broadcastsi128_si256(_mm_loadu_si128(reinterpret_cast<const __m128i*>(in))));
59 }

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [17/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" )
inlinenoexcept

Definition at line 48 of file simd_avx2.h.

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

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [18/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" )

◆ BOTAN_FUNC_ISA() [19/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 77 of file simd_avx2.h.

78 { bswap().store_le(out); }

◆ BOTAN_FUNC_ISA() [20/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 69 of file simd_avx2.h.

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

◆ BOTAN_FUNC_ISA() [21/21]

Botan::SIMD_8x32::BOTAN_FUNC_ISA ( "avx2" ) const
inlinenoexcept

Definition at line 72 of file simd_avx2.h.

73 {
74 _mm_storeu_si128(reinterpret_cast<__m128i*>(out), _mm256_extracti128_si256(raw(), 0));
75 }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Member Data Documentation

◆ B1

uint32_t Botan::SIMD_8x32::B1

Definition at line 38 of file simd_avx2.h.

◆ B2

uint32_t uint32_t Botan::SIMD_8x32::B2

Definition at line 39 of file simd_avx2.h.

◆ B3

uint32_t uint32_t uint32_t Botan::SIMD_8x32::B3

Definition at line 40 of file simd_avx2.h.

◆ B4

uint32_t uint32_t uint32_t uint32_t Botan::SIMD_8x32::B4

Definition at line 41 of file simd_avx2.h.

◆ B5

uint32_t uint32_t uint32_t uint32_t uint32_t Botan::SIMD_8x32::B5

Definition at line 42 of file simd_avx2.h.

◆ B6

uint32_t uint32_t uint32_t uint32_t uint32_t uint32_t Botan::SIMD_8x32::B6

Definition at line 43 of file simd_avx2.h.

◆ noexcept

uint32_t uint32_t uint32_t uint32_t uint32_t uint32_t uint32_t B7 Botan::SIMD_8x32::noexcept
Initial value:
{
m_avx2 = _mm256_set_epi32(B7, B6, B5, B4, B3, B2, B1, B0)
uint32_t uint32_t B2
Definition simd_avx2.h:39
uint32_t uint32_t uint32_t uint32_t uint32_t uint32_t B6
Definition simd_avx2.h:43
uint32_t uint32_t uint32_t uint32_t uint32_t B5
Definition simd_avx2.h:42
uint32_t uint32_t uint32_t B3
Definition simd_avx2.h:40
uint32_t uint32_t uint32_t uint32_t B4
Definition simd_avx2.h:41

Definition at line 44 of file simd_avx2.h.


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