SIMD. resolve imports

This commit is contained in:
Alexander Karpinsky 2021-12-20 00:08:10 +03:00
parent fc915a4ed5
commit d40b9f0ab4
3 changed files with 29 additions and 28 deletions

View File

@ -9,19 +9,6 @@
#include "Python.h"
/* Microsoft compiler doesn't limit intrinsics for an architecture.
This macro is set only on x86 and means SSE2 and above including AVX2. */
#if defined(_M_X64) || _M_IX86_FP == 2
#define __SSE4_2__
#endif
#if defined(__SSE4_2__)
#include <emmintrin.h>
#include <mmintrin.h>
#include <smmintrin.h>
#endif
#if defined(__AVX2__)
#include <immintrin.h>
#endif
/* Check that we have an ANSI compliant compiler */
#ifndef HAVE_PROTOTYPES
@ -98,3 +85,5 @@ typedef signed __int64 int64_t;
#ifdef __GNUC__
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
#include "ImagingSIMD.h"

View File

@ -0,0 +1,27 @@
/* Microsoft compiler doesn't limit intrinsics for an architecture.
This macro is set only on x86 and means SSE2 and above including AVX2. */
#if defined(_M_X64) || _M_IX86_FP == 2
#define __SSE4_2__
#endif
#if defined(__SSE4_2__)
#include <emmintrin.h>
#include <mmintrin.h>
#include <smmintrin.h>
#endif
#if defined(__AVX2__)
#include <immintrin.h>
#endif
#if defined(__SSE4_2__)
static __m128i inline
mm_cvtepu8_epi32(void *ptr) {
return _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*(INT32 *) ptr));
}
#endif
#if defined(__AVX2__)
static __m256i inline
mm256_cvtepu8_epi32(void *ptr) {
return _mm256_cvtepu8_epi32(_mm_loadl_epi64((__m128i *) ptr));
}
#endif

View File

@ -40,18 +40,3 @@ static float __attribute__((always_inline)) inline _i2f(int v) {
#else
static float inline _i2f(int v) { return (float)v; }
#endif
#if defined(__SSE4_2__)
static __m128i inline
mm_cvtepu8_epi32(void *ptr) {
return _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*(INT32 *) ptr));
}
#endif
#if defined(__AVX2__)
static __m256i inline
mm256_cvtepu8_epi32(void *ptr) {
return _mm256_cvtepu8_epi32(_mm_loadl_epi64((__m128i *) ptr));
}
#endif