Crypto++ 8.9
Free C++ class library of cryptographic schemes
Macros | Typedefs | Functions
ppc_simd.h File Reference

Support functions for PowerPC and vector operations. More...

Go to the source code of this file.

Macros

#define CONST_V8_CAST(x)   ((unsigned char*)(x))
 Cast array to vector pointer.
 
#define CONST_V32_CAST(x)   ((unsigned int*)(x))
 Cast array to vector pointer.
 
#define CONST_V64_CAST(x)   ((unsigned long long*)(x))
 Cast array to vector pointer.
 
#define NCONST_V8_CAST(x)   ((unsigned char*)(x))
 Cast array to vector pointer.
 
#define NCONST_V32_CAST(x)   ((unsigned int*)(x))
 Cast array to vector pointer.
 
#define NCONST_V64_CAST(x)   ((unsigned long long*)(x))
 Cast array to vector pointer.
 

Typedefs

typedef __vector unsigned char uint8x16_p
 Vector of 8-bit elements.
 
typedef __vector unsigned short uint16x8_p
 Vector of 16-bit elements.
 
typedef __vector unsigned int uint32x4_p
 Vector of 32-bit elements.
 
typedef __vector unsigned long long uint64x2_p
 Vector of 64-bit elements.
 

Functions

uint32x4_p VecZero ()
 The 0 vector.
 
uint32x4_p VecOne ()
 The 1 vector.
 
template<class T >
VecReverse (const T data)
 Reverse bytes in a vector.
 
template<class T >
VecReverseLE (const T data)
 Reverse bytes in a vector.
 
template<class T >
VecReverseBE (const T data)
 Reverse bytes in a vector.
 
LOAD OPERATIONS
uint32x4_p VecLoad_ALTIVEC (const byte src[16])
 Loads a vector from a byte array.
 
uint32x4_p VecLoad_ALTIVEC (int off, const byte src[16])
 Loads a vector from a byte array.
 
uint32x4_p VecLoad (const byte src[16])
 Loads a vector from a byte array.
 
uint32x4_p VecLoad (int off, const byte src[16])
 Loads a vector from a byte array.
 
uint32x4_p VecLoad (const word32 src[4])
 Loads a vector from a word array.
 
uint32x4_p VecLoad (int off, const word32 src[4])
 Loads a vector from a word array.
 
uint64x2_p VecLoad (const word64 src[2])
 Loads a vector from a double word array.
 
uint64x2_p VecLoad (int off, const word64 src[2])
 Loads a vector from a double word array.
 
uint32x4_p VecLoadAligned (const byte src[16])
 Loads a vector from an aligned byte array.
 
uint32x4_p VecLoadAligned (int off, const byte src[16])
 Loads a vector from an aligned byte array.
 
uint32x4_p VecLoadAligned (const word32 src[4])
 Loads a vector from an aligned word array.
 
uint32x4_p VecLoadAligned (int off, const word32 src[4])
 Loads a vector from an aligned word array.
 
uint64x2_p VecLoadAligned (const word64 src[4])
 Loads a vector from an aligned double word array.
 
uint64x2_p VecLoadAligned (int off, const word64 src[4])
 Loads a vector from an aligned double word array.
 
uint32x4_p VecLoadBE (const byte src[16])
 Loads a vector from a byte array.
 
uint32x4_p VecLoadBE (int off, const byte src[16])
 Loads a vector from a byte array.
 
STORE OPERATIONS
template<class T >
void VecStore_ALTIVEC (const T data, byte dest[16])
 Stores a vector to a byte array.
 
template<class T >
void VecStore_ALTIVEC (const T data, int off, byte dest[16])
 Stores a vector to a byte array.
 
template<class T >
void VecStore (const T data, byte dest[16])
 Stores a vector to a byte array.
 
template<class T >
void VecStore (const T data, int off, byte dest[16])
 Stores a vector to a byte array.
 
template<class T >
void VecStore (const T data, word32 dest[4])
 Stores a vector to a word array.
 
template<class T >
void VecStore (const T data, int off, word32 dest[4])
 Stores a vector to a word array.
 
template<class T >
void VecStore (const T data, word64 dest[2])
 Stores a vector to a word array.
 
template<class T >
void VecStore (const T data, int off, word64 dest[2])
 Stores a vector to a word array.
 
template<class T >
void VecStoreAligned (const T data, byte dest[16])
 Stores a vector to a byte array.
 
template<class T >
void VecStoreAligned (const T data, int off, byte dest[16])
 Stores a vector to a byte array.
 
template<class T >
void VecStoreAligned (const T data, word32 dest[4])
 Stores a vector to a word array.
 
template<class T >
void VecStoreAligned (const T data, int off, word32 dest[4])
 Stores a vector to a word array.
 
template<class T >
void VecStoreBE (const T data, byte dest[16])
 Stores a vector to a byte array.
 
template<class T >
void VecStoreBE (const T data, int off, byte dest[16])
 Stores a vector to a byte array.
 
template<class T >
void VecStoreBE (const T data, word32 dest[4])
 Stores a vector to a word array.
 
template<class T >
void VecStoreBE (const T data, int off, word32 dest[4])
 Stores a vector to a word array.
 
LOGICAL OPERATIONS
template<class T1 , class T2 >
T1 VecAnd (const T1 vec1, const T2 vec2)
 AND two vectors.
 
template<class T1 , class T2 >
T1 VecOr (const T1 vec1, const T2 vec2)
 OR two vectors.
 
template<class T1 , class T2 >
T1 VecXor (const T1 vec1, const T2 vec2)
 XOR two vectors.
 
ARITHMETIC OPERATIONS
template<class T1 , class T2 >
T1 VecAdd (const T1 vec1, const T2 vec2)
 Add two vectors.
 
template<class T1 , class T2 >
T1 VecSub (const T1 vec1, const T2 vec2)
 Subtract two vectors.
 
PERMUTE OPERATIONS
template<class T1 , class T2 >
T1 VecPermute (const T1 vec, const T2 mask)
 Permutes a vector.
 
template<class T1 , class T2 >
T1 VecPermute (const T1 vec1, const T1 vec2, const T2 mask)
 Permutes two vectors.
 
SHIFT AND ROTATE OPERATIONS
template<unsigned int C, class T >
VecShiftLeftOctet (const T vec)
 Shift a vector left.
 
template<unsigned int C, class T >
VecShiftRightOctet (const T vec)
 Shift a vector right.
 
template<unsigned int C, class T >
VecRotateLeftOctet (const T vec)
 Rotate a vector left.
 
template<unsigned int C, class T >
VecRotateRightOctet (const T vec)
 Rotate a vector right.
 
template<unsigned int C>
uint32x4_p VecRotateLeft (const uint32x4_p vec)
 Rotate a vector left.
 
template<unsigned int C>
uint32x4_p VecRotateRight (const uint32x4_p vec)
 Rotate a vector right.
 
template<unsigned int C>
uint32x4_p VecShiftLeft (const uint32x4_p vec)
 Shift a vector left.
 
template<unsigned int C>
uint32x4_p VecShiftRight (const uint32x4_p vec)
 Shift a vector right.
 
template<unsigned int C>
uint64x2_p VecRotateLeft (const uint64x2_p vec)
 Rotate a vector left.
 
template<unsigned int C>
uint64x2_p VecShiftLeft (const uint64x2_p vec)
 Shift a vector left.
 
template<unsigned int C>
uint64x2_p VecRotateRight (const uint64x2_p vec)
 Rotate a vector right.
 
template<unsigned int C>
uint64x2_p VecShiftRight (const uint64x2_p vec)
 Shift a vector right.
 
OTHER OPERATIONS
template<class T >
VecMergeLow (const T vec1, const T vec2)
 Merge two vectors.
 
template<class T >
VecMergeHigh (const T vec1, const T vec2)
 Merge two vectors.
 
uint32x4_p VecSplatWord (word32 val)
 Broadcast 32-bit word to a vector.
 
template<unsigned int N>
uint32x4_p VecSplatElement (const uint32x4_p val)
 Broadcast 32-bit element to a vector.
 
uint64x2_p VecSplatWord (word64 val)
 Broadcast 64-bit double word to a vector.
 
template<unsigned int N>
uint64x2_p VecSplatElement (const uint64x2_p val)
 Broadcast 64-bit element to a vector.
 
template<class T >
VecGetLow (const T val)
 Extract a dword from a vector.
 
template<class T >
VecGetHigh (const T val)
 Extract a dword from a vector.
 
template<class T >
VecSwapWords (const T vec)
 Exchange high and low double words.
 
COMPARISON
template<class T1 , class T2 >
bool VecEqual (const T1 vec1, const T2 vec2)
 Compare two vectors.
 
template<class T1 , class T2 >
bool VecNotEqual (const T1 vec1, const T2 vec2)
 Compare two vectors.
 
32-BIT ALTIVEC
uint32x4_p VecAdd64 (const uint32x4_p &vec1, const uint32x4_p &vec2)
 Add two vectors as if uint64x2_p.
 
uint64x2_p VecAdd64 (const uint64x2_p &vec1, const uint64x2_p &vec2)
 Add two vectors as if uint64x2_p.
 
uint32x4_p VecSub64 (const uint32x4_p &vec1, const uint32x4_p &vec2)
 Subtract two vectors as if uint64x2_p.
 
uint64x2_p VecSub64 (const uint64x2_p &vec1, const uint64x2_p &vec2)
 Subtract two vectors as if uint64x2_p.
 
template<unsigned int C>
uint32x4_p VecRotateLeft64 (const uint32x4_p vec)
 Rotate a vector left as if uint64x2_p.
 
template<>
uint32x4_p VecRotateLeft64< 8 > (const uint32x4_p vec)
 Rotate a vector left as if uint64x2_p.
 
template<unsigned int C>
uint64x2_p VecRotateLeft64 (const uint64x2_p vec)
 Rotate a vector left as if uint64x2_p.
 
template<unsigned int C>
uint32x4_p VecRotateRight64 (const uint32x4_p vec)
 Rotate a vector right as if uint64x2_p.
 
template<>
uint32x4_p VecRotateRight64< 8 > (const uint32x4_p vec)
 Rotate a vector right as if uint64x2_p.
 
template<unsigned int C>
uint64x2_p VecRotateRight64 (const uint64x2_p vec)
 Rotate a vector right as if uint64x2_p.
 
template<class T1 , class T2 >
T1 VecAnd64 (const T1 vec1, const T2 vec2)
 AND two vectors as if uint64x2_p.
 
template<class T1 , class T2 >
T1 VecOr64 (const T1 vec1, const T2 vec2)
 OR two vectors as if uint64x2_p.
 
template<class T1 , class T2 >
T1 VecXor64 (const T1 vec1, const T2 vec2)
 XOR two vectors as if uint64x2_p.
 
uint32x4_p VecSplatWord64 (word64 val)
 Broadcast 64-bit double word to a vector.
 
template<unsigned int N>
uint32x4_p VecSplatElement64 (const uint32x4_p val)
 Broadcast 64-bit element to a vector as if uint64x2_p.
 
template<unsigned int N>
uint64x2_p VecSplatElement64 (const uint64x2_p val)
 Broadcast 64-bit element to a vector.
 
POLYNOMIAL MULTIPLICATION
uint32x4_p VecPolyMultiply (const uint32x4_p &a, const uint32x4_p &b)
 Polynomial multiplication.
 
uint64x2_p VecPolyMultiply (const uint64x2_p &a, const uint64x2_p &b)
 Polynomial multiplication.
 
uint64x2_p VecIntelMultiply00 (const uint64x2_p &a, const uint64x2_p &b)
 Polynomial multiplication.
 
uint64x2_p VecIntelMultiply01 (const uint64x2_p &a, const uint64x2_p &b)
 Polynomial multiplication.
 
uint64x2_p VecIntelMultiply10 (const uint64x2_p &a, const uint64x2_p &b)
 Polynomial multiplication.
 
uint64x2_p VecIntelMultiply11 (const uint64x2_p &a, const uint64x2_p &b)
 Polynomial multiplication.
 
AES ENCRYPTION
template<class T1 , class T2 >
T1 VecEncrypt (const T1 state, const T2 key)
 One round of AES encryption.
 
template<class T1 , class T2 >
T1 VecEncryptLast (const T1 state, const T2 key)
 Final round of AES encryption.
 
template<class T1 , class T2 >
T1 VecDecrypt (const T1 state, const T2 key)
 One round of AES decryption.
 
template<class T1 , class T2 >
T1 VecDecryptLast (const T1 state, const T2 key)
 Final round of AES decryption.
 
SHA DIGESTS
template<int func, int fmask, class T >
VecSHA256 (const T data)
 SHA256 Sigma functions.
 
template<int func, int fmask, class T >
VecSHA512 (const T data)
 SHA512 Sigma functions.
 

Detailed Description

Support functions for PowerPC and vector operations.

This header provides an agnostic interface into Clang, GCC and IBM XL C/C++ compilers modulo their different built-in functions for accessing vector instructions.

The abstractions are necessary to support back to GCC 4.8 and XLC 11 and 12. GCC 4.8 and 4.9 are still popular, and they are the default compiler for GCC112, GCC119 and others on the compile farm. Older IBM XL C/C++ compilers also have the need due to lack of vec_xl and vec_xst support on some platforms. Modern compilers provide best support and don't need many of the hacks below.

The library is tested with the following PowerPC machines and compilers. GCC110, GCC111, GCC112, GCC119 and GCC135 are provided by the GCC Compile Farm

Definition in file ppc_simd.h.

Macro Definition Documentation

◆ CONST_V8_CAST

#define CONST_V8_CAST ( x)    ((unsigned char*)(x))

Cast array to vector pointer.

CONST_V8_CAST casts a const array to a vector pointer for a byte array. The Power ABI says source arrays are non-const, so this define removes the const. XLC++ will fail the compile if the source array is const.

Definition at line 145 of file ppc_simd.h.

◆ CONST_V32_CAST

#define CONST_V32_CAST ( x)    ((unsigned int*)(x))

Cast array to vector pointer.

CONST_V32_CAST casts a const array to a vector pointer for a word array. The Power ABI says source arrays are non-const, so this define removes the const. XLC++ will fail the compile if the source array is const.

Definition at line 151 of file ppc_simd.h.

◆ CONST_V64_CAST

#define CONST_V64_CAST ( x)    ((unsigned long long*)(x))

Cast array to vector pointer.

CONST_V64_CAST casts a const array to a vector pointer for a double word array. The Power ABI says source arrays are non-const, so this define removes the const. XLC++ will fail the compile if the source array is const.

Definition at line 157 of file ppc_simd.h.

◆ NCONST_V8_CAST

#define NCONST_V8_CAST ( x)    ((unsigned char*)(x))

Cast array to vector pointer.

NCONST_V8_CAST casts an array to a vector pointer for a byte array. The Power ABI says source arrays are non-const, so this define removes the const. XLC++ will fail the compile if the source array is const.

Definition at line 163 of file ppc_simd.h.

◆ NCONST_V32_CAST

#define NCONST_V32_CAST ( x)    ((unsigned int*)(x))

Cast array to vector pointer.

NCONST_V32_CAST casts an array to a vector pointer for a word array. The Power ABI says source arrays are non-const, so this define removes the const. XLC++ will fail the compile if the source array is const.

Definition at line 169 of file ppc_simd.h.

◆ NCONST_V64_CAST

#define NCONST_V64_CAST ( x)    ((unsigned long long*)(x))

Cast array to vector pointer.

NCONST_V64_CAST casts an array to a vector pointer for a double word array. The Power ABI says source arrays are non-const, so this define removes the const. XLC++ will fail the compile if the source array is const.

Definition at line 175 of file ppc_simd.h.

Typedef Documentation

◆ uint8x16_p

typedef __vector unsigned char uint8x16_p

Vector of 8-bit elements.

Wraps
__vector unsigned char
Since
Crypto++ 6.0

Definition at line 192 of file ppc_simd.h.

◆ uint16x8_p

typedef __vector unsigned short uint16x8_p

Vector of 16-bit elements.

Wraps
__vector unsigned short
Since
Crypto++ 6.0

Definition at line 197 of file ppc_simd.h.

◆ uint32x4_p

typedef __vector unsigned int uint32x4_p

Vector of 32-bit elements.

Wraps
__vector unsigned int
Since
Crypto++ 6.0

Definition at line 202 of file ppc_simd.h.

◆ uint64x2_p

typedef __vector unsigned long long uint64x2_p

Vector of 64-bit elements.

uint64x2_p is available on POWER7 with VSX and above. Most supporting functions, like 64-bit vec_add (vaddudm) and vec_sub (vsubudm), did not arrive until POWER8.

Wraps
__vector unsigned long long
Since
Crypto++ 6.0

Definition at line 212 of file ppc_simd.h.

Function Documentation

◆ VecZero()

uint32x4_p VecZero ( )
inline

The 0 vector.

Returns
a 32-bit vector of 0's
Since
Crypto++ 8.0

Definition at line 218 of file ppc_simd.h.

◆ VecOne()

uint32x4_p VecOne ( )
inline

The 1 vector.

Returns
a 32-bit vector of 1's
Since
Crypto++ 8.0

Definition at line 227 of file ppc_simd.h.

◆ VecReverse()

template<class T >
T VecReverse ( const T data)
inline

Reverse bytes in a vector.

Template Parameters
Tvector type
Parameters
datathe vector
Returns
vector

VecReverse() reverses the bytes in a vector

Wraps
vec_perm
Since
Crypto++ 6.0

Definition at line 242 of file ppc_simd.h.

◆ VecReverseLE()

template<class T >
T VecReverseLE ( const T data)
inline

Reverse bytes in a vector.

Template Parameters
Tvector type
Parameters
datathe vector
Returns
vector

VecReverseLE() reverses the bytes in a vector on little-endian systems.

Wraps
vec_perm
Since
Crypto++ 6.0

Definition at line 263 of file ppc_simd.h.

◆ VecReverseBE()

template<class T >
T VecReverseBE ( const T data)
inline

Reverse bytes in a vector.

Template Parameters
Tvector type
Parameters
datathe vector
Returns
vector

VecReverseBE() reverses the bytes in a vector on big-endian systems.

Wraps
vec_perm
Since
Crypto++ 6.0

Definition at line 283 of file ppc_simd.h.

◆ VecLoad_ALTIVEC() [1/2]

uint32x4_p VecLoad_ALTIVEC ( const byte src[16])
inline

Loads a vector from a byte array.

Parameters
srcthe byte array

Loads a vector in native endian format from a byte array.

VecLoad_ALTIVEC() uses vec_ld if the effective address of src is aligned. If unaligned it uses vec_lvsl, vec_ld, vec_perm and src. The fixups using vec_lvsl and vec_perm are relatively expensive so you should provide aligned memory addresses.

Wraps
vec_ld, vec_lvsl, vec_perm
See also
VecLoad, VecLoadAligned
Since
Crypto++ 6.0

Definition at line 308 of file ppc_simd.h.

◆ VecLoad_ALTIVEC() [2/2]

uint32x4_p VecLoad_ALTIVEC ( int off,
const byte src[16] )
inline

Loads a vector from a byte array.

Parameters
srcthe byte array
offoffset into the src byte array

Loads a vector in native endian format from a byte array.

VecLoad_ALTIVEC() uses vec_ld if the effective address of src is aligned. If unaligned it uses vec_lvsl, vec_ld, vec_perm and src.

The fixups using vec_lvsl and vec_perm are relatively expensive so you should provide aligned memory addresses.

Wraps
vec_ld, vec_lvsl, vec_perm
See also
VecLoad, VecLoadAligned
Since
Crypto++ 6.0

Definition at line 339 of file ppc_simd.h.

◆ VecLoad() [1/6]

uint32x4_p VecLoad ( const byte src[16])
inline

Loads a vector from a byte array.

Parameters
srcthe byte array

VecLoad() loads a vector from a byte array.

VecLoad() uses POWER9's vec_xl if available. The instruction does not require aligned effective memory addresses. VecLoad_ALTIVEC() is used if POWER9 is not available. VecLoad_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xl on POWER9 and above, Altivec load on POWER8 and below
See also
VecLoad_ALTIVEC, VecLoadAligned
Since
Crypto++ 6.0

Definition at line 369 of file ppc_simd.h.

◆ VecLoad() [2/6]

uint32x4_p VecLoad ( int off,
const byte src[16] )
inline

Loads a vector from a byte array.

Parameters
srcthe byte array
offoffset into the src byte array

VecLoad() loads a vector from a byte array.

VecLoad() uses POWER9's vec_xl if available. The instruction does not require aligned effective memory addresses. VecLoad_ALTIVEC() is used if POWER9 is not available. VecLoad_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xl on POWER9 and above, Altivec load on POWER8 and below
See also
VecLoad_ALTIVEC, VecLoadAligned
Since
Crypto++ 6.0

Definition at line 399 of file ppc_simd.h.

◆ VecLoad() [3/6]

uint32x4_p VecLoad ( const word32 src[4])
inline

Loads a vector from a word array.

Parameters
srcthe word array

VecLoad() loads a vector from a word array.

VecLoad() uses POWER7's and VSX's vec_xl if available. The instruction does not require aligned effective memory addresses. VecLoad_ALTIVEC() is used if POWER7 is not available. VecLoad_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xl on VSX or POWER8 and above, Altivec load on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoadAligned
Since
Crypto++ 8.0

Definition at line 428 of file ppc_simd.h.

◆ VecLoad() [4/6]

uint32x4_p VecLoad ( int off,
const word32 src[4] )
inline

Loads a vector from a word array.

Parameters
srcthe word array
offoffset into the word array

VecLoad() loads a vector from a word array.

VecLoad() uses POWER7's and VSX's vec_xl if available. The instruction does not require aligned effective memory addresses. VecLoad_ALTIVEC() is used if POWER7 is not available. VecLoad_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xl on VSX or POWER8 and above, Altivec load on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoadAligned
Since
Crypto++ 8.0

Definition at line 460 of file ppc_simd.h.

◆ VecLoad() [5/6]

uint64x2_p VecLoad ( const word64 src[2])
inline

Loads a vector from a double word array.

Parameters
srcthe double word array

VecLoad() loads a vector from a double word array.

VecLoad() uses POWER7's and VSX's vec_xl if available. The instruction does not require aligned effective memory addresses. VecLoad_ALTIVEC() is used if POWER7 and VSX are not available. VecLoad_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

VecLoad() with 64-bit elements is available on POWER7 and above.

Wraps
vec_xl on VSX or POWER8 and above, Altivec load on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoadAligned
Since
Crypto++ 8.0

Definition at line 494 of file ppc_simd.h.

◆ VecLoad() [6/6]

uint64x2_p VecLoad ( int off,
const word64 src[2] )
inline

Loads a vector from a double word array.

Parameters
srcthe double word array
offoffset into the double word array

VecLoad() loads a vector from a double word array.

VecLoad() uses POWER7's and VSX's vec_xl if available. The instruction does not require aligned effective memory addresses. VecLoad_ALTIVEC() is used if POWER7 and VSX are not available. VecLoad_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

VecLoad() with 64-bit elements is available on POWER8 and above.

Wraps
vec_xl on VSX or POWER8 and above, Altivec load on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoadAligned
Since
Crypto++ 8.0

Definition at line 528 of file ppc_simd.h.

◆ VecLoadAligned() [1/6]

uint32x4_p VecLoadAligned ( const byte src[16])
inline

Loads a vector from an aligned byte array.

Parameters
srcthe byte array

VecLoadAligned() loads a vector from an aligned byte array.

VecLoadAligned() uses POWER9's vec_xl if available. vec_ld is used if POWER9 is not available. The effective address of src must be 16-byte aligned for Altivec.

Wraps
vec_xl on POWER9, vec_ld on POWER8 and below
See also
VecLoad_ALTIVEC, VecLoad
Since
Crypto++ 8.0

Definition at line 560 of file ppc_simd.h.

◆ VecLoadAligned() [2/6]

uint32x4_p VecLoadAligned ( int off,
const byte src[16] )
inline

Loads a vector from an aligned byte array.

Parameters
srcthe byte array
offoffset into the src byte array

VecLoadAligned() loads a vector from an aligned byte array.

VecLoadAligned() uses POWER9's vec_xl if available. vec_ld is used if POWER9 is not available. The effective address of src must be 16-byte aligned for Altivec.

Wraps
vec_xl on POWER9, vec_ld on POWER8 and below
See also
VecLoad_ALTIVEC, VecLoad
Since
Crypto++ 8.0

Definition at line 588 of file ppc_simd.h.

◆ VecLoadAligned() [3/6]

uint32x4_p VecLoadAligned ( const word32 src[4])
inline

Loads a vector from an aligned word array.

Parameters
srcthe word array

VecLoadAligned() loads a vector from an aligned word array.

VecLoadAligned() uses POWER7's and VSX's vec_xl if available. vec_ld is used if POWER7 or VSX are not available. The effective address of src must be 16-byte aligned for Altivec.

Wraps
vec_xl on VSX or POWER8 and above, vec_ld on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoad
Since
Crypto++ 8.0

Definition at line 615 of file ppc_simd.h.

◆ VecLoadAligned() [4/6]

uint32x4_p VecLoadAligned ( int off,
const word32 src[4] )
inline

Loads a vector from an aligned word array.

Parameters
srcthe word array
offoffset into the src word array

VecLoadAligned() loads a vector from an aligned word array.

VecLoadAligned() uses POWER7's and VSX's vec_xl if available. vec_ld is used if POWER7 or VSX are not available. The effective address of src must be 16-byte aligned for Altivec.

Wraps
vec_xl on VSX or POWER8 and above, vec_ld on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoad
Since
Crypto++ 8.0

Definition at line 645 of file ppc_simd.h.

◆ VecLoadAligned() [5/6]

uint64x2_p VecLoadAligned ( const word64 src[4])
inline

Loads a vector from an aligned double word array.

Parameters
srcthe double word array

VecLoadAligned() loads a vector from an aligned double word array.

VecLoadAligned() uses POWER7's and VSX's vec_xl if available. vec_ld is used if POWER7 or VSX are not available. The effective address of src must be 16-byte aligned for Altivec.

Wraps
vec_xl on VSX or POWER8 and above, vec_ld on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoad
Since
Crypto++ 8.0

Definition at line 676 of file ppc_simd.h.

◆ VecLoadAligned() [6/6]

uint64x2_p VecLoadAligned ( int off,
const word64 src[4] )
inline

Loads a vector from an aligned double word array.

Parameters
srcthe double word array
offoffset into the src double word array

VecLoadAligned() loads a vector from an aligned double word array.

VecLoadAligned() uses POWER7's and VSX's vec_xl if available. vec_ld is used if POWER7 or VSX are not available. The effective address of src must be 16-byte aligned for Altivec.

Wraps
vec_xl on VSX or POWER8 and above, vec_ld on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoad
Since
Crypto++ 8.0

Definition at line 707 of file ppc_simd.h.

◆ VecLoadBE() [1/2]

uint32x4_p VecLoadBE ( const byte src[16])
inline

Loads a vector from a byte array.

Parameters
srcthe byte array

VecLoadBE() loads a vector from a byte array. VecLoadBE will reverse all bytes in the array on a little endian system.

VecLoadBE() uses POWER7's and VSX's vec_xl if available. The instruction does not require aligned effective memory addresses. VecLoad_ALTIVEC() is used if POWER7 or VSX are not available. VecLoad_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xl on POWER8, Altivec load on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoad, VecLoadAligned
Since
Crypto++ 6.0

Definition at line 742 of file ppc_simd.h.

◆ VecLoadBE() [2/2]

uint32x4_p VecLoadBE ( int off,
const byte src[16] )
inline

Loads a vector from a byte array.

Parameters
srcthe byte array
offoffset into the src byte array

VecLoadBE() loads a vector from a byte array. VecLoadBE will reverse all bytes in the array on a little endian system.

VecLoadBE() uses POWER7's and VSX's vec_xl if available. The instruction does not require aligned effective memory addresses. VecLoad_ALTIVEC() is used if POWER7 is not available. VecLoad_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xl on POWER8, Altivec load on POWER7 and below
See also
VecLoad_ALTIVEC, VecLoad, VecLoadAligned
Since
Crypto++ 6.0

Definition at line 776 of file ppc_simd.h.

◆ VecStore_ALTIVEC() [1/2]

template<class T >
void VecStore_ALTIVEC ( const T data,
byte dest[16] )
inline

Stores a vector to a byte array.

Template Parameters
Tvector type
Parameters
datathe vector
destthe byte array

VecStore_ALTIVEC() stores a vector to a byte array.

VecStore_ALTIVEC() uses vec_st if the effective address of dest is aligned, and uses vec_ste otherwise. vec_ste is relatively expensive so you should provide aligned memory addresses.

VecStore_ALTIVEC() is used when POWER7 or above and unaligned loads is not available.

Wraps
vec_st, vec_ste, vec_lvsr, vec_perm
See also
VecStore, VecStoreAligned
Since
Crypto++ 8.0

Definition at line 817 of file ppc_simd.h.

◆ VecStore_ALTIVEC() [2/2]

template<class T >
void VecStore_ALTIVEC ( const T data,
int off,
byte dest[16] )
inline

Stores a vector to a byte array.

Template Parameters
Tvector type
Parameters
datathe vector
offoffset into the dest byte array
destthe byte array

VecStore_ALTIVEC() stores a vector to a byte array.

VecStore_ALTIVEC() uses vec_st if the effective address of dest is aligned, and uses vec_ste otherwise. vec_ste is relatively expensive so you should provide aligned memory addresses.

VecStore_ALTIVEC() is used when POWER7 or above and unaligned loads is not available.

Wraps
vec_st, vec_ste, vec_lvsr, vec_perm
See also
VecStore, VecStoreAligned
Since
Crypto++ 8.0

Definition at line 857 of file ppc_simd.h.

◆ VecStore() [1/6]

template<class T >
void VecStore ( const T data,
byte dest[16] )
inline

Stores a vector to a byte array.

Template Parameters
Tvector type
Parameters
datathe vector
destthe byte array

VecStore() stores a vector to a byte array.

VecStore() uses POWER9's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER9 is not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xst on POWER9 and above, Altivec store on POWER8 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 6.0

Definition at line 895 of file ppc_simd.h.

◆ VecStore() [2/6]

template<class T >
void VecStore ( const T data,
int off,
byte dest[16] )
inline

Stores a vector to a byte array.

Template Parameters
Tvector type
Parameters
datathe vector
offoffset into the dest byte array
destthe byte array

VecStore() stores a vector to a byte array.

VecStore() uses POWER9's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER9 is not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xst on POWER9 and above, Altivec store on POWER8 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 6.0

Definition at line 928 of file ppc_simd.h.

◆ VecStore() [3/6]

template<class T >
void VecStore ( const T data,
word32 dest[4] )
inline

Stores a vector to a word array.

Template Parameters
Tvector type
Parameters
datathe vector
destthe word array

VecStore() stores a vector to a word array.

VecStore() uses POWER7's and VSX's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER7 or VSX are not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xst on VSX or POWER8 and above, Altivec store on POWER7 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 8.0

Definition at line 960 of file ppc_simd.h.

◆ VecStore() [4/6]

template<class T >
void VecStore ( const T data,
int off,
word32 dest[4] )
inline

Stores a vector to a word array.

Template Parameters
Tvector type
Parameters
datathe vector
offoffset into the dest word array
destthe word array

VecStore() stores a vector to a word array.

VecStore() uses POWER7's and VSX's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER7 or VSX are not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xst on VSX or POWER8 and above, Altivec store on POWER7 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 8.0

Definition at line 995 of file ppc_simd.h.

◆ VecStore() [5/6]

template<class T >
void VecStore ( const T data,
word64 dest[2] )
inline

Stores a vector to a word array.

Template Parameters
Tvector type
Parameters
datathe vector
destthe word array

VecStore() stores a vector to a word array.

VecStore() uses POWER7's and VSX's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER7 or VSX are not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

VecStore() with 64-bit elements is available on POWER8 and above.

Wraps
vec_xst on VSX or POWER8 and above, Altivec store on POWER7 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 8.0

Definition at line 1030 of file ppc_simd.h.

◆ VecStore() [6/6]

template<class T >
void VecStore ( const T data,
int off,
word64 dest[2] )
inline

Stores a vector to a word array.

Template Parameters
Tvector type
Parameters
datathe vector
offoffset into the dest word array
destthe word array

VecStore() stores a vector to a word array.

VecStore() uses POWER7's and VSX's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER7 or VSX are not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

VecStore() with 64-bit elements is available on POWER8 and above.

Wraps
vec_xst on VSX or POWER8 and above, Altivec store on POWER7 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 8.0

Definition at line 1067 of file ppc_simd.h.

◆ VecStoreAligned() [1/4]

template<class T >
void VecStoreAligned ( const T data,
byte dest[16] )
inline

Stores a vector to a byte array.

Template Parameters
Tvector type
Parameters
datathe vector
destthe byte array

VecStoreAligned() stores a vector from an aligned byte array.

VecStoreAligned() uses POWER9's vec_xl if available. vec_st is used if POWER9 is not available. The effective address of dest must be 16-byte aligned for Altivec.

Wraps
vec_xst on POWER9 or above, vec_st on POWER8 and below
See also
VecStore_ALTIVEC, VecStore
Since
Crypto++ 8.0

Definition at line 1100 of file ppc_simd.h.

◆ VecStoreAligned() [2/4]

template<class T >
void VecStoreAligned ( const T data,
int off,
byte dest[16] )
inline

Stores a vector to a byte array.

Template Parameters
Tvector type
Parameters
datathe vector
offoffset into the dest byte array
destthe byte array

VecStoreAligned() stores a vector from an aligned byte array.

VecStoreAligned() uses POWER9's vec_xl if available. vec_st is used if POWER9 is not available. The effective address of dest must be 16-byte aligned for Altivec.

Wraps
vec_xst on POWER9 or above, vec_st on POWER8 and below
See also
VecStore_ALTIVEC, VecStore
Since
Crypto++ 8.0

Definition at line 1131 of file ppc_simd.h.

◆ VecStoreAligned() [3/4]

template<class T >
void VecStoreAligned ( const T data,
word32 dest[4] )
inline

Stores a vector to a word array.

Template Parameters
Tvector type
Parameters
datathe vector
destthe word array

VecStoreAligned() stores a vector from an aligned word array.

VecStoreAligned() uses POWER9's vec_xl if available. POWER7 vec_xst is used if POWER9 is not available. vec_st is used if POWER7 is not available. The effective address of dest must be 16-byte aligned for Altivec.

Wraps
vec_xst on VSX or POWER8 and above, vec_st on POWER7 and below
See also
VecStore_ALTIVEC, VecStore
Since
Crypto++ 8.0

Definition at line 1162 of file ppc_simd.h.

◆ VecStoreAligned() [4/4]

template<class T >
void VecStoreAligned ( const T data,
int off,
word32 dest[4] )
inline

Stores a vector to a word array.

Template Parameters
Tvector type
Parameters
datathe vector
offoffset into the dest word array
destthe word array

VecStoreAligned() stores a vector from an aligned word array.

VecStoreAligned() uses POWER9's vec_xl if available. POWER7 vec_xst is used if POWER9 is not available. vec_st is used if POWER7 is not available. The effective address of dest must be 16-byte aligned for Altivec.

Wraps
vec_xst on VSX or POWER8 and above, vec_st on POWER7 and below
See also
VecStore_ALTIVEC, VecStore
Since
Crypto++ 8.0

Definition at line 1196 of file ppc_simd.h.

◆ VecStoreBE() [1/4]

template<class T >
void VecStoreBE ( const T data,
byte dest[16] )
inline

Stores a vector to a byte array.

Template Parameters
Tvector type
Parameters
datathe vector
destthe byte array

VecStoreBE() stores a vector to a byte array. VecStoreBE will reverse all bytes in the array on a little endian system.

VecStoreBE() uses POWER7's and VSX's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER7 is not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xst on VSX or POWER8 and above, vec_st on POWER7 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 6.0

Definition at line 1231 of file ppc_simd.h.

◆ VecStoreBE() [2/4]

template<class T >
void VecStoreBE ( const T data,
int off,
byte dest[16] )
inline

Stores a vector to a byte array.

Template Parameters
Tvector type
Parameters
datathe vector
offoffset into the dest byte array
destthe byte array

VecStoreBE() stores a vector to a byte array. VecStoreBE will reverse all bytes in the array on a little endian system.

VecStoreBE() uses POWER7's and VSX's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER7 is not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xst on VSX or POWER8 and above, vec_st on POWER7 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 6.0

Definition at line 1267 of file ppc_simd.h.

◆ VecStoreBE() [3/4]

template<class T >
void VecStoreBE ( const T data,
word32 dest[4] )
inline

Stores a vector to a word array.

Template Parameters
Tvector type
Parameters
datathe vector
destthe word array

VecStoreBE() stores a vector to a word array. VecStoreBE will reverse all bytes in the array on a little endian system.

VecStoreBE() uses POWER7's and VSX's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER7 is not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xst on VSX or POWER8 and above, vec_st on POWER7 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 8.0

Definition at line 1302 of file ppc_simd.h.

◆ VecStoreBE() [4/4]

template<class T >
void VecStoreBE ( const T data,
int off,
word32 dest[4] )
inline

Stores a vector to a word array.

Template Parameters
Tvector type
Parameters
datathe vector
offoffset into the dest word array
destthe word array

VecStoreBE() stores a vector to a word array. VecStoreBE will reverse all words in the array on a little endian system.

VecStoreBE() uses POWER7's and VSX's vec_xst if available. The instruction does not require aligned effective memory addresses. VecStore_ALTIVEC() is used if POWER7 is not available. VecStore_ALTIVEC() can be relatively expensive if extra instructions are required to fix up unaligned memory addresses.

Wraps
vec_xst on VSX or POWER8 and above, vec_st on POWER7 and below
See also
VecStore_ALTIVEC, VecStoreAligned
Since
Crypto++ 8.0

Definition at line 1338 of file ppc_simd.h.

◆ VecAnd()

template<class T1 , class T2 >
T1 VecAnd ( const T1 vec1,
const T2 vec2 )
inline

AND two vectors.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecAnd() performs vec1 & vec2. vec2 is cast to the same type as vec1. The return vector is the same type as vec1.

Wraps
vec_and
See also
VecAnd64
Since
Crypto++ 6.0

Definition at line 1376 of file ppc_simd.h.

◆ VecOr()

template<class T1 , class T2 >
T1 VecOr ( const T1 vec1,
const T2 vec2 )
inline

OR two vectors.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecOr() performs vec1 | vec2. vec2 is cast to the same type as vec1. The return vector is the same type as vec1.

Wraps
vec_or
See also
VecOr64
Since
Crypto++ 6.0

Definition at line 1395 of file ppc_simd.h.

◆ VecXor()

template<class T1 , class T2 >
T1 VecXor ( const T1 vec1,
const T2 vec2 )
inline

XOR two vectors.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecXor() performs vec1 ^ vec2. vec2 is cast to the same type as vec1. The return vector is the same type as vec1.

Wraps
vec_xor
See also
VecXor64
Since
Crypto++ 6.0

Definition at line 1414 of file ppc_simd.h.

◆ VecAdd()

template<class T1 , class T2 >
T1 VecAdd ( const T1 vec1,
const T2 vec2 )
inline

Add two vectors.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecAdd() performs vec1 + vec2. vec2 is cast to the same type as vec1. The return vector is the same type as vec1.

Wraps
vec_add
See also
VecAdd64
Since
Crypto++ 6.0

Definition at line 1438 of file ppc_simd.h.

◆ VecSub()

template<class T1 , class T2 >
T1 VecSub ( const T1 vec1,
const T2 vec2 )
inline

Subtract two vectors.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector

VecSub() performs vec1 - vec2. vec2 is cast to the same type as vec1. The return vector is the same type as vec1.

Wraps
vec_sub
See also
VecSub64
Since
Crypto++ 6.0

Definition at line 1456 of file ppc_simd.h.

◆ VecPermute() [1/2]

template<class T1 , class T2 >
T1 VecPermute ( const T1 vec,
const T2 mask )
inline

Permutes a vector.

Template Parameters
T1vector type
T2vector type
Parameters
vecthe vector
maskvector mask
Returns
vector

VecPermute() creates a new vector from vec according to mask. mask is an uint8x16_p vector. The return vector is the same type as vec.

Wraps
vec_perm
Since
Crypto++ 6.0

Definition at line 1478 of file ppc_simd.h.

◆ VecPermute() [2/2]

template<class T1 , class T2 >
T1 VecPermute ( const T1 vec1,
const T1 vec2,
const T2 mask )
inline

Permutes two vectors.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
maskvector mask
Returns
vector

VecPermute() creates a new vector from vec1 and vec2 according to mask. mask is an uint8x16_p vector. The return vector is the same type as vec.

Wraps
vec_perm
Since
Crypto++ 6.0

Definition at line 1496 of file ppc_simd.h.

◆ VecShiftLeftOctet()

template<unsigned int C, class T >
T VecShiftLeftOctet ( const T vec)
inline

Shift a vector left.

Template Parameters
Cshift byte count
Tvector type
Parameters
vecthe vector
Returns
vector

VecShiftLeftOctet() returns a new vector after shifting the concatenation of the zero vector and the source vector by the specified number of bytes. The return vector is the same type as vec.

On big endian machines VecShiftLeftOctet() is vec_sld(a, z, c). On little endian machines VecShiftLeftOctet() is translated to vec_sld(z, a, 16-c). You should always call the function as if on a big endian machine as shown below.

  uint8x16_p x = VecLoad(ptr);
  uint8x16_p y = VecShiftLeftOctet<12>(x);
Wraps
vec_sld
See also
Is vec_sld endian sensitive? on Stack Overflow
Since
Crypto++ 6.0

Definition at line 1528 of file ppc_simd.h.

◆ VecShiftRightOctet()

template<unsigned int C, class T >
T VecShiftRightOctet ( const T vec)
inline

Shift a vector right.

Template Parameters
Cshift byte count
Tvector type
Parameters
vecthe vector
Returns
vector

VecShiftRightOctet() returns a new vector after shifting the concatenation of the zero vector and the source vector by the specified number of bytes. The return vector is the same type as vec.

On big endian machines VecShiftRightOctet() is vec_sld(a, z, c). On little endian machines VecShiftRightOctet() is translated to vec_sld(z, a, 16-c). You should always call the function as if on a big endian machine as shown below.

  uint8x16_p x = VecLoad(ptr);
  uint8x16_p y = VecShiftRightOctet<12>(y);
Wraps
vec_sld
See also
Is vec_sld endian sensitive? on Stack Overflow
Since
Crypto++ 6.0

Definition at line 1575 of file ppc_simd.h.

◆ VecRotateLeftOctet()

template<unsigned int C, class T >
T VecRotateLeftOctet ( const T vec)
inline

Rotate a vector left.

Template Parameters
Cshift byte count
Tvector type
Parameters
vecthe vector
Returns
vector

VecRotateLeftOctet() returns a new vector after rotating the concatenation of the source vector with itself by the specified number of bytes. The return vector is the same type as vec.

Wraps
vec_sld
See also
Is vec_sld endian sensitive? on Stack Overflow
Since
Crypto++ 6.0

Definition at line 1614 of file ppc_simd.h.

◆ VecRotateRightOctet()

template<unsigned int C, class T >
T VecRotateRightOctet ( const T vec)
inline

Rotate a vector right.

Template Parameters
Cshift byte count
Tvector type
Parameters
vecthe vector
Returns
vector

VecRotateRightOctet() returns a new vector after rotating the concatenation of the source vector with itself by the specified number of bytes. The return vector is the same type as vec.

Wraps
vec_sld
See also
Is vec_sld endian sensitive? on Stack Overflow
Since
Crypto++ 6.0

Definition at line 1639 of file ppc_simd.h.

◆ VecRotateLeft() [1/2]

template<unsigned int C>
uint32x4_p VecRotateLeft ( const uint32x4_p vec)
inline

Rotate a vector left.

Template Parameters
Crotate bit count
Parameters
vecthe vector
Returns
vector

VecRotateLeft() rotates each element in a vector by bit count. The return vector is the same type as vec.

Wraps
vec_rl
Since
Crypto++ 7.0

Definition at line 1660 of file ppc_simd.h.

◆ VecRotateRight() [1/2]

template<unsigned int C>
uint32x4_p VecRotateRight ( const uint32x4_p vec)
inline

Rotate a vector right.

Template Parameters
Crotate bit count
Parameters
vecthe vector
Returns
vector

VecRotateRight() rotates each element in a vector by bit count. The return vector is the same type as vec.

Wraps
vec_rl
Since
Crypto++ 7.0

Definition at line 1676 of file ppc_simd.h.

◆ VecShiftLeft() [1/2]

template<unsigned int C>
uint32x4_p VecShiftLeft ( const uint32x4_p vec)
inline

Shift a vector left.

Template Parameters
Cshift bit count
Parameters
vecthe vector
Returns
vector

VecShiftLeft() rotates each element in a vector by bit count. The return vector is the same type as vec.

Wraps
vec_sl
Since
Crypto++ 8.1

Definition at line 1692 of file ppc_simd.h.

◆ VecShiftRight() [1/2]

template<unsigned int C>
uint32x4_p VecShiftRight ( const uint32x4_p vec)
inline

Shift a vector right.

Template Parameters
Cshift bit count
Parameters
vecthe vector
Returns
vector

VecShiftRight() rotates each element in a vector by bit count. The return vector is the same type as vec.

Wraps
vec_rl
Since
Crypto++ 8.1

Definition at line 1708 of file ppc_simd.h.

◆ VecRotateLeft() [2/2]

template<unsigned int C>
uint64x2_p VecRotateLeft ( const uint64x2_p vec)
inline

Rotate a vector left.

Template Parameters
Crotate bit count
Parameters
vecthe vector
Returns
vector

VecRotateLeft() rotates each element in a vector by bit count. The return vector is the same type as vec.

VecRotateLeft() with 64-bit elements is available on POWER8 and above.

Wraps
vec_rl
Since
Crypto++ 8.0

Definition at line 1729 of file ppc_simd.h.

◆ VecShiftLeft() [2/2]

template<unsigned int C>
uint64x2_p VecShiftLeft ( const uint64x2_p vec)
inline

Shift a vector left.

Template Parameters
Cshift bit count
Parameters
vecthe vector
Returns
vector

VecShiftLeft() rotates each element in a vector by bit count. The return vector is the same type as vec.

VecShiftLeft() with 64-bit elements is available on POWER8 and above.

Wraps
vec_sl
Since
Crypto++ 8.1

Definition at line 1747 of file ppc_simd.h.

◆ VecRotateRight() [2/2]

template<unsigned int C>
uint64x2_p VecRotateRight ( const uint64x2_p vec)
inline

Rotate a vector right.

Template Parameters
Crotate bit count
Parameters
vecthe vector
Returns
vector

VecRotateRight() rotates each element in a vector by bit count. The return vector is the same type as vec.

VecRotateRight() with 64-bit elements is available on POWER8 and above.

Wraps
vec_rl
Since
Crypto++ 8.0

Definition at line 1765 of file ppc_simd.h.

◆ VecShiftRight() [2/2]

template<unsigned int C>
uint64x2_p VecShiftRight ( const uint64x2_p vec)
inline

Shift a vector right.

Template Parameters
Cshift bit count
Parameters
vecthe vector
Returns
vector

VecShiftRight() rotates each element in a vector by bit count. The return vector is the same type as vec.

VecShiftRight() with 64-bit elements is available on POWER8 and above.

Wraps
vec_sr
Since
Crypto++ 8.1

Definition at line 1783 of file ppc_simd.h.

◆ VecMergeLow()

template<class T >
T VecMergeLow ( const T vec1,
const T vec2 )
inline

Merge two vectors.

Template Parameters
Tvector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector
Wraps
vec_mergel
Since
Crypto++ 8.1

Definition at line 1805 of file ppc_simd.h.

◆ VecMergeHigh()

template<class T >
T VecMergeHigh ( const T vec1,
const T vec2 )
inline

Merge two vectors.

Template Parameters
Tvector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector
Wraps
vec_mergeh
Since
Crypto++ 8.1

Definition at line 1819 of file ppc_simd.h.

◆ VecSplatWord() [1/2]

uint32x4_p VecSplatWord ( word32 val)
inline

Broadcast 32-bit word to a vector.

Parameters
valthe 32-bit value
Returns
vector
Wraps
vec_splats
Since
Crypto++ 8.3

Definition at line 1830 of file ppc_simd.h.

◆ VecSplatElement() [1/2]

template<unsigned int N>
uint32x4_p VecSplatElement ( const uint32x4_p val)
inline

Broadcast 32-bit element to a vector.

Template Parameters
theelement number
Parameters
valthe 32-bit value
Returns
vector
Wraps
vec_splat
Since
Crypto++ 8.3

Definition at line 1855 of file ppc_simd.h.

◆ VecSplatWord() [2/2]

uint64x2_p VecSplatWord ( word64 val)
inline

Broadcast 64-bit double word to a vector.

Parameters
valthe 64-bit value
Returns
vector
Wraps
vec_splats
Since
Crypto++ 8.3

Definition at line 1867 of file ppc_simd.h.

◆ VecSplatElement() [2/2]

template<unsigned int N>
uint64x2_p VecSplatElement ( const uint64x2_p val)
inline

Broadcast 64-bit element to a vector.

Template Parameters
theelement number
Parameters
valthe 64-bit value
Returns
vector
Wraps
vec_splat
Since
Crypto++ 8.3

Definition at line 1881 of file ppc_simd.h.

◆ VecGetLow()

template<class T >
T VecGetLow ( const T val)
inline

Extract a dword from a vector.

Template Parameters
Tvector type
Parameters
valthe vector
Returns
vector created from low dword

VecGetLow() extracts the low dword from a vector. The low dword is composed of the least significant bits and occupies bytes 8 through 15 when viewed as a big endian array. The return vector is the same type as the original vector and padded with 0's in the most significant bit positions.

Wraps
vec_sld
Since
Crypto++ 7.0

Definition at line 1913 of file ppc_simd.h.

◆ VecGetHigh()

template<class T >
T VecGetHigh ( const T val)
inline

Extract a dword from a vector.

Template Parameters
Tvector type
Parameters
valthe vector
Returns
vector created from high dword

VecGetHigh() extracts the high dword from a vector. The high dword is composed of the most significant bits and occupies bytes 0 through 7 when viewed as a big endian array. The return vector is the same type as the original vector and padded with 0's in the most significant bit positions.

Wraps
vec_sld
Since
Crypto++ 7.0

Definition at line 1935 of file ppc_simd.h.

◆ VecSwapWords()

template<class T >
T VecSwapWords ( const T vec)
inline

Exchange high and low double words.

Template Parameters
Tvector type
Parameters
vecthe vector
Returns
vector
Wraps
vec_sld
Since
Crypto++ 7.0

Definition at line 1953 of file ppc_simd.h.

◆ VecEqual()

template<class T1 , class T2 >
bool VecEqual ( const T1 vec1,
const T2 vec2 )
inline

Compare two vectors.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
true if vec1 equals vec2, false otherwise

VecEqual() performs a bitwise compare. The vector element types do not matter.

Wraps
vec_all_eq
Since
Crypto++ 8.0

Definition at line 1975 of file ppc_simd.h.

◆ VecNotEqual()

template<class T1 , class T2 >
bool VecNotEqual ( const T1 vec1,
const T2 vec2 )
inline

Compare two vectors.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
true if vec1 does not equal vec2, false otherwise

VecNotEqual() performs a bitwise compare. The vector element types do not matter.

Wraps
vec_all_eq
Since
Crypto++ 8.0

Definition at line 1992 of file ppc_simd.h.

◆ VecAdd64() [1/2]

uint32x4_p VecAdd64 ( const uint32x4_p & vec1,
const uint32x4_p & vec2 )
inline

Add two vectors as if uint64x2_p.

Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecAdd64() performs vec1 + vec2. VecAdd64() performs as if adding two uint64x2_p vectors. On POWER7 and below VecAdd64() manages the carries from the elements.

Wraps
vec_add for POWER8, vec_addc, vec_perm, vec_add for Altivec
Since
Crypto++ 8.3

Definition at line 2014 of file ppc_simd.h.

◆ VecAdd64() [2/2]

uint64x2_p VecAdd64 ( const uint64x2_p & vec1,
const uint64x2_p & vec2 )
inline

Add two vectors as if uint64x2_p.

Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecAdd64() performs vec1 + vec2. VecAdd64() performs as if adding two uint64x2_p vectors. On POWER7 and below VecAdd64() manages the carries from the elements.

Wraps
vec_add for POWER8
Since
Crypto++ 8.3

Definition at line 2050 of file ppc_simd.h.

◆ VecSub64() [1/2]

uint32x4_p VecSub64 ( const uint32x4_p & vec1,
const uint32x4_p & vec2 )
inline

Subtract two vectors as if uint64x2_p.

Parameters
vec1the first vector
vec2the second vector

VecSub64() performs vec1 - vec2. VecSub64() performs as if subtracting two uint64x2_p vectors. On POWER7 and below VecSub64() manages the borrows from the elements.

Wraps
vec_sub for POWER8, vec_subc, vec_andc, vec_perm, vec_sub for Altivec
Since
Crypto++ 8.3

Definition at line 2077 of file ppc_simd.h.

◆ VecSub64() [2/2]

uint64x2_p VecSub64 ( const uint64x2_p & vec1,
const uint64x2_p & vec2 )
inline

Subtract two vectors as if uint64x2_p.

Parameters
vec1the first vector
vec2the second vector

VecSub64() performs vec1 - vec2. VecSub64() performs as if subtracting two uint64x2_p vectors. On POWER7 and below VecSub64() manages the borrows from the elements.

Wraps
vec_sub for POWER8
Since
Crypto++ 8.3

Definition at line 2114 of file ppc_simd.h.

◆ VecRotateLeft64() [1/2]

template<unsigned int C>
uint32x4_p VecRotateLeft64 ( const uint32x4_p vec)
inline

Rotate a vector left as if uint64x2_p.

Template Parameters
Crotate bit count
Parameters
vecthe vector
Returns
vector

VecRotateLeft() rotates each element in a vector by bit count. vec is rotated as if uint64x2_p.

Wraps
vec_rl
Since
Crypto++ 8.3

Definition at line 2142 of file ppc_simd.h.

◆ VecRotateLeft64< 8 >()

template<>
uint32x4_p VecRotateLeft64< 8 > ( const uint32x4_p vec)
inline

Rotate a vector left as if uint64x2_p.

Parameters
vecthe vector
Returns
vector

VecRotateLeft<8>() rotates each element in a vector by 8-bits. vec is rotated as if uint64x2_p. This specialization is used by algorithms like Speck128.

Wraps
vec_rl
Since
Crypto++ 8.3

Definition at line 2191 of file ppc_simd.h.

◆ VecRotateLeft64() [2/2]

template<unsigned int C>
uint64x2_p VecRotateLeft64 ( const uint64x2_p vec)
inline

Rotate a vector left as if uint64x2_p.

Template Parameters
Crotate bit count
Parameters
vecthe vector
Returns
vector

VecRotateLeft64() rotates each element in a vector by bit count. vec is rotated as if uint64x2_p.

Wraps
vec_rl
Since
Crypto++ 8.3

Definition at line 2213 of file ppc_simd.h.

◆ VecRotateRight64() [1/2]

template<unsigned int C>
uint32x4_p VecRotateRight64 ( const uint32x4_p vec)
inline

Rotate a vector right as if uint64x2_p.

Template Parameters
Crotate bit count
Parameters
vecthe vector
Returns
vector

VecRotateRight64() rotates each element in a vector by bit count. vec is rotated as if uint64x2_p.

Wraps
vec_rl
Since
Crypto++ 8.3

Definition at line 2240 of file ppc_simd.h.

◆ VecRotateRight64< 8 >()

template<>
uint32x4_p VecRotateRight64< 8 > ( const uint32x4_p vec)
inline

Rotate a vector right as if uint64x2_p.

Parameters
vecthe vector
Returns
vector

VecRotateRight64<8>() rotates each element in a vector by 8-bits. vec is rotated as if uint64x2_p. This specialization is used by algorithms like Speck128.

vec is rotated as if uint64x2_p.

Wraps
vec_rl
Since
Crypto++ 8.3

Definition at line 2290 of file ppc_simd.h.

◆ VecRotateRight64() [2/2]

template<unsigned int C>
uint64x2_p VecRotateRight64 ( const uint64x2_p vec)
inline

Rotate a vector right as if uint64x2_p.

Template Parameters
Crotate bit count
Parameters
vecthe vector
Returns
vector

VecRotateRight64() rotates each element in a vector by bit count. vec is rotated as if uint64x2_p.

Wraps
vec_rl
Since
Crypto++ 8.3

Definition at line 2312 of file ppc_simd.h.

◆ VecAnd64()

template<class T1 , class T2 >
T1 VecAnd64 ( const T1 vec1,
const T2 vec2 )
inline

AND two vectors as if uint64x2_p.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecAnd64() performs vec1 & vec2. vec2 is cast to the same type as vec1. The return vector is the same type as vec1.

VecAnd64() is a convenience function that simply performs a VecAnd().

Wraps
vec_and
Since
Crypto++ 8.3

Definition at line 2343 of file ppc_simd.h.

◆ VecOr64()

template<class T1 , class T2 >
T1 VecOr64 ( const T1 vec1,
const T2 vec2 )
inline

OR two vectors as if uint64x2_p.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecOr64() performs vec1 | vec2. vec2 is cast to the same type as vec1. The return vector is the same type as vec1.

VecOr64() is a convenience function that simply performs a VecOr().

Wraps
vec_or
Since
Crypto++ 8.3

Definition at line 2362 of file ppc_simd.h.

◆ VecXor64()

template<class T1 , class T2 >
T1 VecXor64 ( const T1 vec1,
const T2 vec2 )
inline

XOR two vectors as if uint64x2_p.

Template Parameters
T1vector type
T2vector type
Parameters
vec1the first vector
vec2the second vector
Returns
vector

VecXor64() performs vec1 ^ vec2. vec2 is cast to the same type as vec1. The return vector is the same type as vec1.

VecXor64() is a convenience function that simply performs a VecXor().

Wraps
vec_xor
Since
Crypto++ 8.3

Definition at line 2381 of file ppc_simd.h.

◆ VecSplatWord64()

uint32x4_p VecSplatWord64 ( word64 val)
inline

Broadcast 64-bit double word to a vector.

Parameters
valthe 64-bit value
Returns
vector
Wraps
vec_splats
Since
Crypto++ 8.3

Definition at line 2392 of file ppc_simd.h.

◆ VecSplatElement64() [1/2]

template<unsigned int N>
uint32x4_p VecSplatElement64 ( const uint32x4_p val)
inline

Broadcast 64-bit element to a vector as if uint64x2_p.

Template Parameters
theelement number
Parameters
valthe 64-bit value
Returns
vector
Wraps
vec_splat
Since
Crypto++ 8.3

Definition at line 2411 of file ppc_simd.h.

◆ VecSplatElement64() [2/2]

template<unsigned int N>
uint64x2_p VecSplatElement64 ( const uint64x2_p val)
inline

Broadcast 64-bit element to a vector.

Template Parameters
theelement number
Parameters
valthe 64-bit value
Returns
vector
Since
Crypto++ 8.3

Definition at line 2437 of file ppc_simd.h.

◆ VecPolyMultiply() [1/2]

uint32x4_p VecPolyMultiply ( const uint32x4_p & a,
const uint32x4_p & b )
inline

Polynomial multiplication.

Parameters
athe first term
bthe second term
Returns
vector product

VecPolyMultiply() performs polynomial multiplication. POWER8 polynomial multiplication multiplies the high and low terms, and then XOR's the high and low products. That is, the result is ah*bh XOR al*bl. It is different behavior than Intel polynomial multiplication. To obtain a single product without the XOR, then set one of the high or low terms to 0. For example, setting ah=0 results in 0*bh XOR al*bl = al*bl.

Wraps
__vpmsumw, __builtin_altivec_crypto_vpmsumw and __builtin_crypto_vpmsumw.
Since
Crypto++ 8.1

Definition at line 2468 of file ppc_simd.h.

◆ VecPolyMultiply() [2/2]

uint64x2_p VecPolyMultiply ( const uint64x2_p & a,
const uint64x2_p & b )
inline

Polynomial multiplication.

Parameters
athe first term
bthe second term
Returns
vector product

VecPolyMultiply() performs polynomial multiplication. POWER8 polynomial multiplication multiplies the high and low terms, and then XOR's the high and low products. That is, the result is ah*bh XOR al*bl. It is different behavior than Intel polynomial multiplication. To obtain a single product without the XOR, then set one of the high or low terms to 0. For example, setting ah=0 results in 0*bh XOR al*bl = al*bl.

Wraps
__vpmsumd, __builtin_altivec_crypto_vpmsumd and __builtin_crypto_vpmsumd.
Since
Crypto++ 8.1

Definition at line 2493 of file ppc_simd.h.

◆ VecIntelMultiply00()

uint64x2_p VecIntelMultiply00 ( const uint64x2_p & a,
const uint64x2_p & b )
inline

Polynomial multiplication.

Parameters
athe first term
bthe second term
Returns
vector product

VecIntelMultiply00() performs polynomial multiplication and presents the result like Intel's c = _mm_clmulepi64_si128(a, b, 0x00). The 0x00 indicates the low 64-bits of a and b are multiplied.

Note
An Intel XMM register is composed of 128-bits. The leftmost bit is MSB and numbered 127, while the rightmost bit is LSB and numbered 0.
Wraps
__vpmsumd, __builtin_altivec_crypto_vpmsumd and __builtin_crypto_vpmsumd.
Since
Crypto++ 8.0

Definition at line 2517 of file ppc_simd.h.

◆ VecIntelMultiply01()

uint64x2_p VecIntelMultiply01 ( const uint64x2_p & a,
const uint64x2_p & b )
inline

Polynomial multiplication.

Parameters
athe first term
bthe second term
Returns
vector product

VecIntelMultiply01 performs() polynomial multiplication and presents the result like Intel's c = _mm_clmulepi64_si128(a, b, 0x01). The 0x01 indicates the low 64-bits of a and high 64-bits of b are multiplied.

Note
An Intel XMM register is composed of 128-bits. The leftmost bit is MSB and numbered 127, while the rightmost bit is LSB and numbered 0.
Wraps
__vpmsumd, __builtin_altivec_crypto_vpmsumd and __builtin_crypto_vpmsumd.
Since
Crypto++ 8.0

Definition at line 2539 of file ppc_simd.h.

◆ VecIntelMultiply10()

uint64x2_p VecIntelMultiply10 ( const uint64x2_p & a,
const uint64x2_p & b )
inline

Polynomial multiplication.

Parameters
athe first term
bthe second term
Returns
vector product

VecIntelMultiply10() performs polynomial multiplication and presents the result like Intel's c = _mm_clmulepi64_si128(a, b, 0x10). The 0x10 indicates the high 64-bits of a and low 64-bits of b are multiplied.

Note
An Intel XMM register is composed of 128-bits. The leftmost bit is MSB and numbered 127, while the rightmost bit is LSB and numbered 0.
Wraps
__vpmsumd, __builtin_altivec_crypto_vpmsumd and __builtin_crypto_vpmsumd.
Since
Crypto++ 8.0

Definition at line 2561 of file ppc_simd.h.

◆ VecIntelMultiply11()

uint64x2_p VecIntelMultiply11 ( const uint64x2_p & a,
const uint64x2_p & b )
inline

Polynomial multiplication.

Parameters
athe first term
bthe second term
Returns
vector product

VecIntelMultiply11() performs polynomial multiplication and presents the result like Intel's c = _mm_clmulepi64_si128(a, b, 0x11). The 0x11 indicates the high 64-bits of a and b are multiplied.

Note
An Intel XMM register is composed of 128-bits. The leftmost bit is MSB and numbered 127, while the rightmost bit is LSB and numbered 0.
Wraps
__vpmsumd, __builtin_altivec_crypto_vpmsumd and __builtin_crypto_vpmsumd.
Since
Crypto++ 8.0

Definition at line 2583 of file ppc_simd.h.

◆ VecEncrypt()

template<class T1 , class T2 >
T1 VecEncrypt ( const T1 state,
const T2 key )
inline

One round of AES encryption.

Template Parameters
T1vector type
T2vector type
Parameters
statethe state vector
keythe subkey vector

VecEncrypt() performs one round of AES encryption of state using subkey key. The return vector is the same type as state.

VecEncrypt() is available on POWER8 and above.

Wraps
__vcipher, __builtin_altivec_crypto_vcipher, __builtin_crypto_vcipher
Since
GCC and XLC since Crypto++ 6.0, LLVM Clang since Crypto++ 8.0

Definition at line 2609 of file ppc_simd.h.

◆ VecEncryptLast()

template<class T1 , class T2 >
T1 VecEncryptLast ( const T1 state,
const T2 key )
inline

Final round of AES encryption.

Template Parameters
T1vector type
T2vector type
Parameters
statethe state vector
keythe subkey vector

VecEncryptLast() performs the final round of AES encryption of state using subkey key. The return vector is the same type as state.

VecEncryptLast() is available on POWER8 and above.

Wraps
__vcipherlast, __builtin_altivec_crypto_vcipherlast, __builtin_crypto_vcipherlast
Since
GCC and XLC since Crypto++ 6.0, LLVM Clang since Crypto++ 8.0

Definition at line 2634 of file ppc_simd.h.

◆ VecDecrypt()

template<class T1 , class T2 >
T1 VecDecrypt ( const T1 state,
const T2 key )
inline

One round of AES decryption.

Template Parameters
T1vector type
T2vector type
Parameters
statethe state vector
keythe subkey vector

VecDecrypt() performs one round of AES decryption of state using subkey key. The return vector is the same type as state.

VecDecrypt() is available on POWER8 and above.

Wraps
__vncipher, __builtin_altivec_crypto_vncipher, __builtin_crypto_vncipher
Since
GCC and XLC since Crypto++ 6.0, LLVM Clang since Crypto++ 8.0

Definition at line 2659 of file ppc_simd.h.

◆ VecDecryptLast()

template<class T1 , class T2 >
T1 VecDecryptLast ( const T1 state,
const T2 key )
inline

Final round of AES decryption.

Template Parameters
T1vector type
T2vector type
Parameters
statethe state vector
keythe subkey vector

VecDecryptLast() performs the final round of AES decryption of state using subkey key. The return vector is the same type as state.

VecDecryptLast() is available on POWER8 and above.

Wraps
__vncipherlast, __builtin_altivec_crypto_vncipherlast, __builtin_crypto_vncipherlast
Since
GCC and XLC since Crypto++ 6.0, LLVM Clang since Crypto++ 8.0

Definition at line 2684 of file ppc_simd.h.

◆ VecSHA256()

template<int func, int fmask, class T >
T VecSHA256 ( const T data)
inline

SHA256 Sigma functions.

Template Parameters
funcfunction
fmaskfunction mask
Tvector type
Parameters
datathe block to transform

VecSHA256() selects sigma0, sigma1, Sigma0, Sigma1 based on func and fmask. The return vector is the same type as data.

VecSHA256() is available on POWER8 and above.

Wraps
__vshasigmaw, __builtin_altivec_crypto_vshasigmaw, __builtin_crypto_vshasigmaw
Since
GCC and XLC since Crypto++ 6.0, LLVM Clang since Crypto++ 8.0

Definition at line 2714 of file ppc_simd.h.

◆ VecSHA512()

template<int func, int fmask, class T >
T VecSHA512 ( const T data)
inline

SHA512 Sigma functions.

Template Parameters
funcfunction
fmaskfunction mask
Tvector type
Parameters
datathe block to transform

VecSHA512() selects sigma0, sigma1, Sigma0, Sigma1 based on func and fmask. The return vector is the same type as data.

VecSHA512() is available on POWER8 and above.

Wraps
__vshasigmad, __builtin_altivec_crypto_vshasigmad, __builtin_crypto_vshasigmad
Since
GCC and XLC since Crypto++ 6.0, LLVM Clang since Crypto++ 8.0

Definition at line 2739 of file ppc_simd.h.