Skip to content

Commit

Permalink
Implement SSE detection in a more portable way
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
szpajder committed May 7, 2015
1 parent ba34f8e commit 00c205a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rtl_airband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 00c205a

Please sign in to comment.