1 #ifndef PQCLEAN_MCELIECE460896_AVX_VEC128_H
2 #define PQCLEAN_MCELIECE460896_AVX_VEC128_H
PQCLEAN_MCELIECE460896_AVX_vec128_set1_16b(uint16_t a)3 /*
4   This file is for functions related to 128-bit vectors
5   including functions for bitsliced field operations
6 */
7 
8 
9 #include "params.h"
10 
11 #include <immintrin.h>
12 #include <stdint.h>
13 
14 typedef __m128i vec128;
PQCLEAN_MCELIECE460896_AVX_vec128_and(vec128 a,vec128 b)15 
16 // this needs to be a macro, because
17 // _mm_extract_epi64 requires a literal int argument.
18 #define PQCLEAN_MCELIECE460896_AVX_vec128_extract(a, i) ((uint64_t) _mm_extract_epi64((vec128) (a), (i)))
19 
20 int PQCLEAN_MCELIECE460896_AVX_vec128_testz(vec128 a);
21 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_set1_16b(uint16_t a);
22 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_setzero(void);
PQCLEAN_MCELIECE460896_AVX_vec128_or(vec128 a,vec128 b)23 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_and(vec128 a, vec128 b);
24 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_xor(vec128 a, vec128 b);
25 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_or(vec128 a, vec128 b);
26 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_sll_2x(vec128 a, int s);
PQCLEAN_MCELIECE460896_AVX_vec128_sll_2x(vec128 a,int s)27 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_srl_2x(vec128 a, int s);
28 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_set2x(uint64_t a0, uint64_t a1);
29 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_unpack_low(vec128 a, vec128 b);
30 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_unpack_high(vec128 a, vec128 b);
PQCLEAN_MCELIECE460896_AVX_vec128_srl_2x(vec128 a,int s)31 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_setbits(uint64_t a);
32 void PQCLEAN_MCELIECE460896_AVX_vec128_copy(vec128 *dest, const vec128 *src);
33 void PQCLEAN_MCELIECE460896_AVX_vec128_add(vec128 *c, const vec128 *a, const vec128 *b);
34 vec128 PQCLEAN_MCELIECE460896_AVX_vec128_or_reduce(const vec128 *a);
PQCLEAN_MCELIECE460896_AVX_vec128_set2x(uint64_t a0,uint64_t a1)35 
36 extern void PQCLEAN_MCELIECE460896_AVX_vec128_mul_asm(vec128 *, vec128 *, const vec128 *, int);
37 
38 /* bitsliced field multiplications */
PQCLEAN_MCELIECE460896_AVX_vec128_unpack_low(vec128 a,vec128 b)39 void PQCLEAN_MCELIECE460896_AVX_vec128_mul(vec128 *h, vec128 *f, const vec128 *g);
40 
41 #endif
42