From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26156 invoked by alias); 28 Apr 2009 12:20:47 -0000 Received: (qmail 26081 invoked by uid 48); 28 Apr 2009 12:20:33 -0000 Date: Tue, 28 Apr 2009 12:20:00 -0000 Subject: [Bug c/39942] New: Nonoptimal code - leaveq; xchg %ax,%ax; retq X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "vvv at ru dot ru" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg02698.txt.bz2 Sometimes we can see 2 bytes nop (xchg %ax,%ax) between leaveq and retq. IMHO, better to remove xchg %ax,%ax Examples from Kernel 2.6.29.1: > gcc --version gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291] > objdump vmlinux ... ffffffff804262e0 : ffffffff804262e0: 55 push %rbp ffffffff804262e1: 0f b7 07 movzwl (%rdi),%eax ffffffff804262e4: 4c 8b 86 d0 03 00 00 mov 0x3d0(%rsi),%r8 ffffffff804262eb: 48 c1 e0 07 shl $0x7,%rax ffffffff804262ef: 48 89 e5 mov %rsp,%rbp ffffffff804262f2: 48 05 40 1f 9c 80 add $0xffffffff809c1f40,%rax ffffffff804262f8: 49 89 80 90 01 00 00 mov %rax,0x190(%r8) ffffffff804262ff: 8b 46 04 mov 0x4(%rsi),%eax ffffffff80426302: 89 c1 mov %eax,%ecx ffffffff80426304: 81 e1 00 00 02 00 and $0x20000,%ecx ffffffff8042630a: 75 2c jne ffffffff80426338 ffffffff8042630c: 48 8b 86 d0 03 00 00 mov 0x3d0(%rsi),%rax ffffffff80426313: 4c 89 c7 mov %r8,%rdi ffffffff80426316: 48 8b 90 90 01 00 00 mov 0x190(%rax),%rdx ffffffff8042631d: 8b 52 1c mov 0x1c(%rdx),%edx ffffffff80426320: 83 fa 03 cmp $0x3,%edx ffffffff80426323: 0f 4e ca cmovle %edx,%ecx ffffffff80426326: 89 88 b0 01 00 00 mov %ecx,0x1b0(%rax) ffffffff8042632c: e8 2f 4d 00 00 callq ffffffff8042b060 ffffffff80426331: c9 leaveq ffffffff80426332: c3 retq ffffffff80426333: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) ffffffff80426338: e8 23 61 00 00 callq ffffffff8042c460 ffffffff8042633d: c9 leaveq ffffffff8042633e: 66 90 xchg %ax,%ax ffffffff80426340: c3 retq ... ... ffffffff8042b060 : ffffffff8042b060: 55 push %rbp ffffffff8042b061: 48 c7 07 d0 ad 42 80 movq $0xffffffff8042add0,(%rdi) ffffffff8042b068: 8b 87 b0 01 00 00 mov 0x1b0(%rdi),%eax ffffffff8042b06e: 48 89 e5 mov %rsp,%rbp ffffffff8042b071: 48 c7 47 08 30 ae 42 movq $0xffffffff8042ae30,0x8(%rdi) ffffffff8042b078: 80 ffffffff8042b079: 48 c7 47 10 c0 b7 42 movq $0xffffffff8042b7c0,0x10(%rdi) ffffffff8042b080: 80 ffffffff8042b081: 48 c7 47 18 10 af 42 movq $0xffffffff8042af10,0x18(%rdi) ffffffff8042b088: 80 ffffffff8042b089: 48 c7 47 20 10 b1 42 movq $0xffffffff8042b110,0x20(%rdi) ffffffff8042b090: 80 ffffffff8042b091: 48 c7 47 28 c0 b0 42 movq $0xffffffff8042b0c0,0x28(%rdi) ffffffff8042b098: 80 ffffffff8042b099: 48 c7 47 30 00 00 00 movq $0x0,0x30(%rdi) ffffffff8042b0a0: 00 ffffffff8042b0a1: 85 c0 test %eax,%eax ffffffff8042b0a3: 75 0b jne ffffffff8042b0b0 ffffffff8042b0a5: c9 leaveq ffffffff8042b0a6: c3 retq ffffffff8042b0a7: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1) ffffffff8042b0ae: 00 00 ffffffff8042b0b0: e8 4b 15 00 00 callq ffffffff8042c600 ffffffff8042b0b5: c9 leaveq ffffffff8042b0b6: 66 90 xchg %ax,%ax ffffffff8042b0b8: c3 retq -- Summary: Nonoptimal code - leaveq; xchg %ax,%ax; retq Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vvv at ru dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39942