aboutsummaryrefslogtreecommitdiff
path: root/graphics/openexr/files/patch-IlmImf__ImfSystemSpecific.cpp
blob: 74e5054a317582131394dcd56bf77af616136044 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- IlmImf/ImfSystemSpecific.cpp.orig	2017-11-17 23:00:24 UTC
+++ IlmImf/ImfSystemSpecific.cpp
@@ -44,11 +44,23 @@ namespace {
     // Helper functions for gcc + SSE enabled
     void cpuid(int n, int &eax, int &ebx, int &ecx, int &edx)
     {
+#if __i386__
         __asm__ __volatile__ (
-            "cpuid"
-            : /* Output  */ "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) 
-            : /* Input   */ "a"(n)
+            "xchgl %%ebx,%k1\n"
+            "cpuid\n"
+            "xchgl %%ebx,%k1" \
+            : /* Output  */ "=a"(eax), "=&r"(ebx), "=c"(ecx), "=d"(edx)
+            : /* Input   */ "0"(n)
             : /* Clobber */);
+#else
+        __asm__ __volatile__ (
+            "xchgq %%rbx,%q1\n"
+            "cpuid\n"
+            "xchgq %%rbx,%q1" \
+            : /* Output  */ "=a"(eax), "=&r"(ebx), "=c"(ecx), "=d"(edx)
+            : /* Input   */ "0"(n)
+            : /* Clobber */);
+#endif
     }
 
 #else // IMF_HAVE_SSE2 && __GNUC__