diff --git a/blosc/bitshuffle-avx2.c b/blosc/bitshuffle-avx2.c index 880dff12..b90f3226 100644 --- a/blosc/bitshuffle-avx2.c +++ b/blosc/bitshuffle-avx2.c @@ -18,9 +18,7 @@ /* Make sure AVX2 is available for the compilation target and compiler. */ -#if !defined(__AVX2__) - #error AVX2 is not supported by the target architecture/platform and/or this compiler. -#endif +#if defined(__AVX2__) #include @@ -243,3 +241,5 @@ int64_t blosc_internal_bshuf_untrans_bit_elem_avx2(void* in, void* out, const si return count; } + +#endif /* !defined(__AVX2__) */ diff --git a/blosc/bitshuffle-sse2.c b/blosc/bitshuffle-sse2.c index e70c7641..7a853d22 100644 --- a/blosc/bitshuffle-sse2.c +++ b/blosc/bitshuffle-sse2.c @@ -16,9 +16,7 @@ #include "bitshuffle-sse2.h" /* Make sure SSE2 is available for the compilation target and compiler. */ -#if !defined(__SSE2__) - #error SSE2 is not supported by the target architecture/platform and/or this compiler. -#endif +#if defined(__SSE2__) #include @@ -465,3 +463,5 @@ int64_t blosc_internal_bshuf_untrans_bit_elem_sse2(void* in, void* out, const si return count; } + +#endif /* !defined(__SSE2__) */ diff --git a/blosc/shuffle-avx2.c b/blosc/shuffle-avx2.c index b987501b..c9413331 100644 --- a/blosc/shuffle-avx2.c +++ b/blosc/shuffle-avx2.c @@ -10,9 +10,7 @@ #include "shuffle-avx2.h" /* Make sure AVX2 is available for the compilation target and compiler. */ -#if !defined(__AVX2__) - #error AVX2 is not supported by the target architecture/platform and/or this compiler. -#endif +#if defined(__AVX2__) #include @@ -755,3 +753,5 @@ blosc_internal_unshuffle_avx2(const size_t bytesoftype, const size_t blocksize, unshuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest); } } + +#endif /* !defined(__AVX2__) */ diff --git a/blosc/shuffle-sse2.c b/blosc/shuffle-sse2.c index 70ee114c..69386ef2 100644 --- a/blosc/shuffle-sse2.c +++ b/blosc/shuffle-sse2.c @@ -10,9 +10,7 @@ #include "shuffle-sse2.h" /* Make sure SSE2 is available for the compilation target and compiler. */ -#if !defined(__SSE2__) - #error SSE2 is not supported by the target architecture/platform and/or this compiler. -#endif +#if defined(__SSE2__) #include @@ -624,3 +622,5 @@ blosc_internal_unshuffle_sse2(const size_t bytesoftype, const size_t blocksize, unshuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest); } } + +#endif /* !defined(__SSE2__) */ diff --git a/blosc/shuffle.c b/blosc/shuffle.c index 7a03bf1d..7b4ce6b4 100644 --- a/blosc/shuffle.c +++ b/blosc/shuffle.c @@ -35,18 +35,26 @@ typedef unsigned char bool; #define HAVE_CPU_FEAT_INTRIN #endif +#if defined(SHUFFLE_AVX2_ENABLED) && defined(__AVX2__) +#define SHUFFLE_USE_AVX2 +#endif + +#if defined(SHUFFLE_SSE2_ENABLED) && defined(__SSE2__) +#define SHUFFLE_USE_SSE2 +#endif + /* Include hardware-accelerated shuffle/unshuffle routines based on the target architecture. Note that a target architecture may support more than one type of acceleration!*/ -#if defined(SHUFFLE_AVX2_ENABLED) +#if defined(SHUFFLE_USE_AVX2) #include "shuffle-avx2.h" #include "bitshuffle-avx2.h" -#endif /* defined(SHUFFLE_AVX2_ENABLED) */ +#endif /* defined(SHUFFLE_USE_AVX2) */ -#if defined(SHUFFLE_SSE2_ENABLED) +#if defined(SHUFFLE_USE_SSE2) #include "shuffle-sse2.h" #include "bitshuffle-sse2.h" -#endif /* defined(SHUFFLE_SSE2_ENABLED) */ +#endif /* defined(SHUFFLE_USE_SSE2) */ /* Define function pointer types for shuffle/unshuffle routines. */ @@ -77,7 +85,7 @@ typedef enum { /* Detect hardware and set function pointers to the best shuffle/unshuffle implementations supported by the host processor. */ -#if defined(SHUFFLE_AVX2_ENABLED) || defined(SHUFFLE_SSE2_ENABLED) /* Intel/i686 */ +#if defined(SHUFFLE_USE_AVX2) || defined(SHUFFLE_USE_SSE2) /* Intel/i686 */ /* Disabled the __builtin_cpu_supports() call, as it has issues with new versions of gcc (like 5.3.1 in forthcoming ubuntu/xenial: @@ -316,7 +324,7 @@ static shuffle_implementation_t get_shuffle_implementation(void) { blosc_cpu_features cpu_features = blosc_get_cpu_features(); shuffle_implementation_t impl_generic; -#if defined(SHUFFLE_AVX2_ENABLED) +#if defined(SHUFFLE_USE_AVX2) if (cpu_features & BLOSC_HAVE_AVX2) { shuffle_implementation_t impl_avx2; impl_avx2.name = "avx2"; @@ -326,9 +334,9 @@ static shuffle_implementation_t get_shuffle_implementation(void) { impl_avx2.bitunshuffle = (bitunshuffle_func)blosc_internal_bshuf_untrans_bit_elem_avx2; return impl_avx2; } -#endif /* defined(SHUFFLE_AVX2_ENABLED) */ +#endif /* defined(SHUFFLE_USE_AVX2) */ -#if defined(SHUFFLE_SSE2_ENABLED) +#if defined(SHUFFLE_USE_SSE2) if (cpu_features & BLOSC_HAVE_SSE2) { shuffle_implementation_t impl_sse2; impl_sse2.name = "sse2"; @@ -338,7 +346,7 @@ static shuffle_implementation_t get_shuffle_implementation(void) { impl_sse2.bitunshuffle = (bitunshuffle_func)blosc_internal_bshuf_untrans_bit_elem_sse2; return impl_sse2; } -#endif /* defined(SHUFFLE_SSE2_ENABLED) */ +#endif /* defined(SHUFFLE_USE_SSE2) */ /* Processor doesn't support any of the hardware-accelerated implementations, so use the generic implementation. */