Botan 3.6.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 17 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 27 of file simd_avx2.h.

28 { m_avx2 = _mm256_setzero_si256(); }

◆ BOTAN_FUNC_ISA() [2/21]

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

Definition at line 30 of file simd_avx2.h.

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

◆ 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 113 of file simd_avx2.h.

113 {
114 const SIMD_8x32 rot1 = this->rotr<2>();
115 const SIMD_8x32 rot2 = this->rotr<13>();
116 const SIMD_8x32 rot3 = this->rotr<22>();
117 return rot1 ^ rot2 ^ rot3;
118 }
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 120 of file simd_avx2.h.

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

References Botan::rotr().

◆ BOTAN_FUNC_ISA() [6/21]

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

Definition at line 155 of file simd_avx2.h.

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

◆ BOTAN_FUNC_ISA() [7/21]

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

Definition at line 127 of file simd_avx2.h.

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

◆ BOTAN_FUNC_ISA() [8/21]

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

Definition at line 134 of file simd_avx2.h.

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

◆ BOTAN_FUNC_ISA() [9/21]

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

Definition at line 141 of file simd_avx2.h.

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

◆ BOTAN_FUNC_ISA() [10/21]

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

Definition at line 148 of file simd_avx2.h.

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

◆ 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 80 of file simd_avx2.h.

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

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [12/21]

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

Definition at line 109 of file simd_avx2.h.

109 {
110 return this->rotl<32 - ROT>();
111 }
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 65 of file simd_avx2.h.

66 { 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 50 of file simd_avx2.h.

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

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [15/21]

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

Definition at line 60 of file simd_avx2.h.

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

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [16/21]

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

Definition at line 55 of file simd_avx2.h.

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

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [17/21]

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

Definition at line 47 of file simd_avx2.h.

48 { 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 76 of file simd_avx2.h.

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

◆ BOTAN_FUNC_ISA() [20/21]

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

Definition at line 68 of file simd_avx2.h.

69 { _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 71 of file simd_avx2.h.

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

◆ 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 37 of file simd_avx2.h.

◆ B2

uint32_t uint32_t Botan::SIMD_8x32::B2

Definition at line 38 of file simd_avx2.h.

◆ B3

uint32_t uint32_t uint32_t Botan::SIMD_8x32::B3

Definition at line 39 of file simd_avx2.h.

◆ B4

uint32_t uint32_t uint32_t uint32_t Botan::SIMD_8x32::B4

Definition at line 40 of file simd_avx2.h.

◆ B5

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

Definition at line 41 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 42 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:38
uint32_t uint32_t uint32_t uint32_t uint32_t uint32_t B6
Definition simd_avx2.h:42
uint32_t uint32_t uint32_t uint32_t uint32_t B5
Definition simd_avx2.h:41
uint32_t uint32_t uint32_t B3
Definition simd_avx2.h:39
uint32_t uint32_t uint32_t uint32_t B4
Definition simd_avx2.h:40

Definition at line 43 of file simd_avx2.h.


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