From 81d1f79a7f4b0f67d71d1c8c5c74e5a56ab48097 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 10 Apr 2012 12:08:21 -0300 Subject: [PATCH] Add early-clobbers to the output variables in CPUID Without those early-clobbers, the compiler might decide to schedule a register that is also used as output. The existing early clobber in the tmp variable was there so the compiler wouldn't use a register scheduled as input (especially EAX). To be honest, I'm not convinced that the compiler should be allowed to do this. That means that two output variables are scheduled to the same register... still, this fixes a problem found with GCC 4.2 (at least the Mac one). Change-Id: I6cd4676284e9a83d6aac4b439c6e58e347c40106 Reviewed-by: Bradley T. Hughes --- src/corelib/tools/qsimd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index f13009a02d..fb6219273f 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -168,7 +168,7 @@ static inline uint detectProcessorFeatures() asm ("xchg %%ebx, %2\n" "cpuid\n" "xchg %%ebx, %2\n" - : "=c" (feature_result), "=d" (result), "=&r" (tmp1) + : "=&c" (feature_result), "=d" (result), "=&r" (tmp1) : "a" (1)); asm ("xchg %%ebx, %1\n" @@ -182,7 +182,7 @@ static inline uint detectProcessorFeatures() "cpuid\n" "2:\n" "xchg %%ebx, %1\n" - : "=d" (extended_result), "=&r" (tmp1) + : "=&d" (extended_result), "=&r" (tmp1) : "a" (0x80000000) : "%ecx" ); @@ -284,7 +284,7 @@ static inline uint detectProcessorFeatures() asm ("xchg %%rbx, %1\n" "cpuid\n" "xchg %%rbx, %1\n" - : "=c" (feature_result), "=&r" (tmp) + : "=&c" (feature_result), "=&r" (tmp) : "a" (1) : "%edx" );