From 00c205abb5f7c5be93d3f85c8795569c724c796b Mon Sep 17 00:00:00 2001 From: Tomasz Lemiech Date: Thu, 7 May 2015 13:09:51 +0200 Subject: [PATCH] Implement SSE detection in a more portable way gcc versions older than 4.8 are still common in the field and they do not support __builtin_cpu_supports() function. Switched to old-style inline asm macro for some time. Closes #1. --- rtl_airband.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rtl_airband.cpp b/rtl_airband.cpp index 88e2f46..83a0bdb 100644 --- a/rtl_airband.cpp +++ b/rtl_airband.cpp @@ -597,7 +597,12 @@ int main(int argc, char* argv[]) { avx = 0; printf("SSE3 suport detected.\n"); #else /* !_WIN32 */ - if(__builtin_cpu_supports("sse")) { +#define cpuid(func,ax,bx,cx,dx)\ + __asm__ __volatile__ ("cpuid":\ + "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func)); + int a,b,c,d; + cpuid(1,a,b,c,d); + if((int)((d >> 25) & 0x1)) { printf("SSE suport detected.\n"); #endif /* !_WIN32 */ } else {