The gcc compiler does vectorize the code. I wrote that gcc 4.1.2 did not interchange loops automatically (ijk to ikj). Matrix multiply is very easy for a compiler to optimize and it is easy to use to illustrate principles. There may exist some cases where a developer may see the value in interchanging loops that the compiler (intel compiler, llvm, gcc, . . . )doesn't recognize. I pointed out how to see when the compiler does this with the optimization report. If the compiler already does it for you, don't bother with explicitly making the change - save your time for something else.