From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8294 invoked by alias); 28 Apr 2009 21:19:00 -0000 Received: (qmail 8198 invoked by uid 48); 28 Apr 2009 21:18:46 -0000 Date: Tue, 28 Apr 2009 21:19:00 -0000 Message-ID: <20090428211846.8197.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/39942] Nonoptimal code - leaveq; xchg %ax,%ax; retq In-Reply-To: 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/msg02773.txt.bz2 ------- Comment #6 from vvv at ru dot ru 2009-04-28 21:18 ------- Let's compile file test.c //#file test.c extern int F(int m); void func(int x) { int u = F(x); while (u) u = F(u)*3+1; } # gcc -o t.out test.c -c -O2 # objdump -d t.out t.out: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 : 0: 48 83 ec 08 sub $0x8,%rsp 4: e8 00 00 00 00 callq 9 9: 85 c0 test %eax,%eax b: 89 c7 mov %eax,%edi d: 74 0e je 1d f: 90 nop 10: e8 00 00 00 00 callq 15 15: 8d 7c 40 01 lea 0x1(%rax,%rax,2),%edi 19: 85 ff test %edi,%edi 1b: 75 f3 jne 10 1d: 48 83 c4 08 add $0x8,%rsp 21: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) <---- nonoptimal 28: c3 retq -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39942