This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: help with different treatment of asms in 3.2 and 3.3?
- From: Michael Matz <matz at suse dot de>
- To: Brad Lucier <lucier at math dot purdue dot edu>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Tue, 5 Nov 2002 17:15:51 +0100 (CET)
- Subject: Re: help with different treatment of asms in 3.2 and 3.3?
Hi,
On Tue, 5 Nov 2002, Brad Lucier wrote:
> 3.2 compiles the following code without complaint (beyond the warnings)
> and 3.3 rejects it. The code is from the MLton ML compiler runtime; I
> know nothing about inline asms; could someone offer some advice?
>
> int Int_quot(int numerator, int denominator) {
> register int eax asm("eax");
>
> eax = numerator ;
>
> __asm__ __volatile__ ("cdq\n idivl %1"
> :
> : "r" (eax), "m" (denominator)
> : "eax", "edx");
>
> return eax;
> }
> basis/Int/quot.c:10: error: asm-specifier for variable `eax' conflicts
> with asm clobber list
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;
}
Ciao,
Michael.