summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--volk/gen/make_cpuid_c.py12
-rw-r--r--volk/include/volk/volk_common.h22
-rw-r--r--volk/lib/qa_utils.cc2
3 files changed, 30 insertions, 6 deletions
diff --git a/volk/gen/make_cpuid_c.py b/volk/gen/make_cpuid_c.py
index 20621769b..2fdbaf304 100644
--- a/volk/gen/make_cpuid_c.py
+++ b/volk/gen/make_cpuid_c.py
@@ -31,9 +31,21 @@ HEADER_TEMPL = """\
struct VOLK_CPU volk_cpu;
#if defined(__i386__) || (__x86_64__)
+
+//implement get cpuid for gcc compilers using a copy of cpuid.h
+#if defined(__GNUC__)
#include <gcc_x86_cpuid.h>
#define cpuid_x86(op, r) __get_cpuid(op, r+0, r+1, r+2, r+3)
+//implement get cpuid for MSVC compilers using __cpuid intrinsic
+#elif defined(_MSC_VER)
+#include <intrin.h>
+#define cpuid(op, r) __cpuid(r, op)
+
+#else
+#error "A get cpuid for volk is not available on this compiler..."
+#endif
+
static inline unsigned int cpuid_eax(unsigned int op) {
unsigned int regs[4];
cpuid_x86 (op, regs);
diff --git a/volk/include/volk/volk_common.h b/volk/include/volk/volk_common.h
index 1e868561e..12623073c 100644
--- a/volk/include/volk/volk_common.h
+++ b/volk/include/volk/volk_common.h
@@ -57,18 +57,30 @@
////////////////////////////////////////////////////////////////////////
// The bit128 union used by some
////////////////////////////////////////////////////////////////////////
-#include<inttypes.h>
-#ifdef LV_HAVE_MMX
-#include<xmmintrin.h>
+#include <inttypes.h>
+
+#ifdef LV_HAVE_SSE
+#include <xmmintrin.h>
+#endif
+
+#ifdef LV_HAVE_SSE2
+#include <emmintrin.h>
+#endif
+
union bit128{
uint16_t i16[8];
uint32_t i[4];
float f[4];
double d[2];
- __m128i int_vec;
+
+ #ifdef LV_HAVE_SSE
__m128 float_vec;
+ #endif
+
+ #ifdef LV_HAVE_SSE2
+ __m128i int_vec;
__m128d double_vec;
+ #endif
};
-#endif /*LV_HAVE_MMX*/
#endif /*INCLUDED_LIBVOLK_COMMON_H*/
diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc
index b195ab365..fa091ad0d 100644
--- a/volk/lib/qa_utils.cc
+++ b/volk/lib/qa_utils.cc
@@ -219,7 +219,7 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) {
bool fail = false;
int print_max_errs = 10;
for(int i=0; i<vlen; i++) {
- if(abs(((t *)(in1))[i] - ((t *)(in2))[i]) > tol) {
+ if(abs(int(((t *)(in1))[i]) - int(((t *)(in2))[i])) > tol) {
fail=true;
if(print_max_errs-- > 0) {
std::cout << "offset " << i << " in1: " << static_cast<int>(t(((t *)(in1))[i])) << " in2: " << static_cast<int>(t(((t *)(in2))[i])) << std::endl;