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

#include <simd_4x64.h>

Public Member Functions

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 bswap () const
SIMD_4x64 operator+ (const SIMD_4x64 &other) const
BOTAN_FN_ISA_SIMD_4X64 void operator+= (const SIMD_4x64 &other)
SIMD_4x64operator= (const SIMD_4x64 &other)=default
SIMD_4x64operator= (SIMD_4x64 &&other)=default
SIMD_4x64 operator^ (const SIMD_4x64 &other) const
BOTAN_FN_ISA_SIMD_4X64 void operator^= (const SIMD_4x64 &other)
template<size_t ROT>
SIMD_4x64 rotl () const
template<size_t ROT>
requires (ROT > 0 && ROT < 64)
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 rotr () const
template<int SHIFT>
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 shr () const noexcept
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 ()
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 (__m256i x)
 SIMD_4x64 (const SIMD_4x64 &other)=default
 SIMD_4x64 (SIMD_4x64 &&other)=default
void store_le (uint64_t out[4]) const
BOTAN_FN_ISA_SIMD_4X64 void store_le (uint8_t out[]) const
BOTAN_FN_ISA_SIMD_4X64 void store_le2 (void *outh, void *outl)
 ~SIMD_4x64 ()=default

Static Public Member Functions

static SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 alignr8 (const SIMD_4x64 &a, const SIMD_4x64 &b)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_be (const void *in)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_be2 (const void *inl, const void *inh)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_le (const void *in)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_le2 (const void *inl, const void *inh)
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 mul2_32 (SIMD_4x64 x, SIMD_4x64 y)
template<uint8_t CTRL>
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 permute_4x64 (SIMD_4x64 x)
static void twist (SIMD_4x64 &B, SIMD_4x64 &C, SIMD_4x64 &D)
static void untwist (SIMD_4x64 &B, SIMD_4x64 &C, SIMD_4x64 &D)

Detailed Description

Definition at line 23 of file simd_4x64.h.

Constructor & Destructor Documentation

◆ SIMD_4x64() [1/4]

◆ SIMD_4x64() [2/4]

Botan::SIMD_4x64::SIMD_4x64 ( SIMD_4x64 && other)
default

References SIMD_4x64().

◆ ~SIMD_4x64()

Botan::SIMD_4x64::~SIMD_4x64 ( )
default

◆ SIMD_4x64() [3/4]

BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::SIMD_4x64 ( )
inline

Definition at line 34 of file simd_4x64.h.

34: m_simd(_mm256_setzero_si256()) {}

Referenced by alignr8(), bswap(), load_le(), load_le2(), mul2_32(), permute_4x64(), rotr(), and shr().

◆ SIMD_4x64() [4/4]

BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::SIMD_4x64 ( __m256i x)
inlineexplicit

Definition at line 162 of file simd_4x64.h.

162: m_simd(x) {}

Member Function Documentation

◆ alignr8()

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::alignr8 ( const SIMD_4x64 & a,
const SIMD_4x64 & b )
inlinestatic

Definition at line 133 of file simd_4x64.h.

133 {
134 return SIMD_4x64(_mm256_alignr_epi8(a.m_simd, b.m_simd, 8));
135 }
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64()
Definition simd_4x64.h:34

References SIMD_4x64(), and SIMD_4x64().

◆ bswap()

SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::bswap ( ) const
inline

Definition at line 52 of file simd_4x64.h.

52 {
53 const auto idx = _mm256_set_epi8(
54 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7);
55
56 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, idx));
57 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by load_be(), and load_be2().

◆ load_be()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::load_be ( const void * in)
inlinestatic

Definition at line 50 of file simd_4x64.h.

50{ return SIMD_4x64::load_le(in).bswap(); }
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 bswap() const
Definition simd_4x64.h:52
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_le(const void *in)
Definition simd_4x64.h:46

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

◆ load_be2()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::load_be2 ( const void * inl,
const void * inh )
inlinestatic

Definition at line 42 of file simd_4x64.h.

42 {
43 return SIMD_4x64::load_le2(inl, inh).bswap();
44 }
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 load_le2(const void *inl, const void *inh)
Definition simd_4x64.h:37

References bswap(), load_le2(), and SIMD_4x64().

◆ load_le()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::load_le ( const void * in)
inlinestatic

Definition at line 46 of file simd_4x64.h.

46 {
47 return SIMD_4x64(_mm256_loadu_si256(reinterpret_cast<const __m256i*>(in)));
48 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by load_be().

◆ load_le2()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::load_le2 ( const void * inl,
const void * inh )
inlinestatic

Definition at line 37 of file simd_4x64.h.

37 {
38 return SIMD_4x64(
39 _mm256_loadu2_m128i(reinterpret_cast<const __m128i*>(inl), reinterpret_cast<const __m128i*>(inh)));
40 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by load_be2().

◆ mul2_32()

BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::mul2_32 ( SIMD_4x64 x,
SIMD_4x64 y )
inlinestatic

Definition at line 138 of file simd_4x64.h.

138 {
139 const __m256i m = _mm256_mul_epu32(x.m_simd, y.m_simd);
140 return SIMD_4x64(_mm256_add_epi64(m, m));
141 }

References SIMD_4x64(), and SIMD_4x64().

◆ operator+()

SIMD_4x64 Botan::SIMD_4x64::operator+ ( const SIMD_4x64 & other) const
inline

Definition at line 69 of file simd_4x64.h.

69 {
70 SIMD_4x64 retval(*this);
71 retval += other;
72 return retval;
73 }
SIMD_4x64(const SIMD_4x64 &other)=default

References SIMD_4x64().

◆ operator+=()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::operator+= ( const SIMD_4x64 & other)
inline

Definition at line 81 of file simd_4x64.h.

81 {
82 m_simd = _mm256_add_epi64(m_simd, other.m_simd);
83 }

References SIMD_4x64().

◆ operator=() [1/2]

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

References SIMD_4x64().

◆ operator=() [2/2]

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

References SIMD_4x64().

◆ operator^()

SIMD_4x64 Botan::SIMD_4x64::operator^ ( const SIMD_4x64 & other) const
inline

Definition at line 75 of file simd_4x64.h.

75 {
76 SIMD_4x64 retval(*this);
77 retval ^= other;
78 return retval;
79 }

References SIMD_4x64().

◆ operator^=()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::operator^= ( const SIMD_4x64 & other)
inline

Definition at line 85 of file simd_4x64.h.

85 {
86 m_simd = _mm256_xor_si256(m_simd, other.m_simd);
87 }

References SIMD_4x64().

◆ permute_4x64()

template<uint8_t CTRL>
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::permute_4x64 ( SIMD_4x64 x)
inlinestatic

Definition at line 144 of file simd_4x64.h.

144 {
145 return SIMD_4x64(_mm256_permute4x64_epi64(x.m_simd, CTRL));
146 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by twist(), and untwist().

◆ rotl()

template<size_t ROT>
SIMD_4x64 Botan::SIMD_4x64::rotl ( ) const
inline

Definition at line 124 of file simd_4x64.h.

124 {
125 return this->rotr<64 - ROT>();
126 }
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 rotr() const
Definition simd_4x64.h:90

References rotr(), and SIMD_4x64().

◆ rotr()

template<size_t ROT>
requires (ROT > 0 && ROT < 64)
BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 Botan::SIMD_4x64::rotr ( ) const
inline

Definition at line 90 of file simd_4x64.h.

92 {
93#if defined(__AVX512VL__)
94 return SIMD_4x64(_mm256_ror_epi64(m_simd, ROT));
95#else
96 if constexpr(ROT == 8) {
97 auto shuf_rot_8 =
98 _mm256_set_epi64x(0x080f0e0d0c0b0a09, 0x0007060504030201, 0x080f0e0d0c0b0a09, 0x0007060504030201);
99
100 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, shuf_rot_8));
101 } else if constexpr(ROT == 16) {
102 auto shuf_rot_16 =
103 _mm256_set_epi64x(0x09080f0e0d0c0b0a, 0x0100070605040302, 0x09080f0e0d0c0b0a, 0x0100070605040302);
104
105 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, shuf_rot_16));
106 } else if constexpr(ROT == 24) {
107 auto shuf_rot_24 =
108 _mm256_set_epi64x(0x0a09080f0e0d0c0b, 0x0201000706050403, 0x0a09080f0e0d0c0b, 0x0201000706050403);
109
110 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, shuf_rot_24));
111 } else if constexpr(ROT == 32) {
112 auto shuf_rot_32 =
113 _mm256_set_epi64x(0x0b0a09080f0e0d0c, 0x0302010007060504, 0x0b0a09080f0e0d0c, 0x0302010007060504);
114
115 return SIMD_4x64(_mm256_shuffle_epi8(m_simd, shuf_rot_32));
116 } else {
117 return SIMD_4x64(_mm256_or_si256(_mm256_srli_epi64(m_simd, static_cast<int>(ROT)),
118 _mm256_slli_epi64(m_simd, static_cast<int>(64 - ROT))));
119 }
120#endif
121 }

References SIMD_4x64(), and SIMD_4x64().

Referenced by rotl().

◆ shr()

template<int SHIFT>
SIMD_4x64 BOTAN_FN_ISA_SIMD_4X64 Botan::SIMD_4x64::shr ( ) const
inlinenoexcept

Definition at line 129 of file simd_4x64.h.

129 {
130 return SIMD_4x64(_mm256_srli_epi64(m_simd, SHIFT));
131 }

References SIMD_4x64(), and SIMD_4x64().

◆ store_le() [1/2]

void Botan::SIMD_4x64::store_le ( uint64_t out[4]) const
inline

Definition at line 59 of file simd_4x64.h.

59{ this->store_le(reinterpret_cast<uint8_t*>(out)); }
void store_le(uint64_t out[4]) const
Definition simd_4x64.h:59

References store_le().

Referenced by store_le().

◆ store_le() [2/2]

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::store_le ( uint8_t out[]) const
inline

Definition at line 61 of file simd_4x64.h.

61 {
62 _mm256_storeu_si256(reinterpret_cast<__m256i*>(out), m_simd);
63 }

◆ store_le2()

BOTAN_FN_ISA_SIMD_4X64 void Botan::SIMD_4x64::store_le2 ( void * outh,
void * outl )
inline

Definition at line 65 of file simd_4x64.h.

65 {
66 _mm256_storeu2_m128i(reinterpret_cast<__m128i*>(outh), reinterpret_cast<__m128i*>(outl), m_simd);
67 }

◆ twist()

void Botan::SIMD_4x64::twist ( SIMD_4x64 & B,
SIMD_4x64 & C,
SIMD_4x64 & D )
inlinestatic

Definition at line 149 of file simd_4x64.h.

149 {
153 }
static BOTAN_FN_ISA_SIMD_4X64 SIMD_4x64 permute_4x64(SIMD_4x64 x)
Definition simd_4x64.h:144

References permute_4x64(), and SIMD_4x64().

◆ untwist()

void Botan::SIMD_4x64::untwist ( SIMD_4x64 & B,
SIMD_4x64 & C,
SIMD_4x64 & D )
inlinestatic

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