diff options
author | Richard Guenther <rguenther@suse.de> | 2010-11-23 15:15:50 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-11-23 15:15:50 +0000 |
commit | ae8358d69a0f237f466185b41396bb735793b460 (patch) | |
tree | e6ca3adbfdc127ec320230bfd3049f644e25661d | |
parent | 412dc29d628f7b523790a34042a3c55e77ed1f9f (diff) | |
download | gcc-ae8358d69a0f237f466185b41396bb735793b460.zip gcc-ae8358d69a0f237f466185b41396bb735793b460.tar.gz gcc-ae8358d69a0f237f466185b41396bb735793b460.tar.bz2 |
md.texi (386 constraints): Clarify A constraint documentation.
2010-11-23 Richard Guenther <rguenther@suse.de>
* doc/md.texi (386 constraints): Clarify A constraint documentation.
From-SVN: r167081
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/doc/md.texi | 28 |
2 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 09053c3..9fcd937 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2010-11-23 Richard Guenther <rguenther@suse.de> + + * doc/md.texi (386 constraints): Clarify A constraint documentation. + 2010-11-23 Basile Starynkevitch <basile@starynkevitch.net> Jeremie Salvucci <jeremie.salvucci@free.fr> diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index bdf42f1..677ea02 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -2101,8 +2101,32 @@ The @code{si} register. The @code{di} register. @item A -The @code{a} and @code{d} registers, as a pair (for instructions that -return half the result in one and half in the other). +The @code{a} and @code{d} registers. This class is used for instructions +that return double word results in the @code{ax:dx} register pair. Single +word values will be allocated either in @code{ax} or @code{dx}. +For example on i386 the following implements @code{rdtsc}: + +@smallexample +unsigned long long rdtsc (void) +@{ + unsigned long long tick; + __asm__ __volatile__("rdtsc":"=A"(tick)); + return tick; +@} +@end smallexample + +This is not correct on x86_64 as it would allocate tick in either @code{ax} +or @code{dx}. You have to use the following variant instead: + +@smallexample +unsigned long long rdtsc (void) +@{ + unsigned int tickl, tickh; + __asm__ __volatile__("rdtsc":"=a"(tickl),"=d"(tickh)); + return ((unsigned long long)tickh << 32)|tickl; +@} +@end smallexample + @item f Any 80387 floating-point (stack) register. |