What does gcc’s ffast-math actually do?

I understand gcc’s –ffast-math flag can greatly increase speed for float ops, and goes outside of IEEE standards, but I can’t seem to find information on what is really happening when it’s on. Can anyone please explain some of the details and maybe give a clear example of how something would change if the flag … Read more

Why doesn’t GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?

I am doing some numerical optimization on a scientific application. One thing I noticed is that GCC will optimize the call pow(a,2) by compiling it into a*a, but the call pow(a,6) is not optimized and will actually call the library function pow, which greatly slows down the performance. (In contrast, Intel C++ Compiler, executable icc, … Read more