[Bug tree-optimization/78386] Optimization -O2 and higher cause math inconsistency

2016-11-17 Thread gromero at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78386

Gustavo Romero  changed:

   What|Removed |Added

 CC||gromero at linux dot 
vnet.ibm.com

--- Comment #7 from Gustavo Romero  ---
Hi all,

I'm sorry, I told the issue is also present on x64, but I did some additional
tests today and I found it's not true.

On our test case the _LITTLE_ENDIAN macro is used. But on x64 it seems
_LITTLE_ENDIAN is not predefined
(gcc -dM -E - < /dev/null | fgrep "_LITTLE_ENDIAN 1" return nothing, but on
Power it does), so it was not correctly set.

The test case has been updated to reflect that difference, so now:

on x64:
$ ./call ; ./opt_call 
cosine total sum is: 0.33853897900536206
cosine total sum is: 0.33853897900536206

on PPC64:
$ ./call ; ./opt_call 
cosine total sum is: 0.33853897900536206
cosine total sum is: 0.33853897900538427

Thank you.

Regards

[Bug target/78386] [PPC] Optimization -O2 and higher cause math inconsistency

2016-11-17 Thread gromero at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78386

--- Comment #9 from Gustavo Romero  ---
Both -ffp-contract=off and -std=c11 (with -O3) do not damage the precision:

CFLAGS=-I. -g -static -O3 -ffp-contract=off# Precision is OK
CFLAGS=-I. -g -static -std=c11 -O3 # Precision is OK
CFLAGS=-I. -g -static -std=c11 -ffp-contract=off -O3   # Precision is OK
CFLAGS=-I. -g -static -O3  # Precision is NOT OK