From patchwork Fri Sep 12 18:13:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 388764 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 73C681401AC for ; Sat, 13 Sep 2014 04:14:00 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject; q=dns; s=default; b=SCjG/2ypFnVfoqJ NPIvs4aHyy8XW+HRKUGmgXp5sORk6deEEgG62naGbNauuEpyxlOD0E0ZwRvNncUM V5gt/SHVT0VuANyTMKSmCoD3Qq0Qc9OuwN0aWWXqJIlhPSvAFd9eRZMilnoJK7Q1 QQip/DIeUILEuSmNMjXBU6gj03Hs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject; s=default; bh=dr16m23FOv4wMPChs6vv0 aDjKNg=; b=LEspndObgV0e/1yXSSj4osdMX+wr+NWS0/zcpvC1MIthPrs5iHcye c0OAV1bFlgGyeVOuZPa5Uc7V8lT/cUwU6IE3PU5s9WfMElJOn9dUrtmdDX0Bvqz/ nf/r1/U5E7Jc61L1FwzJAWEl/d7AbcJ3lt+UWswL0BAw2h2J4j8b5o= Received: (qmail 27828 invoked by alias); 12 Sep 2014 18:13:53 -0000 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 Received: (qmail 27815 invoked by uid 89); 12 Sep 2014 18:13:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 12 Sep 2014 18:13:51 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8CIDnpX004961 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 12 Sep 2014 14:13:50 -0400 Received: from greed.delorie.com (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8CIDmIQ025705 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 12 Sep 2014 14:13:49 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.14.4/8.14.4) with ESMTP id s8CIDmrL008743 for ; Fri, 12 Sep 2014 14:13:48 -0400 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id s8CIDm0w008742; Fri, 12 Sep 2014 14:13:48 -0400 Date: Fri, 12 Sep 2014 14:13:48 -0400 Message-Id: <201409121813.s8CIDm0w008742@greed.delorie.com> From: DJ Delorie To: gcc-patches@gcc.gnu.org Subject: [msp430] fix RLAM opcodes X-IsSubscribed: yes This fixes cases where negative indices are used for array offsets. Committed. * config/msp430/msp430.md (extendhipsi2): Use 20-bit form of RLAM/RRAM. (extend_and_shift1_hipsi2): Likewise. (extend_and_shift2_hipsi2): Likewise. Index: gcc/config/msp430/msp430.md =================================================================== --- gcc/config/msp430/msp430.md (revision 215228) +++ gcc/config/msp430/msp430.md (working copy) @@ -565,13 +565,13 @@ ) (define_insn "extendhipsi2" [(set (match_operand:PSI 0 "nonimmediate_operand" "=r") (subreg:PSI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0")) 0))] "TARGET_LARGE" - "RLAM #4, %0 { RRAM #4, %0" + "RLAM.A #4, %0 { RRAM.A #4, %0" ) ;; Look for cases where integer/pointer conversions are suboptimal due ;; to missing patterns, despite us not having opcodes for these ;; patterns. Doing these manually allows for alternate optimization ;; paths. @@ -593,21 +593,21 @@ (define_insn "extend_and_shift1_hipsi2" [(set (subreg:SI (match_operand:PSI 0 "nonimmediate_operand" "=r") 0) (ashift:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0")) (const_int 1)))] "TARGET_LARGE" - "RLAM #4, %0 { RRAM #3, %0" + "RLAM.A #4, %0 { RRAM.A #3, %0" ) (define_insn "extend_and_shift2_hipsi2" [(set (subreg:SI (match_operand:PSI 0 "nonimmediate_operand" "=r") 0) (ashift:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0")) (const_int 2)))] "TARGET_LARGE" - "RLAM #4, %0 { RRAM #2, %0" + "RLAM.A #4, %0 { RRAM.A #2, %0" ) ; Nasty - we are sign-extending a 20-bit PSI value in one register into ; two adjacent 16-bit registers to make an SI value. There is no MSP430X ; instruction that will do this, so we push the 20-bit value onto the stack ; and then pop it off as two 16-bit values.