Article View: gnu.gcc.help
Article #52290Re: how to use i387 asm code ?
From: David Kastrup
Date: Thu, 10 Dec 1992 19:32
Date: Thu, 10 Dec 1992 19:32
30 lines
1718 bytes
1718 bytes
jwromei@cs.vu.nl (Romein JW) writes:
>I wrote a function
>>>> #if defined __GNUC__ && defined mc68000
>>>>
>>>> inline static double sin(double angle)
>>>> {
>>>> double result;
>>>> asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
>>>> return result;
>>>> }
>>>>
>>>> #endif
>and I understand what it is doing, but how should I replace the asm line
>so that it works on a i486 or i386 with FPU ? I could not find any example
>that used the floating point stack in the documentation.
You have to go into the config directory, and search things like i386.c
and i386.h for the meaning of registers.
I believe that t was the register name for top of stack, and something
was there for the next element (say u for under, but this is possibly wrong).
so the above would be something like
asm("fsin" : "=t" (result) : "0" (angle))
iff the fsin takes top and delivers top.
Note however, that there is NO WAY to specify a floating variable with
10 bytes of precision, so I do not know whether the above will have
coproc accuracy or not. A pity.
Technical Details
Message-ID:
<dak.724015937@tabaqui>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!urmel.informatik.rwth-aachen.de!tabaqui!dakReferences:
<Byy84o.4Et@cs.vu.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,5ac20ee2245b0d91 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-12-10 12:01:25 PST Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!urmel.informatik.rwth-aachen.de!tabaqui!dak From: dak@tabaqui.informatik.rwth-aachen.de (David Kastrup) Newsgroups: gnu.gcc.help Subject: Re: how to use i387 asm code ? Date: 10 Dec 92 19:32:17 GMT Organization: Rechnerbetrieb Informatik - RWTH Aachen Lines: 30 Distribution: world Message-ID: <dak.724015937@tabaqui> References: <Byy84o.4Et@cs.vu.nl> NNTP-Posting-Host: tabaqui.informatik.rwth-aachen.de