https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85756
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Version|unknown |9.0 Last reconfirmed| |2018-05-12 Component|tree-optimization |target CC| |ebotcazou at gcc dot gnu.org, | |jakub at gcc dot gnu.org Blocks| |85683 Ever confirmed|0 |1 Summary|wrong code at -Os on |[9 regression] wrong code |x86-64-linux-gnu in 32-bit |at -Os on x86-64-linux-gnu |mode |in 32-bit mode Target Milestone|--- |9.0 Severity|normal |major --- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- This was introduced by: PR target/85683 * config/i386/i386.md: Add peepholes for mem {+,-,&,|,^}= x; mem != 0 after cmpelim optimization. --- pr85756_0.s 2018-05-12 12:23:29.214331432 +0200 +++ pr85756.s 2018-05-12 12:23:38.950611436 +0200 @@ -37,10 +37,9 @@ testw %ax, %ax movl %edx, f setne %al - subl -44(%ebp), %esi - setne %cl - movl %esi, -44(%ebp) + subl %esi, -44(%ebp) movl %edx, %esi + setne %cl orl %ecx, %eax movzbl %al, %eax xorl %eax, %esi The transformation swaps the operands of the subtraction. It's also responsible for the miscompilation of the Ada runtime (g-catiio.o) in 32-bit mode. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85683 [Bug 85683] [8 Regression] GCC 8 stopped using RMW (Read Modify Write) instructions on x86[_64]