From patchwork Thu Mar 8 13:44:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 145521 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 975C6B6F9F for ; Fri, 9 Mar 2012 00:45:39 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331819140; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=2FPQEPW HVTv+7nc+HeecrCwFRWo=; b=UomNvsYithPDFI9D8K4zwJ4A0PAQKZYkRREF/WW HLMzAvmRW3D2TBi07WJEjzM8iHai331BNHFhWMijsgCP41hoBt1BBJo9gvzWqDWb N/aJj4uW6rYpeQyuaE37RRouS6HIpqOINfVqblPLlbvHSjvGJiSCegC+7p+kz4jP Kjck= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:X-RZG-AUTH:X-RZG-CLASS-ID:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=s0hoNFKCJND+32wFKg7i2v9Ai65IAydyBFmPdCpqJSaTVrKl3eSl23lqx5eYEF MzZx+Wuj7E42fsmhnddXs0cXTZYoQLle4UASYW8j48jjx3O1gilV4WFzAXXSjFTj P0vBf+q4FR5Gs/vFLArYHyHpRRc5v8DJRVaEBiMfaWQ1A=; Received: (qmail 18727 invoked by alias); 8 Mar 2012 13:45:20 -0000 Received: (qmail 18657 invoked by uid 22791); 8 Mar 2012 13:45:17 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.161) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Mar 2012 13:45:03 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by smtp.strato.de (klopstock mo61) (RZmta 27.7 AUTH) with ESMTPA id o01c6do28DROGQ ; Thu, 8 Mar 2012 14:44:48 +0100 (MET) Message-ID: <4F58B7CE.8050205@gjlay.de> Date: Thu, 08 Mar 2012 14:44:46 +0100 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: Denis Chertykov , Eric Weddington Subject: [Patch,AVR]: Add "w" constraint alternative to addhi3 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 This patch adds a "w" alternative to *addhi3 and addhi3_clobber in order to vote for class "w". This is similar to the orgiginal addhi3 insn up to version 4.6. And there is no more explicit vote for "l" in addhi3_clobber, it's just "r". Intention is to get a better usage of ADIW and SBIW instructions. Would it be good to split the alternatives even more and add "?" costs to non-w registers? Moreover, it might be advantageous to move addhi3_clobber up and before *addhi3? Passed without regressions. Ok for trunk? Johann * config/avr/avr.md (*addhi3, addhi3_clobber): Add "w" alternative for constants in [-63,63]. Index: config/avr/avr.md =================================================================== --- config/avr/avr.md (revision 185100) +++ config/avr/avr.md (working copy) @@ -1098,15 +1098,16 @@ (define_insn "*addhi3_sp" (set_attr "adjust_len" "addto_sp")]) (define_insn "*addhi3" - [(set (match_operand:HI 0 "register_operand" "=r,d,d") - (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0") - (match_operand:HI 2 "nonmemory_operand" "r,s,n")))] + [(set (match_operand:HI 0 "register_operand" "=r,d,!w,d") + (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0 ,0") + (match_operand:HI 2 "nonmemory_operand" "r,s,IJ,n")))] "" { static const char * const asm_code[] = { "add %A0,%A2\;adc %B0,%B2", "subi %A0,lo8(-(%2))\;sbci %B0,hi8(-(%2))", + "", "" }; @@ -1115,9 +1116,9 @@ (define_insn "*addhi3" return avr_out_plus_noclobber (operands, NULL, NULL); } - [(set_attr "length" "2,2,2") - (set_attr "adjust_len" "*,*,out_plus_noclobber") - (set_attr "cc" "set_n,set_czn,out_plus_noclobber")]) + [(set_attr "length" "2,2,2,2") + (set_attr "adjust_len" "*,*,out_plus_noclobber,out_plus_noclobber") + (set_attr "cc" "set_n,set_czn,out_plus_noclobber,out_plus_noclobber")]) ;; Adding a constant to NO_LD_REGS might have lead to a reload of ;; that constant to LD_REGS. We don't add a scratch to *addhi3 @@ -1155,10 +1156,10 @@ (define_peephole2 ; addhi3_clobber (clobber (match_dup 2))])]) (define_insn "addhi3_clobber" - [(set (match_operand:HI 0 "register_operand" "=d,l") - (plus:HI (match_operand:HI 1 "register_operand" "%0,0") - (match_operand:HI 2 "const_int_operand" "n,n"))) - (clobber (match_scratch:QI 3 "=X,&d"))] + [(set (match_operand:HI 0 "register_operand" "=!w,d,r") + (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0") + (match_operand:HI 2 "const_int_operand" "IJ,n,n"))) + (clobber (match_scratch:QI 3 "=X,X,&d"))] "" { gcc_assert (REGNO (operands[0]) == REGNO (operands[1]));