This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: help with different treatment of asms in 3.2 and 3.3?


Hi again,

On Tue, 5 Nov 2002, Michael Matz wrote:

> GCC is right here.  You don't need (or want) to use register variables
> here.  A better way is:
>
> int Int_quot(int numerator, int denominator) {
>         __asm__ __volatile__ ("cdq\n        idivl %2"
>                 : "=a" (numerator)
>                 : "0" (numerator), "rm" (denominator)
>                 : "edx");
>
>         return numerator;
> }

I forgot to mention:  The use of asm is nonsensical here anyway.  A simple
  int Int_quot (int n, int d) { return n / d; }
produces exactly the same code.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]