This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
help with different treatment of asms in 3.2 and 3.3?
- From: Andrew Haley <aph at redhat dot com>
- To: Brad Lucier <lucier at math dot purdue dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 5 Nov 2002 16:30:51 +0000 (GMT)
- Subject: help with different treatment of asms in 3.2 and 3.3?
- References: <200211051557.gA5FvNl16890@banach.math.purdue.edu>
Brad Lucier writes:
> 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;
> }
Do this:
int Int_quot(int numerator, int denominator) {
int eax;
__asm__ __volatile__ ("cdq\n idivl %2"
: "=a" (eax)
: "0" (numerator), "rm" (denominator)
: "edx");
return eax;
}
Andrew.