home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / gcc / help / 2497 < prev    next >
Encoding:
Text File  |  1992-11-11  |  1.1 KB  |  35 lines

  1. Newsgroups: gnu.gcc.help
  2. Path: sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!think.com!mob
  3. From: mob@think.com (Mario O. Bourgoin)
  4. Subject: Extra instructions spuriously generated
  5. Message-ID: <9211112021.AA14320@strident.think.com>
  6. Sender: daemon@cis.ohio-state.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Wed, 11 Nov 1992 20:21:50 GMT
  10. Lines: 23
  11.  
  12.  
  13. In trying to get to the bits of a floating point constant under GCC, I have
  14. come up with casting it to the union of an unsigned and a float:
  15.  
  16.     ((union {unsigned u; float f;}) (float) 3.1).u
  17.  
  18. This mercifully resolves to an immediate constant when compiled -O.
  19. Unfortunately, the corresponding double cast:
  20.  
  21.     ((union {unsigned u; double d;}) (double) 3.1).u
  22.  
  23. invariably results in the generation of four instructions to load both
  24. parts of the double in a pair of registers, whether or not the second part
  25. of the double is ever used.
  26.  
  27. In the best of all worlds, I would prefer that an immediate constant be
  28. generated, but I would settle for just eliminating the useless load of the
  29. second part of the double.  Could someone direct me on how to get GCC to do
  30. this?
  31.  
  32. --Mario
  33.  
  34.  
  35.