https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46551
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Resolution|--- |FIXED Known to fail| |4.9.0, 5.1.0 Status|UNCONFIRMED |RESOLVED Known to work| |6.1.0 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- GCC 6+ produces: movq (%rsi), %rcx movq %rdi, %rax cmpq %rdx, (%rsi,%rcx,8) je .L2 The difference comes from expand. GCC 6 produces: (insn 9 8 10 2 (set (reg:CCZ 17 flags) (compare:CCZ (mem:DI (plus:DI (mult:DI (reg:DI 101) (const_int 8 [0x8])) (reg/v/f:DI 99 [ vm ])) [1 vm_3(D)->cell S8 A64]) (reg/v:DI 100 [ a ]))) /app/example.cpp:12 -1 (nil)) While GCC 5 produces: (insn 9 8 10 2 (set (reg:DI 89 [ D.1961 ]) (mem:DI (plus:DI (mult:DI (reg:DI 101) (const_int 8 [0x8])) (reg/v/f:DI 99 [ vm ])) [1 vm_3(D)->cell S8 A64])) /app/example.cpp:12 -1 (nil)) (insn 10 9 11 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg:DI 89 [ D.1961 ]) (reg/v:DI 100 [ a ]))) /app/example.cpp:12 -1 (nil)) I can't find the change that caused this difference though.