https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92807
--- Comment #6 from liuhongt at gcc dot gnu.org --- Author: liuhongt Date: Tue Dec 17 01:29:09 2019 New Revision: 279451 URL: https://gcc.gnu.org/viewcvs?rev=279451&root=gcc&view=rev Log: Use add for a = a + b and a = b + a when possible. Since except for Bonnell, 01 fb add %edi,%ebx is faster and shorter than 8d 1c 1f lea (%rdi,%rbx,1),%ebx we should use add for a = a + b and a = b + a when possible if not optimizing for Bonnell. Tested on x86-64. 2019-12-17 H.J. Lu <hjl.to...@gmail.com> gcc/ PR target/92807 * config/i386/i386.c (ix86_lea_outperforms): Check !TARGET_BONNELL. (ix86_avoid_lea_for_addr): When not optimizing for Bonnell, use add for a = a + b and a = b + a. gcc/testsuite/ PR target/92807 * gcc.target/i386/pr92807-1.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr92807-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/testsuite/ChangeLog