From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32684 invoked by alias); 20 Apr 2011 17:24:22 -0000 Received: (qmail 32671 invoked by uid 22791); 20 Apr 2011 17:24:20 -0000 X-SWARE-Spam-Status: No, hits=-6.2 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; Wed, 20 Apr 2011 17:24:02 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3KHNwux024745 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 20 Apr 2011 13:23:58 -0400 Received: from anchor.twiddle.home (ovpn-113-71.phx2.redhat.com [10.3.113.71]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3KHNutq029646; Wed, 20 Apr 2011 13:23:57 -0400 Message-ID: <4DAF16AC.3020801@redhat.com> Date: Wed, 20 Apr 2011 17:44:00 -0000 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: Denis Chertykov CC: Georg-Johann Lay , gcc-patches@gcc.gnu.org, Anatoly Sokolov , Eric Weddington Subject: Re: [Patch,AVR]: FIX ICE in optabs due to bad rotate expander. References: <4DA6CB8E.1040707@gjlay.de> <4DA72CC6.5030001@gjlay.de> <4DA880F6.4070109@gjlay.de> <4DAC14F0.5070304@gjlay.de> <4DAD521B.9020501@gjlay.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg01680.txt.bz2 On 04/19/2011 02:52 AM, Denis Chertykov wrote: > 2011/4/19 Georg-Johann Lay : >> How can add, sub etc. be split? This would need an explicit >> representation of carry. > > Yes. > > Look at http://gcc.gnu.org/ml/gcc/2005-03/msg00871.html Well, sort-of, but not really. It gets a tad ugly, but have a look at the adddi3* patterns in the mn10300 and rx ports. In particular note how both the inputs and outputs to the insn (not the expander) are all SImode, allowing for lower_subreg to do its job. The patterns are split post-reload -- some of that is for scheduling, some of that simply makes computing the individual insn lengths significantly easier -- but you wouldn't really have to do that for AVR. For AVR things would become even trickier. You might consider (define_predicate "concat_operator" (match_code "concat")) (define_insn "addsi3_qqqq" [(set (match_operand:QI 0 "register_operand" "=r") (truncate:QI (plus:SI (match_operator:SI 12 "concat_operator" [(match_operand:QI 4 "register_operand" "0") (match_operand:QI 5 "register_operand" "1") (match_operand:QI 6 "register_operand" "2") (match_operand:QI 7 "register_operand" "3")]) (match_operator:SI 13 "concat_operator" [(match_operand:QI 8 "reg_or_0_operand" "rL") (match_operand:QI 9 "reg_or_0_operand" "rL") (match_operand:QI 10 "reg_or_0_operand" "rL") (match_operand:QI 11 "reg_or_0_operand" "rL")]))) (set (match_operand:QI 1 "register_operand" "=r") (truncate:QI (lshiftrt:SI (plus:SI (match_dup 24) (match_dup 25)) (const_int 8)))) (set (match_operand:QI 2 "register_operand" "=r") (truncate:QI (lshiftrt:SI (plus:SI (match_dup 24) (match_dup 25)) (const_int 16)))) (set (match_operand:QI 3 "register_operand" "=r") (truncate:QI (lshiftrt:SI (plus:SI (match_dup 24) (match_dup 25)) (const_int 24))))] "" "add %0,%Z8\;adc %1,%Z9\;adc %2,%Z10\;adc %3,%Z11" [(set_attr "length" "4")] ) This may require a little bit of code inside combine to handle CONCAT in a reasonable way, but that should be fairly minimal. It may also want some more special case patterns and/or peep2s to more efficiently handle constants, particularly considering adiw and subic. But I think it's at least worth investigating. r~