C++ eigen library does vectorization for different architecture, like SSE, NEON etc. In their documentation they mentioned that, Eigen vectorization is not compiler dependent. But most modern compilers like gcc does the vectorization automatically if the vectorization flag is enabled using -O3 flag.
So my question is, why Eigen or any other libraries does hard coded vectorization when compilers does this automatically for us?
It is true that compilers are getting better and better at auto-vectorization, and for basic coefficient-wise operations like 2*A-4*B a library like Eigen cannot do much better than recent compilers. However, for slightly more complicated expressions like matrix products, reductions, transposition, powers, etc. the compiler cannot do much. On the other hand, Eigen can take advantage of the higher level knowledge of the expression semantic to explicitly vectorize them. Moreover, complex scalar types are not vectorized by compilers. You can check by yourself by disabling Eigen's explicit vectorization (-DEIGEN_DONT_VECTORIZE).