https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78379
--- Comment #36 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- Results look very good. Gfortran 7, no patch gives: $ gfc7 -static -Ofast -ftree-vectorize compare.f90 $ ./a.out ========================================================= ================ MEASURED GIGAFLOPS = ========================================================= Matmul Matmul fixed Matmul variable Size Loops explicit refMatmul assumed explicit ========================================================= 2 2000 4.706 0.046 0.094 0.162 4 2000 1.246 0.246 0.305 0.351 8 2000 1.410 0.605 0.958 1.791 16 2000 5.413 2.787 2.228 2.615 32 2000 4.676 3.416 4.622 4.618 64 2000 6.368 2.652 6.339 6.167 128 2000 8.165 2.998 8.118 8.260 256 477 9.334 3.202 9.248 9.355 512 59 8.730 2.239 8.596 8.730 1024 7 8.805 1.378 8.673 8.812 2048 1 8.781 1.728 8.649 8.789 Latest gfortran trunk with patch gives: $ gfc -static -Ofast -ftree-vectorize compare.f90 $ ./a.out ========================================================= ================ MEASURED GIGAFLOPS = ========================================================= Matmul Matmul fixed Matmul variable Size Loops explicit refMatmul assumed explicit ========================================================= 2 2000 4.738 0.048 0.092 0.172 4 2000 1.438 0.248 0.305 0.378 8 2000 1.511 0.617 1.177 1.955 16 2000 5.426 2.810 1.854 2.881 32 2000 4.688 3.314 4.357 5.091 64 2000 6.669 2.674 6.629 7.110 128 2000 9.139 3.000 9.076 9.131 256 477 10.495 3.184 10.466 10.516 512 59 9.577 2.189 9.477 9.635 1024 7 9.593 1.381 9.519 9.658 2048 1 9.722 1.709 9.625 9.785