Botan 3.4.0
Crypto and TLS for C&
Public Member Functions | Public Attributes | List of all members
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 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
 
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/18]

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/18]

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/18]

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

◆ BOTAN_FUNC_ISA() [4/18]

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

Definition at line 93 of file simd_avx2.h.

93 {
94 const SIMD_8x32 rot1 = this->rotr<2>();
95 const SIMD_8x32 rot2 = this->rotr<13>();
96 const SIMD_8x32 rot3 = this->rotr<22>();
97 return rot1 ^ rot2 ^ rot3;
98 }
SIMD_8x32(const SIMD_8x32 &other)=default

◆ BOTAN_FUNC_ISA() [5/18]

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

Definition at line 100 of file simd_avx2.h.

100 {
101 const SIMD_8x32 rot1 = this->rotr<6>();
102 const SIMD_8x32 rot2 = this->rotr<11>();
103 const SIMD_8x32 rot3 = this->rotr<25>();
104 return rot1 ^ rot2 ^ rot3;
105 }

◆ BOTAN_FUNC_ISA() [6/18]

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() [7/18]

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

Definition at line 107 of file simd_avx2.h.

108 {
109 SIMD_8x32 retval(*this);
110 retval += other;
111 return retval;
112 }

◆ BOTAN_FUNC_ISA() [8/18]

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

Definition at line 114 of file simd_avx2.h.

115 {
116 SIMD_8x32 retval(*this);
117 retval -= other;
118 return retval;
119 }

◆ BOTAN_FUNC_ISA() [9/18]

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

Definition at line 121 of file simd_avx2.h.

122 {
123 SIMD_8x32 retval(*this);
124 retval ^= other;
125 return retval;
126 }

◆ BOTAN_FUNC_ISA() [10/18]

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() [11/18]

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

Definition at line 65 of file simd_avx2.h.

67 {
68#if defined(__AVX512VL__)
69 return SIMD_8x32(_mm256_rol_epi32(m_avx2, ROT));
70#else
71 if constexpr(ROT == 8) {
72 const __m256i shuf_rotl_8 =
73 _mm256_set_epi64x(0x0e0d0c0f'0a09080b, 0x06050407'02010003, 0x0e0d0c0f'0a09080b, 0x06050407'02010003);
74
75 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_8));
76 } else if constexpr(ROT == 16) {
77 const __m256i shuf_rotl_16 =
78 _mm256_set_epi64x(0x0d0c0f0e'09080b0a, 0x05040706'01000302, 0x0d0c0f0e'09080b0a, 0x05040706'01000302);
79
80 return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_16));
81 } else {
82 return SIMD_8x32(_mm256_or_si256(_mm256_slli_epi32(m_avx2, static_cast<int>(ROT)),
83 _mm256_srli_epi32(m_avx2, static_cast<int>(32 - ROT))));
84 }
85#endif
86 }

References SIMD_8x32().

◆ BOTAN_FUNC_ISA() [12/18]

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

Definition at line 89 of file simd_avx2.h.

89 {
90 return this->rotl<32 - ROT>();
91 }
constexpr T rotl(T input)
Definition rotate.h:21

References Botan::rotl().

◆ BOTAN_FUNC_ISA() [13/18]

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

Definition at line 55 of file simd_avx2.h.

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

References Botan::load_le().

◆ BOTAN_FUNC_ISA() [14/18]

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/18]

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() [16/18]

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

◆ BOTAN_FUNC_ISA() [17/18]

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

Definition at line 61 of file simd_avx2.h.

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

◆ BOTAN_FUNC_ISA() [18/18]

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

Definition at line 58 of file simd_avx2.h.

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

◆ 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: