https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127086
--- Comment #4 from Anton Blanchard <anton at ozlabs dot org> --- Thanks Jeff. I found this while chasing a 10+% regression with x264_r on Ascalon when building with -flto. Looking at the instruction trace in a cycle accurate simulator, much of the time was in this loop: csrrwi x0, vxrm, 0x0 vle8.v v2, (x12) vle8.v v1, (x10) vaaddu.vv v1, v1, v2 vse8.v v1, (x11) addi x11, x11, 16 add x12, x12, x13 add x10, x10, x13 add x16, x16, x29 bne x11, x23, . - 0x30 add x17, x28, x16 sltiu x17, x17, 31 bne x17, x0, . + 0x378 sltiu x17, x16, 31 bne x17, x0, . + 0x370 csrrwi x0, vxrm, 0x0 vle8.v v2, (x12) vle8.v v1, (x10) vaaddu.vv v1, v1, v2 vse8.v v1, (x11) addi x11, x11, 16 add x12, x12, x13 add x10, x10, x13 add x16, x16, x29 bne x11, x23, . - 0x30 add x17, x28, x16 sltiu x17, x17, 31 bne x17, x0, . + 0x378 sltiu x17, x16, 31 bne x17, x0, . + 0x370 csrrwi x0, vxrm, 0x0 vle8.v v2, (x12) vle8.v v1, (x10) vaaddu.vv v1, v1, v2 vse8.v v1, (x11) addi x11, x11, 16 add x12, x12, x13 add x10, x10, x13 add x16, x16, x29 bne x11, x23, . - 0x30 add x17, x28, x16 sltiu x17, x17, 31 bne x17, x0, . + 0x378 sltiu x17, x16, 31 bne x17, x0, . + 0x370 csrrwi x0, vxrm, 0x0 So the VXRM write ended up in the core loop. I wonder if -flto inlined enough code to trip up on the LCM limitations.
