From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2982 invoked by alias); 15 May 2009 23:06:03 -0000 Received: (qmail 2922 invoked by uid 48); 15 May 2009 23:05:45 -0000 Date: Fri, 15 May 2009 23:06:00 -0000 Message-ID: <20090515230545.2921.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: "hjl dot tools at gmail dot com" 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-05/txt/msg01368.txt.bz2 ------- Comment #44 from hjl dot tools at gmail dot com 2009-05-15 23:05 ------- (In reply to comment #41) > The 34 resp. 51 4 branches in 16 byte page with the 3 patches together made me > look at one of the cases which was wrong and the problem is that cmp $0x1d, %al > has too large get_attr_lenght (insn) returned, 3 instead of 2, because GCC > thinks it has modrm byte when it has not. > Testing: > --- gcc/config/i386/i386.md.jj2009-05-13 08:42:51.000000000 +0200 > +++ gcc/config/i386/i386.md2009-05-15 18:06:40.000000000 +0200 > @@ -504,6 +504,9 @@ > (and (eq_attr "type" "callv") > (match_operand 1 "constant_call_address_operand" "")) > (const_int 0) > + (and (eq_attr "type" "alu,alu1,icmp,test") > + (match_operand 0 "ax_reg_operand" "")) > + (symbol_ref "(get_attr_length_immediate (insn) > (get_attr_mode (insn) != > MODE_QI))") > ] > (const_int 1))) > "cmp imm,%al/%ax/%eax/%rax" doesn't have the modrm byte. I think this patch works better: --- i386.md.branch 2009-05-15 11:30:42.000000000 -0700 +++ i386.md 2009-05-15 14:44:11.000000000 -0700 @@ -504,6 +504,10 @@ (and (eq_attr "type" "callv") (match_operand 1 "constant_call_address_operand" "")) (const_int 0) + (and (eq_attr "type" "alu,alu1,icmp,test") + (match_operand 0 "ax_reg_operand" "") + (match_operand 1 "immediate_operand" "")) + (const_int 0) ] (const_int 1))) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39942