This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]