From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122928 invoked by alias); 20 Mar 2017 11:47:47 -0000 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 Received: (qmail 122739 invoked by uid 89); 20 Mar 2017 11:47:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=UD:as, Hx-languages-length:1518 X-HELO: smtprelay.synopsys.com Received: from smtprelay.synopsys.com (HELO smtprelay.synopsys.com) (198.182.47.9) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Mar 2017 11:47:44 +0000 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 9BE4724E0CEF; Mon, 20 Mar 2017 04:47:43 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 8C220FCA; Mon, 20 Mar 2017 04:47:43 -0700 (PDT) Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) by mailhost.synopsys.com (Postfix) with ESMTP id 8233BFC7; Mon, 20 Mar 2017 04:47:43 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 20 Mar 2017 04:46:04 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 20 Mar 2017 17:16:01 +0530 Received: from nl20droid1.internal.synopsys.com (10.100.24.228) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 20 Mar 2017 17:16:00 +0530 From: Claudiu Zissulescu To: CC: , , Subject: [PATCH 2/5] [ARC] Fix detection of long immediate for load/store operands. Date: Mon, 20 Mar 2017 11:47:00 -0000 Message-ID: <1490010210-9489-3-git-send-email-claziss@synopsys.com> In-Reply-To: <1490010210-9489-1-git-send-email-claziss@synopsys.com> References: <1490010210-9489-1-git-send-email-claziss@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-03/txt/msg01015.txt.bz2 ARC can use scaled offsets when loading (i.e. ld.as rA,[base, offset]). Where base and offset can be a register or an immediate operand. The scaling only applies on the offset part of the instruction. The compiler can accept an address like this: (plus:SI (mult:SI (reg:SI 2 r2 [orig:596 _2129 ] [596]) (const_int 4 [0x4])) (const_int 60 [0x3c])) Hence, to emit this instruction we place the (const_int 60) into base and the register into offset to take advantage of the scaled offset facility of the load instruction. As a result the length of the load instruction is 8 bytes. However, the long_immediate_loadstore_operand predicate used for calculating the length attribute doesn't recognize this address and returns a wrong decision leading to a wrong length computation for a load instruction using the above address. gcc/ 2016-09-21 Claudiu Zissulescu * config/arc/predicates.md (long_immediate_loadstore_operand): Consider scaled addresses cases. --- gcc/config/arc/predicates.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/config/arc/predicates.md b/gcc/config/arc/predicates.md index 0dec736..8dd8d55 100644 --- a/gcc/config/arc/predicates.md +++ b/gcc/config/arc/predicates.md @@ -148,6 +148,11 @@ { rtx x = XEXP (op, 1); + if ((GET_CODE (XEXP (op, 0)) == MULT) + && REG_P (XEXP (XEXP (op, 0), 0)) + && CONSTANT_P (x)) + return 1; + if (GET_CODE (x) == CONST) { x = XEXP (x, 0); -- 1.9.1