home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / gcc / bug / 3117 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.1 KB  |  51 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!hal.gnu.ai.mit.edu!mycroft
  3. From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum)
  4. Subject: Can't prevent asm() from popping 387 stack
  5. Message-ID: <Pine.3.05.9301051406.A17347-a100000@hal.gnu.ai.mit.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 5 Jan 1993 09:52:06 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 38
  12.  
  13. I want to do something like the following:
  14.  
  15. double
  16. atan2 (double y, double x)
  17. {
  18.   double temp;
  19.  
  20.   asm ("fpatan"
  21.     : "+t" (temp)
  22.     : "u" (y), "0" (x));
  23.  
  24.   return (temp);
  25. }
  26.  
  27. The `fpatan' instruction pops one item from the top of the floating stack,
  28. so there is only one left.  Unfortunately, GCC also seems to think it
  29. should pop the second element on the stack:
  30.  
  31.     .file    "foo.c"
  32. gcc2_compiled.:
  33. .text
  34.     .align 2
  35. .globl _atan2
  36. _atan2:
  37.     fldl 12(%esp)
  38.     fldl 4(%esp)
  39.     fxch %st(1)
  40. #APP
  41.     fpatan
  42. #NO_APP
  43.     fstp %st(1)
  44.     ret
  45.  
  46. I can't find any way to prevent this.  The only thing I've been able to do
  47. is insert an extra `fld %st(0)' so it doesn't do any harm.
  48.  
  49.  
  50.  
  51.