Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions mypyc/build_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,11 @@
from distutils import ccompiler

EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT = {
"unix": {
"base64/arch/ssse3": ["-mssse3"],
"base64/arch/sse41": ["-msse4.1"],
"base64/arch/sse42": ["-msse4.2"],
"base64/arch/avx2": ["-mavx2"],
"base64/arch/avx": ["-mavx"],
},
"msvc": {
"base64/arch/sse42": ["/arch:SSE4.2"],
"base64/arch/avx2": ["/arch:AVX2"],
"base64/arch/avx": ["/arch:AVX"],
},
}
}

ccompiler.CCompiler.__spawn = ccompiler.CCompiler.spawn # type: ignore[attr-defined]
Expand Down
8 changes: 8 additions & 0 deletions mypyc/lib-rt/base64/arch/avx/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#include "../../env.h"

#if HAVE_AVX
#if defined(__clang__)
#pragma clang attribute push (__attribute__((target("avx"))), apply_to=function)
#else
#pragma GCC target("avx")
#endif
#include <immintrin.h>

// Only enable inline assembly on supported compilers and on 64-bit CPUs.
Expand Down Expand Up @@ -62,6 +67,9 @@ base64_stream_decode_avx BASE64_DEC_PARAMS
#include "../generic/dec_head.c"
dec_loop_ssse3(&s, &slen, &o, &olen);
#include "../generic/dec_tail.c"
#if defined(__clang__)
#pragma clang attribute pop
#endif
#else
return base64_dec_stub(state, src, srclen, out, outlen);
#endif
Expand Down
8 changes: 8 additions & 0 deletions mypyc/lib-rt/base64/arch/avx2/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#include "../../env.h"

#if HAVE_AVX2
#if defined(__clang__)
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
#else
#pragma GCC target("avx2")
#endif
#include <immintrin.h>

// Only enable inline assembly on supported compilers and on 64-bit CPUs.
Expand Down Expand Up @@ -52,6 +57,9 @@ base64_stream_decode_avx2 BASE64_DEC_PARAMS
#include "../generic/dec_head.c"
dec_loop_avx2(&s, &slen, &o, &olen);
#include "../generic/dec_tail.c"
#if defined(__clang__)
#pragma clang attribute pop
#endif
#else
return base64_dec_stub(state, src, srclen, out, outlen);
#endif
Expand Down
8 changes: 8 additions & 0 deletions mypyc/lib-rt/base64/arch/avx512/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#include "../../env.h"

#if HAVE_AVX512
#if defined(__clang__)
#pragma clang attribute push (__attribute__((target("avx512vbmi"))), apply_to=function)
#else
#pragma GCC target("avx512vbmi")
#endif
#include <immintrin.h>

#include "../avx2/dec_reshuffle.c"
Expand Down Expand Up @@ -38,6 +43,9 @@ base64_stream_decode_avx512 BASE64_DEC_PARAMS
#include "../generic/dec_head.c"
dec_loop_avx2(&s, &slen, &o, &olen);
#include "../generic/dec_tail.c"
#if defined(__clang__)
#pragma clang attribute pop
#endif
#else
return base64_dec_stub(state, src, srclen, out, outlen);
#endif
Expand Down
8 changes: 8 additions & 0 deletions mypyc/lib-rt/base64/arch/sse41/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#include "../../env.h"

#if HAVE_SSE41
#if defined(__clang__)
#pragma clang attribute push (__attribute__((target("sse4.1"))), apply_to=function)
#else
#pragma GCC target("sse4.1")
#endif
#include <smmintrin.h>

// Only enable inline assembly on supported compilers and on 64-bit CPUs.
Expand Down Expand Up @@ -52,6 +57,9 @@ base64_stream_decode_sse41 BASE64_DEC_PARAMS
#include "../generic/dec_head.c"
dec_loop_ssse3(&s, &slen, &o, &olen);
#include "../generic/dec_tail.c"
#if defined(__clang__)
#pragma clang attribute pop
#endif
#else
return base64_dec_stub(state, src, srclen, out, outlen);
#endif
Expand Down
8 changes: 8 additions & 0 deletions mypyc/lib-rt/base64/arch/sse42/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#include "../../env.h"

#if HAVE_SSE42
#if defined(__clang__)
#pragma clang attribute push (__attribute__((target("sse4.2"))), apply_to=function)
#else
#pragma GCC target("sse4.2")
#endif
#include <nmmintrin.h>

// Only enable inline assembly on supported compilers and on 64-bit CPUs.
Expand Down Expand Up @@ -52,6 +57,9 @@ base64_stream_decode_sse42 BASE64_DEC_PARAMS
#include "../generic/dec_head.c"
dec_loop_ssse3(&s, &slen, &o, &olen);
#include "../generic/dec_tail.c"
#if defined(__clang__)
#pragma clang attribute pop
#endif
#else
return base64_dec_stub(state, src, srclen, out, outlen);
#endif
Expand Down
8 changes: 8 additions & 0 deletions mypyc/lib-rt/base64/arch/ssse3/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#include "../../env.h"

#if HAVE_SSSE3
#if defined(__clang__)
#pragma clang attribute push (__attribute__((target("ssse3"))), apply_to=function)
#else
#pragma GCC target("ssse3")
#endif
#include <tmmintrin.h>

// Only enable inline assembly on supported compilers and on 64-bit CPUs.
Expand Down Expand Up @@ -54,6 +59,9 @@ base64_stream_decode_ssse3 BASE64_DEC_PARAMS
#include "../generic/dec_head.c"
dec_loop_ssse3(&s, &slen, &o, &olen);
#include "../generic/dec_tail.c"
#if defined(__clang__)
#pragma clang attribute pop
#endif
#else
return base64_dec_stub(state, src, srclen, out, outlen);
#endif
Expand Down
9 changes: 1 addition & 8 deletions mypyc/lib-rt/build_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,11 @@
from distutils import ccompiler

EXTRA_FLAGS_PER_COMPILER_TYPE_PER_PATH_COMPONENT = {
"unix": {
"base64/arch/ssse3": ["-mssse3"],
"base64/arch/sse41": ["-msse4.1"],
"base64/arch/sse42": ["-msse4.2"],
"base64/arch/avx2": ["-mavx2"],
"base64/arch/avx": ["-mavx"],
},
"msvc": {
"base64/arch/sse42": ["/arch:SSE4.2"],
"base64/arch/avx2": ["/arch:AVX2"],
"base64/arch/avx": ["/arch:AVX"],
},
}
}

ccompiler.CCompiler.__spawn = ccompiler.CCompiler.spawn # type: ignore[attr-defined]
Expand Down