Mapping NAN to ZERO / When does gcc generate MOVcc and FCMOVcc instructions?

2006-11-02 Thread Michael James
Hello, I am trying to get gcc to optimize an inner math loop. The first part of the loop computes a single precision float expression (which may or may not be NAN), and the second part sums all of these results into a double precision total: Conceptually, the code is: double sum = 0; for(i=0;

Re: Mapping NAN to ZERO / When does gcc generate MOVcc and FCMOVcc instructions?

2006-11-02 Thread Uros Bizjak
Michael James wrote: Conceptually, the code is: double sum = 0; for(i=0; in; ++i) { float x = ..computed..; sum += isnan(x)? 0: x; } I have tried a half dozen variants at the source level in attempt to get gcc to do this without branching (and without calling a helper function