public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR46598 confusion
@ 2010-11-23 15:51 Richard Guenther
  2010-11-23 16:30 ` Jan Hubicka
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2010-11-23 15:51 UTC (permalink / raw)
  To: gcc-patches


This clears up register pair constraint documentation by providing
an example.

Ok?

Thanks,
Richard.

2010-11-23  Richard Guenther  <rguenther@suse.de>

	* doc/md.texi (386 constraints): Clarify A constraint documentation.

Index: gcc/doc/md.texi
===================================================================
*** gcc/doc/md.texi	(revision 167076)
--- gcc/doc/md.texi	(working copy)
*************** The @code{di} register.
*** 2102,2108 ****
  
  @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).
  
  @item f
  Any 80387 floating-point (stack) register.
--- 2102,2130 ----
  
  @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).  For example
! for 32bit code 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 where you have to use the following variant:
! 
! @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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PR46598 confusion
  2010-11-23 15:51 [PATCH] PR46598 confusion Richard Guenther
@ 2010-11-23 16:30 ` Jan Hubicka
  2010-11-23 16:37   ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Hubicka @ 2010-11-23 16:30 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

> --- 2102,2130 ----
>   
>   @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).  For example

I would probably just remove 
", as a pair (for instructions that
> ! return half the result in one and half in the other)"

and add something like "This class is used for instructions that return double
word result in ax:dx pair. Single word values will be allocated either in ax or
dx." To further prevent confusion that "A" imply register pair instead of class
containing ax and bx.

The change is OK with me and I believe it belongs to x86 maintainership.

thanks,
Honza

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PR46598 confusion
  2010-11-23 16:30 ` Jan Hubicka
@ 2010-11-23 16:37   ` Richard Guenther
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2010-11-23 16:37 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

On Tue, 23 Nov 2010, Jan Hubicka wrote:

> > --- 2102,2130 ----
> >   
> >   @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).  For example
> 
> I would probably just remove 
> ", as a pair (for instructions that
> > ! return half the result in one and half in the other)"
> 
> and add something like "This class is used for instructions that return double
> word result in ax:dx pair. Single word values will be allocated either in ax or
> dx." To further prevent confusion that "A" imply register pair instead of class
> containing ax and bx.
> 
> The change is OK with me and I believe it belongs to x86 maintainership.

I have committed the following.

Thanks,
Richard.

2010-11-23  Richard Guenther  <rguenther@suse.de>

	* doc/md.texi (386 constraints): Clarify A constraint documentation.

Index: gcc/doc/md.texi
===================================================================
*** gcc/doc/md.texi	(revision 167079)
--- gcc/doc/md.texi	(working copy)
*************** The @code{si} register.
*** 2101,2108 ****
  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).
  
  @item f
  Any 80387 floating-point (stack) register.
--- 2101,2132 ----
  The @code{di} register.
  
  @item A
! 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-23 15:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-23 15:51 [PATCH] PR46598 confusion Richard Guenther
2010-11-23 16:30 ` Jan Hubicka
2010-11-23 16:37   ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).