This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
wish: optimize (x > 0.) floating point comparison.
- To: egcs at cygnus dot com
- Subject: wish: optimize (x > 0.) floating point comparison.
- From: Yotam Medini <yotam at avanticorp dot com>
- Date: Tue, 22 Sep 1998 08:55:30 -0700
- Reply-to: yotam_medini at avanticorp dot com
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