wish: optimize (x > 0.) floating point comparison.

Yotam Medini yotam@avanticorp.com
Tue Sep 22 09:00:00 GMT 1998


My assembly-code reading skill is very poor.
Still, given:
    double x;
and viewing the code generated (gcc -S -O?) I think the following
two logical expressions
       (x >= 0.)
       (x >= 13.)
result with the same computational complexity.

I believe that floating-point comparisons (<, >, <=, >=) with 0.0 is
very frequent and worth the trouble of optimizing using the sign bit
within the (platform dependent) floating-point representation or some
other machine instruction.

Hope this idea could help. -- yotam




More information about the Gcc mailing list