https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85740
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > These functions are not functional equivalent. > > In the b.c, it records the max location but it is the last element which > contains that value. While in c.c, the first element which contains > the value is recorded. > (In reply to Andrew Pinski from comment #1) > > These functions are not functional equivalent. > > To get them equivalent, you either need to use >= or <=. Could you please elaborate? The results seem to depend on the processor. On my Core i7 I get around 430000000 cycles for both tests and -O2 or above, except -Ofast -funroll-loops which gives around 260000000 cycles for the first test and 580000000 cycles for the second one.