Why doesn’t gcc resolve _mm256_loadu_pd as single vmovupd?

GCC’s default tuning (-mtune=generic) includes -mavx256-split-unaligned-load and -mavx256-split-unaligned-store, because that gives a minor speedup on some CPUs (e.g. first-gen Sandybridge, and some AMD CPUs) in some cases when memory is actually misaligned at runtime. Use -O3 -mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store if you don’t want this, or better, use -mtune=haswell. Or use -march=native to optimize for your own … Read more