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

#include <simd_2x64.h>

Public Member Functions

SIMD_2x64 BOTAN_FN_ISA_SIMD_2X64 bswap () const
SIMD_2x64 operator+ (const SIMD_2x64 &other) const
void operator+= (const SIMD_2x64 &other)
SIMD_2x64operator= (const SIMD_2x64 &other)=default
SIMD_2x64operator= (SIMD_2x64 &&other)=default
SIMD_2x64 operator^ (const SIMD_2x64 &other) const
void operator^= (const SIMD_2x64 &other)
template<size_t ROT>
SIMD_2x64 rotl () const
template<size_t ROT>
requires (ROT > 0 && ROT < 64)
BOTAN_FN_ISA_SIMD_2X64 SIMD_2x64 rotr () const
template<int SHIFT>
SIMD_2x64 shr () const noexcept
 SIMD_2x64 ()
 SIMD_2x64 (__m128i x)
 SIMD_2x64 (const SIMD_2x64 &other)=default
 SIMD_2x64 (SIMD_2x64 &&other)=default
void store_le (uint64_t out[2]) const
void store_le (uint8_t out[]) const
 ~SIMD_2x64 ()=default

Static Public Member Functions

static SIMD_2x64 BOTAN_FN_ISA_SIMD_2X64 alignr8 (const SIMD_2x64 &a, const SIMD_2x64 &b)
static SIMD_2x64 load_be (const void *in)
static SIMD_2x64 load_le (const void *in)
static SIMD_2x64 mul2_32 (SIMD_2x64 x, SIMD_2x64 y)
static void twist (SIMD_2x64 &B0, SIMD_2x64 &B1, SIMD_2x64 &C0, SIMD_2x64 &C1, SIMD_2x64 &D0, SIMD_2x64 &D1)
static void untwist (SIMD_2x64 &B0, SIMD_2x64 &B1, SIMD_2x64 &C0, SIMD_2x64 &C1, SIMD_2x64 &D0, SIMD_2x64 &D1)

Detailed Description

Definition at line 25 of file simd_2x64.h.

Constructor & Destructor Documentation

◆ SIMD_2x64() [1/4]

◆ SIMD_2x64() [2/4]

Botan::SIMD_2x64::SIMD_2x64 ( SIMD_2x64 && other)
default

References SIMD_2x64().

◆ ~SIMD_2x64()

Botan::SIMD_2x64::~SIMD_2x64 ( )
default

◆ SIMD_2x64() [3/4]

Botan::SIMD_2x64::SIMD_2x64 ( )
inline

Definition at line 36 of file simd_2x64.h.

36: m_simd(_mm_setzero_si128()) {}

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

◆ SIMD_2x64() [4/4]

Botan::SIMD_2x64::SIMD_2x64 ( __m128i x)
inlineexplicit

Definition at line 145 of file simd_2x64.h.

145: m_simd(x) {}

Member Function Documentation

◆ alignr8()

SIMD_2x64 BOTAN_FN_ISA_SIMD_2X64 Botan::SIMD_2x64::alignr8 ( const SIMD_2x64 & a,
const SIMD_2x64 & b )
inlinestatic

Definition at line 101 of file simd_2x64.h.

101 {
102 return SIMD_2x64(_mm_alignr_epi8(a.m_simd, b.m_simd, 8));
103 }

References SIMD_2x64(), and SIMD_2x64().

Referenced by twist(), and untwist().

◆ bswap()

SIMD_2x64 BOTAN_FN_ISA_SIMD_2X64 Botan::SIMD_2x64::bswap ( ) const
inline

Definition at line 44 of file simd_2x64.h.

44 {
45 const auto idx = _mm_set_epi8(8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7);
46 return SIMD_2x64(_mm_shuffle_epi8(m_simd, idx));
47 }

References SIMD_2x64(), and SIMD_2x64().

Referenced by load_be().

◆ load_be()

SIMD_2x64 Botan::SIMD_2x64::load_be ( const void * in)
inlinestatic

Definition at line 42 of file simd_2x64.h.

42{ return SIMD_2x64::load_le(in).bswap(); }
static SIMD_2x64 load_le(const void *in)
Definition simd_2x64.h:38
SIMD_2x64 BOTAN_FN_ISA_SIMD_2X64 bswap() const
Definition simd_2x64.h:44

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

◆ load_le()

SIMD_2x64 Botan::SIMD_2x64::load_le ( const void * in)
inlinestatic

Definition at line 38 of file simd_2x64.h.

38 {
39 return SIMD_2x64(_mm_loadu_si128(reinterpret_cast<const __m128i*>(in)));
40 }

References SIMD_2x64(), and SIMD_2x64().

Referenced by load_be().

◆ mul2_32()

SIMD_2x64 Botan::SIMD_2x64::mul2_32 ( SIMD_2x64 x,
SIMD_2x64 y )
inlinestatic

Definition at line 140 of file simd_2x64.h.

140 {
141 const __m128i m = _mm_mul_epu32(x.m_simd, y.m_simd);
142 return SIMD_2x64(_mm_add_epi64(m, m));
143 }

References SIMD_2x64(), and SIMD_2x64().

◆ operator+()

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

Definition at line 53 of file simd_2x64.h.

53 {
54 SIMD_2x64 retval(*this);
55 retval += other;
56 return retval;
57 }
SIMD_2x64(const SIMD_2x64 &other)=default

References SIMD_2x64().

◆ operator+=()

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

Definition at line 65 of file simd_2x64.h.

65{ m_simd = _mm_add_epi64(m_simd, other.m_simd); }

References SIMD_2x64().

◆ operator=() [1/2]

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

References SIMD_2x64().

◆ operator=() [2/2]

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

References SIMD_2x64().

◆ operator^()

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

Definition at line 59 of file simd_2x64.h.

59 {
60 SIMD_2x64 retval(*this);
61 retval ^= other;
62 return retval;
63 }

References SIMD_2x64().

◆ operator^=()

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

Definition at line 67 of file simd_2x64.h.

67{ m_simd = _mm_xor_si128(m_simd, other.m_simd); }

References SIMD_2x64().

◆ rotl()

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

Definition at line 92 of file simd_2x64.h.

92 {
93 return this->rotr<64 - ROT>();
94 }
BOTAN_FN_ISA_SIMD_2X64 SIMD_2x64 rotr() const
Definition simd_2x64.h:70

References rotr(), and SIMD_2x64().

◆ rotr()

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

Definition at line 70 of file simd_2x64.h.

72 {
73 if constexpr(ROT == 8) {
74 auto tab = _mm_setr_epi8(1, 2, 3, 4, 5, 6, 7, 0, 9, 10, 11, 12, 13, 14, 15, 8);
75 return SIMD_2x64(_mm_shuffle_epi8(m_simd, tab));
76 } else if constexpr(ROT == 16) {
77 auto tab = _mm_setr_epi8(2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9);
78 return SIMD_2x64(_mm_shuffle_epi8(m_simd, tab));
79 } else if constexpr(ROT == 24) {
80 auto tab = _mm_setr_epi8(3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10);
81 return SIMD_2x64(_mm_shuffle_epi8(m_simd, tab));
82 } else if constexpr(ROT == 32) {
83 auto tab = _mm_setr_epi8(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11);
84 return SIMD_2x64(_mm_shuffle_epi8(m_simd, tab));
85 } else {
86 return SIMD_2x64(_mm_or_si128(_mm_srli_epi64(m_simd, static_cast<int>(ROT)),
87 _mm_slli_epi64(m_simd, static_cast<int>(64 - ROT))));
88 }
89 }

References SIMD_2x64(), and SIMD_2x64().

Referenced by rotl().

◆ shr()

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

Definition at line 97 of file simd_2x64.h.

97 {
98 return SIMD_2x64(_mm_srli_epi64(m_simd, SHIFT));
99 }

References SIMD_2x64(), and SIMD_2x64().

◆ store_le() [1/2]

void Botan::SIMD_2x64::store_le ( uint64_t out[2]) const
inline

Definition at line 49 of file simd_2x64.h.

49{ this->store_le(reinterpret_cast<uint8_t*>(out)); }
void store_le(uint64_t out[2]) const
Definition simd_2x64.h:49

References store_le().

Referenced by store_le().

◆ store_le() [2/2]

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

Definition at line 51 of file simd_2x64.h.

51{ _mm_storeu_si128(reinterpret_cast<__m128i*>(out), m_simd); }

◆ twist()

void Botan::SIMD_2x64::twist ( SIMD_2x64 & B0,
SIMD_2x64 & B1,
SIMD_2x64 & C0,
SIMD_2x64 & C1,
SIMD_2x64 & D0,
SIMD_2x64 & D1 )
inlinestatic

Definition at line 106 of file simd_2x64.h.

106 {
107 auto T0 = SIMD_2x64::alignr8(B1, B0);
108 auto T1 = SIMD_2x64::alignr8(B0, B1);
109 B0 = T0;
110 B1 = T1;
111
112 T0 = C0;
113 C0 = C1;
114 C1 = T0;
115
116 T0 = SIMD_2x64::alignr8(D0, D1);
117 T1 = SIMD_2x64::alignr8(D1, D0);
118 D0 = T0;
119 D1 = T1;
120 }
static SIMD_2x64 BOTAN_FN_ISA_SIMD_2X64 alignr8(const SIMD_2x64 &a, const SIMD_2x64 &b)
Definition simd_2x64.h:101

References alignr8(), and SIMD_2x64().

◆ untwist()

void Botan::SIMD_2x64::untwist ( SIMD_2x64 & B0,
SIMD_2x64 & B1,
SIMD_2x64 & C0,
SIMD_2x64 & C1,
SIMD_2x64 & D0,
SIMD_2x64 & D1 )
inlinestatic

Definition at line 123 of file simd_2x64.h.

123 {
124 auto T0 = SIMD_2x64::alignr8(B0, B1);
125 auto T1 = SIMD_2x64::alignr8(B1, B0);
126 B0 = T0;
127 B1 = T1;
128
129 T0 = C0;
130 C0 = C1;
131 C1 = T0;
132
133 T0 = SIMD_2x64::alignr8(D1, D0);
134 T1 = SIMD_2x64::alignr8(D0, D1);
135 D0 = T0;
136 D1 = T1;
137 }

References alignr8(), and SIMD_2x64().


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