rs6000: floating point cast oddities?

degger@fhm.edu degger@fhm.edu
Mon Dec 17 12:59:00 GMT 2001


On 17 Dec, David Edelsohn wrote:

>> I can prevent gcc from doing it in double precision by adding
>> a cast but this is not a good reason for being stupid in the
>> first place I guess. :)

> 	This is completely correct code.  If you do not want the
> intermediate double, use 1.0f.  By default 1.0 is a double.

Yes, it is correct but stupid. Where are the expected gains to
use double calculations when result and operands are singleprecision
floats? gcc tries to be as smart as possible and thus has compilcated
optimisation passes but fails to emit a simple float instead of the
double although all other operands and the results are floats and the
result is (or should be) the same?

If there's not any compelling reason why it has to be that way I'll
have a look at the intermediate code generation to see if I can
come up with something more clever. For my taste there are far to many
frsps in assembly generated by gcc for floatingpoint operation (in any
precision) to be funny.

--
Servus,
       Daniel



More information about the Gcc mailing list