summaryrefslogtreecommitdiff
path: root/gcc/doc/md.texi
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-23 15:15:50 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-23 15:15:50 +0000
commitdd5fed3c0420569bf8e650bb94625242d3e23b1e (patch)
treee6ca3adbfdc127ec320230bfd3049f644e25661d /gcc/doc/md.texi
parent8be1803e426ba58979f77f8b8978a23d315a60b6 (diff)
downloadgcc-dd5fed3c0420569bf8e650bb94625242d3e23b1e.tar.gz
2010-11-23 Richard Guenther <rguenther@suse.de>
* doc/md.texi (386 constraints): Clarify A constraint documentation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167081 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc/md.texi')
-rw-r--r--gcc/doc/md.texi28
1 files changed, 26 insertions, 2 deletions
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index bdf42f17986..677ea02b6e5 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.