home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gcc.bug
- Path: sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hal.gnu.ai.mit.edu!mycroft
- From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum)
- Subject: Can't prevent asm() from popping 387 stack
- Message-ID: <Pine.3.05.9301051406.A17347-a100000@hal.gnu.ai.mit.edu>
- Sender: gnulists@ai.mit.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Tue, 5 Jan 1993 09:52:06 GMT
- Approved: bug-gcc@prep.ai.mit.edu
- Lines: 38
-
- I want to do something like the following:
-
- double
- atan2 (double y, double x)
- {
- double temp;
-
- asm ("fpatan"
- : "+t" (temp)
- : "u" (y), "0" (x));
-
- return (temp);
- }
-
- The `fpatan' instruction pops one item from the top of the floating stack,
- so there is only one left. Unfortunately, GCC also seems to think it
- should pop the second element on the stack:
-
- .file "foo.c"
- gcc2_compiled.:
- .text
- .align 2
- .globl _atan2
- _atan2:
- fldl 12(%esp)
- fldl 4(%esp)
- fxch %st(1)
- #APP
- fpatan
- #NO_APP
- fstp %st(1)
- ret
-
- I can't find any way to prevent this. The only thing I've been able to do
- is insert an extra `fld %st(0)' so it doesn't do any harm.
-
-
-
-