https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51119

--- Comment #34 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Created attachment 39987
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39987&action=edit
A test program

Just ran some tests comparing reference results and results using -Ofast.

-Ofast does reorder execution.. 

Using kind=8

DELTA = (reference - result) and looking at the ranges of minval and maxval
with several random matrices one sees (4 cases):

Using some smaller matrices. see attachment for test program.

 delta minval              delta maxval

-2.2204460492503131E-016   2.2204460492503131E-016

-4.4408920985006262E-016   4.4408920985006262E-016

-2.2204460492503131E-016   2.2204460492503131E-016

-4.4408920985006262E-016   2.2204460492503131E-016

So the wiggling one gets in the least significant bits may matter to some.

With larger arrays (error amplification):

1000 x 1000    -1.0231815394945443E-012   8.8107299234252423E-013

2000 x 2000    -2.7284841053187847E-012   2.6716406864579767E-012

Compiling the test program with -Ofast so that the reference method has the
same optimization as MATMUL, one gets.

2000 x 2000     0.0000000000000000        0.0000000000000000

Opinions welcome.

Reply via email to