home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gcc.help
- Path: sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!think.com!mob
- From: mob@think.com (Mario O. Bourgoin)
- Subject: Extra instructions spuriously generated
- Message-ID: <9211112021.AA14320@strident.think.com>
- Sender: daemon@cis.ohio-state.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Wed, 11 Nov 1992 20:21:50 GMT
- Lines: 23
-
-
- In trying to get to the bits of a floating point constant under GCC, I have
- come up with casting it to the union of an unsigned and a float:
-
- ((union {unsigned u; float f;}) (float) 3.1).u
-
- This mercifully resolves to an immediate constant when compiled -O.
- Unfortunately, the corresponding double cast:
-
- ((union {unsigned u; double d;}) (double) 3.1).u
-
- invariably results in the generation of four instructions to load both
- parts of the double in a pair of registers, whether or not the second part
- of the double is ever used.
-
- In the best of all worlds, I would prefer that an immediate constant be
- generated, but I would settle for just eliminating the useless load of the
- second part of the double. Could someone direct me on how to get GCC to do
- this?
-
- --Mario
-
-
-