diff --git a/include/simdcomputil.h b/include/simdcomputil.h index de91517..a0c446d 100644 --- a/include/simdcomputil.h +++ b/include/simdcomputil.h @@ -31,14 +31,14 @@ uint32_t simdmin(const uint32_t * in); /* computes (quickly) the minimal value of the specified number of values */ uint32_t simdmin_length(const uint32_t * in, uint32_t length); - +#ifdef __SSE4_1__ /* computes (quickly) the minimal and maximal value of the specified number of values */ void simdmaxmin_length(const uint32_t * in, uint32_t length, uint32_t * getmin, uint32_t * getmax); /* computes (quickly) the minimal and maximal value of the 128 values */ void simdmaxmin(const uint32_t * in, uint32_t * getmin, uint32_t * getmax); - +#endif /* like maxbit over 128 integers (SIMDBlockSize) with provided initial value and using differential coding */ diff --git a/src/simdcomputil.c b/src/simdcomputil.c index 5b6cb4a..4437c7a 100644 --- a/src/simdcomputil.c +++ b/src/simdcomputil.c @@ -3,7 +3,9 @@ */ #include "simdcomputil.h" +#ifdef __SSE4_1__ #include +#endif #include #define Delta(curr, prev) \ @@ -49,6 +51,8 @@ static uint32_t orasint(const __m128i accumulator) { return _mm_cvtsi128_si32(_tmp2); } +#ifdef __SSE4_1__ + static uint32_t minasint(const __m128i accumulator) { const __m128i _tmp1 = _mm_min_epu32(_mm_srli_si128(accumulator, 8), accumulator); /* (A,B,C,D) xor (0,0,A,B) = (A,B,C xor A,D xor B)*/ const __m128i _tmp2 = _mm_min_epu32(_mm_srli_si128(_tmp1, 4), _tmp1); /* (A,B,C xor A,D xor B) xor (0,0,0,C xor A)*/ @@ -135,7 +139,7 @@ void simdmaxmin_length(const uint32_t * in, uint32_t length, uint32_t * getmin, } } - +#endif SIMDCOMP_PURE uint32_t maxbits_length(const uint32_t * in,uint32_t length) { uint32_t k; diff --git a/src/simdintegratedbitpacking.c b/src/simdintegratedbitpacking.c index a3093c0..005aa8e 100644 --- a/src/simdintegratedbitpacking.c +++ b/src/simdintegratedbitpacking.c @@ -24867,6 +24867,8 @@ void simdfastsetd1fromprevious( __m128i * in, uint32_t bit, uint32_t previousval simdfastset(in, bit, value - previousvalue, index); } +#ifdef __SSE4_1__ + void simdfastsetd1(uint32_t initvalue, __m128i * in, uint32_t bit, uint32_t value, size_t index) { if(index == 0) { simdfastset(in, bit, value - initvalue, index); @@ -24875,3 +24877,6 @@ void simdfastsetd1(uint32_t initvalue, __m128i * in, uint32_t bit, uint32_t valu simdfastset(in, bit, value - prev, index); } } + +#endif + diff --git a/src/simdpackedsearch.c b/src/simdpackedsearch.c index bfcd26a..e2f14b3 100644 --- a/src/simdpackedsearch.c +++ b/src/simdpackedsearch.c @@ -1,6 +1,8 @@ /** * This code is released under a BSD License. */ +#ifdef __SSE4_1__ + #include #include "simdintegratedbitpacking.h" @@ -15861,3 +15863,4 @@ simdsearchd1(__m128i * initOffset, const __m128i *in, uint32_t bit, return (-1); } +#endif diff --git a/src/simdpackedselect.c b/src/simdpackedselect.c index e7adb02..09898f1 100644 --- a/src/simdpackedselect.c +++ b/src/simdpackedselect.c @@ -1,6 +1,7 @@ /** * This code is released under a BSD License. */ +#ifdef __SSE4_1__ #include "simdintegratedbitpacking.h" #include @@ -15486,4 +15487,4 @@ simdscand1(__m128i * initOffset, const __m128i *in, uint32_t bit) return ; } - +#endif diff --git a/src/unit.c b/src/unit.c index 8b12d87..6492791 100644 --- a/src/unit.c +++ b/src/unit.c @@ -130,6 +130,8 @@ int testset() { return 0; } +#ifdef __SSE4_1__ + int testsetd1() { int bit; size_t i; @@ -175,7 +177,7 @@ int testsetd1() { return 0; } - +#endif int testsetFOR() { int bit; @@ -317,6 +319,7 @@ int test() { return 0; } +#ifdef __SSE4_1__ int testFOR() { int N = 5000 * SIMDBlockSize, gap; __m128i * buffer = malloc(SIMDBlockSize * sizeof(uint32_t)); @@ -362,6 +365,7 @@ int testFOR() { printf("Code looks good.\n"); return 0; } +#endif #define MAX 300 int test_simdmaxbitsd1_length() { @@ -405,7 +409,7 @@ int uint32_cmp(const void *a, const void *b) return 0; } - +#ifdef __SSE4_1__ int test_simdpackedsearch() { uint32_t buffer[128]; uint32_t result = 0; @@ -488,7 +492,6 @@ int test_simdpackedsearchFOR() { return 0; } - int test_simdpackedsearch_advanced() { uint32_t buffer[128]; uint32_t backbuffer[128]; @@ -655,6 +658,7 @@ int test_simdpackedselect_advanced() { printf("advanced simdselectd1: ok\n"); return 0; } +#endif int main() { @@ -662,10 +666,12 @@ int main() { r = testsetFOR(); if (r) return r; + +#ifdef __SSE4_1__ r = testsetd1(); if (r) return r; - +#endif r = testset(); if (r) return r; @@ -679,7 +685,7 @@ int main() { r = testlongpack(); if (r) return r; - +#ifdef __SSE4_1__ r = test_simdpackedsearchFOR(); if (r) return r; @@ -687,6 +693,7 @@ int main() { r = testFOR(); if (r) return r; +#endif r = test(); if (r) return r; @@ -694,7 +701,7 @@ int main() { r = test_simdmaxbitsd1_length(); if (r) return r; - +#ifdef __SSE4_1__ r = test_simdpackedsearch(); if (r) return r; @@ -703,7 +710,6 @@ int main() { if (r) return r; - r = test_simdpackedselect(); if (r) return r; @@ -711,6 +717,7 @@ int main() { r = test_simdpackedselect_advanced(); if (r) return r; +#endif return 0;