1 #ifndef PQCLEAN_MCELIECE460896_AVX_VEC256_H
2 #define PQCLEAN_MCELIECE460896_AVX_VEC256_H
3 /*
4 This file is for functions related to 256-bit vectors
5 including functions for bitsliced field operations
6 */
7
8
9 #include "vec128.h"
PQCLEAN_MCELIECE460896_AVX_vec256_set1_16b(uint16_t a)10
11 #include <immintrin.h>
12
13 typedef __m256i vec256;
PQCLEAN_MCELIECE460896_AVX_vec256_setzero(void)14
15 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_set1_16b(uint16_t a);
16 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_setzero(void);
17 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_set4x(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3);
PQCLEAN_MCELIECE460896_AVX_vec256_set4x(uint64_t a0,uint64_t a1,uint64_t a2,uint64_t a3)18
19 // Extract requires a literal argument so need to be macros
20 #define PQCLEAN_MCELIECE460896_AVX_vec256_extract2x(a,i) ((vec128) _mm256_extractf128_si256((vec256) (a),(i)))
21 #define PQCLEAN_MCELIECE460896_AVX_vec256_extract(a,i) ((uint64_t) _mm256_extract_epi64((vec256) (a),(i)))
22
23 int PQCLEAN_MCELIECE460896_AVX_vec256_testz(vec256 a);
24 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_and(vec256 a, vec256 b);
25 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_xor(vec256 a, vec256 b);
PQCLEAN_MCELIECE460896_AVX_vec256_and(vec256 a,vec256 b)26 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_or(vec256 a, vec256 b);
27 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_sll_4x(vec256 a, int s);
28 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_srl_4x(vec256 a, int s);
29 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_unpack_low(vec256 a, vec256 b);
PQCLEAN_MCELIECE460896_AVX_vec256_xor(vec256 a,vec256 b)30 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_unpack_high(vec256 a, vec256 b);
31 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_unpack_low_2x(vec256 a, vec256 b);
32 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_unpack_high_2x(vec256 a, vec256 b);
33 vec256 PQCLEAN_MCELIECE460896_AVX_vec256_or_reduce(const vec256 *a);
PQCLEAN_MCELIECE460896_AVX_vec256_or(vec256 a,vec256 b)34 void PQCLEAN_MCELIECE460896_AVX_vec256_copy(vec256 *dest, const vec256 *src);
35
36 /* bitsliced field multiplications */
37 void PQCLEAN_MCELIECE460896_AVX_vec256_mul(vec256 *h, vec256 *f, const vec256 *g);
PQCLEAN_MCELIECE460896_AVX_vec256_sll_4x(vec256 a,int s)38 void PQCLEAN_MCELIECE460896_AVX_vec256_sq(vec256 * /*out*/, const vec256 * /*in*/);
39 void PQCLEAN_MCELIECE460896_AVX_vec256_inv(vec256 * /*out*/, const vec256 * /*in*/);
40
41 extern void PQCLEAN_MCELIECE460896_AVX_vec256_maa_asm(vec256 *, vec256 *, const vec256 *);
PQCLEAN_MCELIECE460896_AVX_vec256_srl_4x(vec256 a,int s)42 extern void PQCLEAN_MCELIECE460896_AVX_vec256_ama_asm(vec256 *, vec256 *, const vec256 *);
43
44 #endif
45
PQCLEAN_MCELIECE460896_AVX_vec256_unpack_low(vec256 a,vec256 b)46