diff --git a/vpx_ports/x86.h b/vpx_ports/x86.h
index a8e4607cd361add02eee3f110e80ddd80c9c0e59..05a45917ae44558852052bd926eb5cb31a8f50bf 100644
--- a/vpx_ports/x86.h
+++ b/vpx_ports/x86.h
@@ -24,12 +24,11 @@
 #else
 #define cpuid(func,ax,bx,cx,dx)\
     __asm__ __volatile__ (\
-                          "pushl %%ebx     \n\t" \
-                          "cpuid           \n\t" \
-                          "movl  %%ebx, %1 \n\t" \
-                          "popl  %%ebx     \n\t" \
-                          : "=a" (ax), "=r" (bx), "=c" (cx), "=d" (dx) \
-                          : "a"  (func));
+                          "mov %%ebx, %%edi   \n\t" \
+                          "cpuid              \n\t" \
+                          "xchg %%edi, %%ebx  \n\t" \
+                          : "=a" (ax), "=D" (bx), "=c" (cx), "=d" (dx) \
+                          : "a" (func));
 #endif
 #else
 #if ARCH_X86_64