]> pilppa.com Git - linux-2.6-omap-h63xx.git/commit
x86: correct register constraints for 64-bit atomic operations
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sat, 16 Aug 2008 07:39:26 +0000 (03:39 -0400)
committerIngo Molnar <mingo@elte.hu>
Mon, 18 Aug 2008 05:47:30 +0000 (07:47 +0200)
commit3c3b5c3b0bf798316a410e27e3d7e6f015663602
treea774ddfd39dace35a85316ee69da4055f8ebde51
parent2fdc86901d2ab30a12402b46238951d2a7891590
x86: correct register constraints for 64-bit atomic operations

x86_64 add/sub atomic ops does not seems to accept integer values bigger
than 32 bits as immediates. Intel's add/sub documentation specifies they
have to be passed as registers.

The only operations in the x86-64 architecture which accept arbitrary
64-bit immediates is "movq" to any register; similarly, the only
operation which accept arbitrary 64-bit displacement is "movabs" to or
from al/ax/eax/rax.

http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Machine-Constraints.html

states :

e
    32-bit signed integer constant, or a symbolic reference known to fit
    that range (for immediate operands in sign-extending x86-64
    instructions).
Z
    32-bit unsigned integer constant, or a symbolic reference known to
    fit that range (for immediate operands in zero-extending x86-64
    instructions).

Since add/sub does sign extension, using the "e" constraint seems appropriate.

It applies to 2.6.27-rc, 2.6.26, 2.6.25...

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/asm-x86/atomic_64.h