https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96166
Bug ID: 96166 Summary: [10/11 Regression] -O3/-ftree-slp-vectorize turns ROL into a mess Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: nok.raven at gmail dot com Target Milestone: --- inline void swap(int &x, int &y) { int tmp = x; x = y; y = tmp; } void bar(int (&x)[2]) { int y[2]; __builtin_memcpy(&y, &x, sizeof x); swap(y[0], y[1]); __builtin_memcpy(&x, &y, sizeof x); } GCC 9 (-Os/O2/O3) produces: rolq $32, (%rdi) GCC 10/trunk (-O3/-ftree-slp-vectorize) produces: movq (%rdi), %rax movd (%rdi), %xmm1 sarq $32, %rax movq %rax, %xmm0 punpckldq %xmm1, %xmm0 movq %xmm0, (%rdi) https://godbolt.org/z/5h3bW8