Botan 3.11.1
Crypto and TLS for C&
simd_avx2_gfni.h
Go to the documentation of this file.
1/*
2* (C) 2024 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_SIMD_AVX2_GFNI_H_
8#define BOTAN_SIMD_AVX2_GFNI_H_
9
10#include <botan/internal/simd_avx2.h>
11
12#include <botan/internal/gfni_utils.h>
13#include <botan/internal/isa_extn.h>
14
15namespace Botan {
16
17template <uint64_t A, uint8_t B>
18BOTAN_FORCE_INLINE BOTAN_FN_ISA_AVX2_GFNI SIMD_8x32 gf2p8affine(const SIMD_8x32& x) {
19 return SIMD_8x32(_mm256_gf2p8affine_epi64_epi8(x.raw(), _mm256_set1_epi64x(A), B));
20}
21
22template <uint64_t A, uint8_t B>
23BOTAN_FORCE_INLINE BOTAN_FN_ISA_AVX2_GFNI SIMD_8x32 gf2p8affineinv(const SIMD_8x32& x) {
24 return SIMD_8x32(_mm256_gf2p8affineinv_epi64_epi8(x.raw(), _mm256_set1_epi64x(A), B));
25}
26
27BOTAN_FORCE_INLINE BOTAN_FN_ISA_AVX2_GFNI SIMD_8x32 gf2p8mul(const SIMD_8x32& a, const SIMD_8x32& b) {
28 return SIMD_8x32(_mm256_gf2p8mul_epi8(a.raw(), b.raw()));
29}
30
31} // namespace Botan
32
33#endif
__m256i BOTAN_FN_ISA_AVX2 raw() const noexcept
Definition simd_avx2.h:340
#define BOTAN_FORCE_INLINE
Definition compiler.h:87
BOTAN_FORCE_INLINE BOTAN_FN_ISA_AVX2_GFNI SIMD_8x32 gf2p8affineinv(const SIMD_8x32 &x)
BOTAN_FORCE_INLINE BOTAN_FN_ISA_AVX2_GFNI SIMD_8x32 gf2p8mul(const SIMD_8x32 &a, const SIMD_8x32 &b)
BOTAN_FORCE_INLINE BOTAN_FN_ISA_AVX2_GFNI SIMD_8x32 gf2p8affine(const SIMD_8x32 &x)