From patchwork Fri Mar 25 17:17:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 88403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id DC630B6F9B for ; Sat, 26 Mar 2011 04:18:05 +1100 (EST) Received: (qmail 18298 invoked by alias); 25 Mar 2011 17:17:59 -0000 Received: (qmail 18111 invoked by uid 22791); 25 Mar 2011 17:17:56 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Mar 2011 17:17:51 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2PHHpAW030375 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 25 Mar 2011 13:17:51 -0400 Received: from anchor.twiddle.home (ovpn-113-112.phx2.redhat.com [10.3.113.112]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2PHHofr010807; Fri, 25 Mar 2011 13:17:50 -0400 Message-ID: <4D8CCE3D.7010100@redhat.com> Date: Fri, 25 Mar 2011 10:17:49 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 To: Georg-Johann Lay CC: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Re: Cleaning up expand optabs code References: <4D825EF5.1010307@redhat.com> <87wrju28hn.fsf@firetop.home> <4D87A69B.90704@redhat.com> <4D88E10A.8080005@redhat.com> <4D8B32A9.9050309@linux.vnet.ibm.com> <4D8C8D81.5080103@gjlay.de> In-Reply-To: <4D8C8D81.5080103@gjlay.de> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 03/25/2011 05:41 AM, Georg-Johann Lay wrote: >> On 03/22/2011 06:48 PM, Richard Henderson wrote: >> >>> Ok. Watch out for other target problems this week. > > libgcc fails to build for avr (SVN 171446) > > ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c: In function > '__negdi2': > ../../../../../gcc.gnu.org/trunk/libgcc/../gcc/libgcc2.c:68:17: > internal compiler error: in maybe_gen_insn, at optabs.c:7123 This is due to a miscommunication between the middle-end and the backend about how many arguments the setmemhi pattern takes. (define_expand "setmemhi" [(parallel [(set (match_operand:BLK 0 "memory_operand" "") (match_operand 2 "const_int_operand" "")) (use (match_operand:HI 1 "const_int_operand" "")) (use (match_operand:HI 3 "const_int_operand" "n")) (clobber (match_scratch:HI 4 "")) (clobber (match_dup 5))])] The match_scratch is counted in .n_operands, which makes the count of operands not equal 4, so we assume 6 operands are necessary. We can fix this for the special case of avr by only assuming 6 operands when there are in fact 6 operands, but of course this could fail just as easily if there were two scratches. All of which suggests that optional arguments to a named optab is a mistake that ought to be rectified. I plan to commit the following after bootstrap and check. r~ diff --git a/gcc/expr.c b/gcc/expr.c index 4db1c77..0a95aa7 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1299,11 +1299,10 @@ emit_block_move_via_movmem (rtx x, rtx y, rtx size, unsigned int align, /* The check above guarantees that this size conversion is valid. */ create_convert_operand_to (&ops[2], size, mode, true); create_integer_operand (&ops[3], align / BITS_PER_UNIT); - if (nops != 4) + if (nops == 6) { create_integer_operand (&ops[4], expected_align / BITS_PER_UNIT); create_integer_operand (&ops[5], expected_size); - nops = 6; } if (maybe_expand_insn (code, nops, ops)) { @@ -2721,11 +2720,10 @@ set_storage_via_setmem (rtx object, rtx size, rtx val, unsigned int align, create_convert_operand_to (&ops[1], size, mode, true); create_convert_operand_from (&ops[2], val, byte_mode, true); create_integer_operand (&ops[3], align / BITS_PER_UNIT); - if (nops != 4) + if (nops == 6) { create_integer_operand (&ops[4], expected_align / BITS_PER_UNIT); create_integer_operand (&ops[5], expected_size); - nops = 6; } if (maybe_expand_insn (code, nops, ops)) return true;