| 1 |
#include <stdint.h> |
| 2 |
#include <stddef.h> |
| 3 |
#include <stdlib.h> |
| 4 |
|
| 5 |
#include "libbase64.h" |
| 6 |
#include "../../tables/tables.h" |
| 7 |
#include "../../codecs.h" |
| 8 |
#include "config.h" |
| 9 |
#include "../../env.h" |
| 10 |
|
| 11 |
#if HAVE_AVX512 |
| 12 |
#if defined(__clang__) |
| 13 |
#pragma clang attribute push (__attribute__((target("avx512vbmi"))), apply_to=function) |
| 14 |
#else |
| 15 |
#pragma GCC target("avx512vbmi") |
| 16 |
#endif |
| 17 |
#include <immintrin.h> |
| 18 |
|
| 19 |
#include "../avx2/dec_reshuffle.c" |
| 20 |
#include "../avx2/dec_loop.c" |
| 21 |
#include "enc_reshuffle_translate.c" |
| 22 |
#include "enc_loop.c" |
| 23 |
|
| 24 |
#endif // HAVE_AVX512 |
| 25 |
|
| 26 |
void |
| 27 |
base64_stream_encode_avx512 BASE64_ENC_PARAMS |
| 28 |
{ |
| 29 |
#if HAVE_AVX512 |
| 30 |
#include "../generic/enc_head.c" |
| 31 |
enc_loop_avx512(&s, &slen, &o, &olen); |
| 32 |
#include "../generic/enc_tail.c" |
| 33 |
#else |
| 34 |
base64_enc_stub(state, src, srclen, out, outlen); |
| 35 |
#endif |
| 36 |
} |
| 37 |
|
| 38 |
// Reuse AVX2 decoding. Not supporting AVX512 at present |
| 39 |
int |
| 40 |
base64_stream_decode_avx512 BASE64_DEC_PARAMS |
| 41 |
{ |
| 42 |
#if HAVE_AVX512 |
| 43 |
#include "../generic/dec_head.c" |
| 44 |
dec_loop_avx2(&s, &slen, &o, &olen); |
| 45 |
#include "../generic/dec_tail.c" |
| 46 |
#if defined(__clang__) |
| 47 |
#pragma clang attribute pop |
| 48 |
#endif |
| 49 |
#else |
| 50 |
return base64_dec_stub(state, src, srclen, out, outlen); |
| 51 |
#endif |
| 52 |
} |