Skip to content

Commit

Permalink
Use SHUFFLE_USE_* macros in shuffle.c
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 authored and FrancescAlted committed Dec 14, 2022
1 parent dd57c03 commit c603171
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions blosc/shuffle.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
/* 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) */

#if defined(SHUFFLE_NEON_ENABLED)
#if defined(SHUFFLE_USE_NEON)
#if defined(__linux__)
#include <sys/auxv.h>
#ifdef ARM_ASM_HWCAP
Expand All @@ -44,12 +44,12 @@
#endif
#include "shuffle-neon.h"
#include "bitshuffle-neon.h"
#endif /* defined(SHUFFLE_NEON_ENABLED) */
#endif /* defined(SHUFFLE_USE_NEON) */

#if defined(SHUFFLE_ALTIVEC_ENABLED)
#if defined(SHUFFLE_USE_ALTIVEC)
#include "shuffle-altivec.h"
#include "bitshuffle-altivec.h"
#endif /* defined(SHUFFLE_ALTIVEC_ENABLED) */
#endif /* defined(SHUFFLE_USE_ALTIVEC) */


/* Define function pointer types for shuffle/unshuffle routines. */
Expand Down Expand Up @@ -84,7 +84,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:
Expand Down Expand Up @@ -250,7 +250,7 @@ static blosc_cpu_features blosc_get_cpu_features(void) {
}
#endif /* HAVE_CPU_FEAT_INTRIN */

#elif defined(SHUFFLE_NEON_ENABLED) /* ARM-NEON */
#elif defined(SHUFFLE_USE_NEON) /* ARM-NEON */
static blosc_cpu_features blosc_get_cpu_features(void) {
blosc_cpu_features cpu_features = BLOSC_HAVE_NOTHING;
#if defined(__aarch64__)
Expand All @@ -263,7 +263,7 @@ static blosc_cpu_features blosc_get_cpu_features(void) {
#endif
return cpu_features;
}
#elif defined(SHUFFLE_ALTIVEC_ENABLED) /* POWER9-ALTIVEC preliminary test*/
#elif defined(SHUFFLE_USE_ALTIVEC) /* POWER9-ALTIVEC preliminary test*/
static blosc_cpu_features blosc_get_cpu_features(void) {
blosc_cpu_features cpu_features = BLOSC_HAVE_NOTHING;
cpu_features |= BLOSC_HAVE_ALTIVEC;
Expand All @@ -280,11 +280,11 @@ static blosc_cpu_features blosc_get_cpu_features(void) {
return BLOSC_HAVE_NOTHING;
}

#endif /* defined(SHUFFLE_AVX2_ENABLED) || defined(SHUFFLE_SSE2_ENABLED) */
#endif /* defined(SHUFFLE_USE_AVX2) || defined(SHUFFLE_USE_SSE2) */

static shuffle_implementation_t get_shuffle_implementation(void) {
blosc_cpu_features cpu_features = blosc_get_cpu_features();
#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";
Expand All @@ -294,9 +294,9 @@ static shuffle_implementation_t get_shuffle_implementation(void) {
impl_avx2.bitunshuffle = (bitunshuffle_func)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";
Expand All @@ -306,9 +306,9 @@ static shuffle_implementation_t get_shuffle_implementation(void) {
impl_sse2.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_sse2;
return impl_sse2;
}
#endif /* defined(SHUFFLE_SSE2_ENABLED) */
#endif /* defined(SHUFFLE_USE_SSE2) */

#if defined(SHUFFLE_NEON_ENABLED)
#if defined(SHUFFLE_USE_NEON)
if (cpu_features & BLOSC_HAVE_NEON) {
shuffle_implementation_t impl_neon;
impl_neon.name = "neon";
Expand All @@ -326,9 +326,9 @@ static shuffle_implementation_t get_shuffle_implementation(void) {
impl_neon.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_scal;
return impl_neon;
}
#endif /* defined(SHUFFLE_NEON_ENABLED) */
#endif /* defined(SHUFFLE_USE_NEON) */

#if defined(SHUFFLE_ALTIVEC_ENABLED)
#if defined(SHUFFLE_USE_ALTIVEC)
if (cpu_features & BLOSC_HAVE_ALTIVEC) {
shuffle_implementation_t impl_altivec;
impl_altivec.name = "altivec";
Expand All @@ -338,7 +338,7 @@ static shuffle_implementation_t get_shuffle_implementation(void) {
impl_altivec.bitunshuffle = (bitunshuffle_func)bshuf_untrans_bit_elem_altivec;
return impl_altivec;
}
#endif /* defined(SHUFFLE_ALTIVEC_ENABLED) */
#endif /* defined(SHUFFLE_USE_ALTIVEC) */

/* Processor doesn't support any of the hardware-accelerated implementations,
so use the generic implementation. */
Expand Down

0 comments on commit c603171

Please sign in to comment.