From patchwork Fri Dec 18 12:53:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 558865 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 7A13B140180 for ; Fri, 18 Dec 2015 23:53:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=rxlwK+UE; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=gZuMPYv+hkD5jVjNZ lDRyO8R4cAt56TSWcDl3Xf2XjTqcngdzWMCK8wlhSW3xCMGvirwS1LcH0lpLH5vO Cew0PXnWkKT2UIdHrdO6Odbh3C4oftv+8Mp3OARuu4M2/OXdo85codeiuJLH+UiV HkUt2BM+kcLVaAgwK8NUP69GF4= 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 :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=TmD1L9T3dIfMFGugtNssCKX 0Jn4=; b=rxlwK+UEf5cPFvNdU8dcIuxfQ08K/uk6Yhth+ifji/MOVNJ/vZpsZsd 3fn+SplKL1fUGyj/6MRCwkOlHkLZpV12W5zDuXnmYQ16txDsb9962pEs6LrF0Mw3 kQGbj0jdPKQUGk1edo1KYqbMQlcQjDHOiX0Fp9oi0xH7UUDtvHLM= Received: (qmail 36060 invoked by alias); 18 Dec 2015 12:53:35 -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 36049 invoked by uid 89); 18 Dec 2015 12:53:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f46.google.com Received: from mail-wm0-f46.google.com (HELO mail-wm0-f46.google.com) (74.125.82.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 18 Dec 2015 12:53:33 +0000 Received: by mail-wm0-f46.google.com with SMTP id l126so63982891wml.1 for ; Fri, 18 Dec 2015 04:53:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=VopSbnoiflMfLHrWeyvMKn9UOoX0vVVEE0Lwn+8PmF0=; b=d8cW3SvJAiIWCsjvTRpP2xjNakB/wVmTj5XZMniraG8SzWml63YwrXfDPLsnyRsNY1 3miOn5KvtHiHxPMY/6bMBxiEFDj/YHiPwJmwo4+q6rImiszV2rIWgoKEyPa4FQ0Fx36B 3FMdbeQ2FoFzn3TzF4dC5qikkniRP98qfK2IFhtXYvAMw417n8B8LdMsTTFy3mz0cPAe jgEl3YxwEy6DPO8GC63ZMwlu2w4eaX9btBPOKyDOnuJz66etsGvStJP8UeUwjEQMzDQ6 43iulheSRs5GU7SKxi+d1J8aIYM4gslgRy+Vaz3l6WwgCr3EM4TXJQ76ukIbg4Yrv5GM Z2PA== X-Gm-Message-State: ALoCoQn1NOVLwNrfCIZ7LbO1SyK5wTFOsMvKMRLHbb5N0rY/rHNfBJ0H8h5N4g1Ys98TqsmkIeyF1Zw1jx7FduNqZ3ZNMmAfow== X-Received: by 10.28.12.69 with SMTP id 66mr3107248wmm.73.1450443210266; Fri, 18 Dec 2015 04:53:30 -0800 (PST) Received: from localhost (host86-138-95-213.range86-138.btcentralplus.com. [86.138.95.213]) by smtp.gmail.com with ESMTPSA id ej10sm14740672wjd.32.2015.12.18.04.53.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Dec 2015 04:53:29 -0800 (PST) Date: Fri, 18 Dec 2015 12:53:28 +0000 From: Andrew Burgess To: gcc-patches@gcc.gnu.org Cc: Claudiu.Zissulescu@synopsys.com, gnu@amylaar.uk Subject: Re: [PATCH 3/4] gcc/arc: Remove store_update_operand predicate Message-ID: <20151218125328.GC21941@embecosm.com> References: <816068b13fbcb71848031a000a2da51aab2853c0.1450224136.git.andrew.burgess@embecosm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <816068b13fbcb71848031a000a2da51aab2853c0.1450224136.git.andrew.burgess@embecosm.com> X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Here's a revised version of this patch, written to use the any_mem_operand predicate. Thanks, Andrew --- The use of the arc specific predicate store_update_operand is broken, this commit fixes the error, switching to use 'any_mem_operand' instead. Currently store_update_operand is used with match_operator, the store_update_operand checks that the operand is a MEM operand, with an operand that is a plus, the plus in turn has operands that are a register and an immediate. However, the match_operator already checks the structure of the rtl tree, only in this case a different rtl pattern is checked for, in this case the operand must have two child operands, one a register operand and one an immediate operand. The mistake here is that the plus part of the rtl tree has been missed from the define_insn rtl pattern. The consequence of this mistake is that a MEM operand will match the store_update_operand predicate, then the second operand of the MEM insn will then be passed to the nonmemory_operand predicate, which assumes it will be passed an rtl_insn. However, the second operand of a MEM insn is the alias set for the address, not an rtl_insn. When fixing the rtl pattern within the define_insn it becomes obvious that all of the checks currently contained within the store_update_operand predicate are now contains within the rtl pattern, the only thing that a predicate now needs to do is to confirm that the operand being matched by the match_operator is a memory operand. This is achieved by switching to the 'any_mem_operand' predicate. gcc/ChangeLog: * config/arc/arc.md (*storeqi_update): Use 'memory_operand' and fix RTL pattern to include the plus. (*storehi_update): Likewise. (*storesi_update): Likewise. (*storesf_update): Likewise. * config/arc/predicates.md (store_update_operand): Delete. --- gcc/ChangeLog | 9 +++++++++ gcc/config/arc/arc.md | 24 ++++++++++++------------ gcc/config/arc/predicates.md | 18 ------------------ 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c14a5a..b2dff58 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2015-12-09 Andrew Burgess + * config/arc/arc.md (*storeqi_update): Use 'any_mem_operand' and + fix RTL pattern to include the plus. + (*storehi_update): Likewise. + (*storesi_update): Likewise. + (*storesf_update): Likewise. + * config/arc/predicates.md (store_update_operand): Delete. + +2015-12-09 Andrew Burgess + * config/arc/arc.md (*loadqi_update): Use new 'any_mem_operand' and fix RTL pattern to include the plus. (*load_zeroextendqisi_update): Likewise. diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 7ca4431..9e73d02 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -1149,9 +1149,9 @@ (set_attr "length" "4,8")]) (define_insn "*storeqi_update" - [(set (match_operator:QI 4 "store_update_operand" - [(match_operand:SI 1 "register_operand" "0") - (match_operand:SI 2 "short_immediate_operand" "I")]) + [(set (match_operator:QI 4 "any_mem_operand" + [(plus:SI (match_operand:SI 1 "register_operand" "0") + (match_operand:SI 2 "short_immediate_operand" "I"))]) (match_operand:QI 3 "register_operand" "c")) (set (match_operand:SI 0 "dest_reg_operand" "=w") (plus:SI (match_dup 1) (match_dup 2)))] @@ -1200,9 +1200,9 @@ (set_attr "length" "4,8")]) (define_insn "*storehi_update" - [(set (match_operator:HI 4 "store_update_operand" - [(match_operand:SI 1 "register_operand" "0") - (match_operand:SI 2 "short_immediate_operand" "I")]) + [(set (match_operator:HI 4 "any_mem_operand" + [(plus:SI (match_operand:SI 1 "register_operand" "0") + (match_operand:SI 2 "short_immediate_operand" "I"))]) (match_operand:HI 3 "register_operand" "c")) (set (match_operand:SI 0 "dest_reg_operand" "=w") (plus:SI (match_dup 1) (match_dup 2)))] @@ -1225,9 +1225,9 @@ (set_attr "length" "4,8")]) (define_insn "*storesi_update" - [(set (match_operator:SI 4 "store_update_operand" - [(match_operand:SI 1 "register_operand" "0") - (match_operand:SI 2 "short_immediate_operand" "I")]) + [(set (match_operator:SI 4 "any_mem_operand" + [(plus:SI (match_operand:SI 1 "register_operand" "0") + (match_operand:SI 2 "short_immediate_operand" "I"))]) (match_operand:SI 3 "register_operand" "c")) (set (match_operand:SI 0 "dest_reg_operand" "=w") (plus:SI (match_dup 1) (match_dup 2)))] @@ -1249,9 +1249,9 @@ (set_attr "length" "4,8")]) (define_insn "*storesf_update" - [(set (match_operator:SF 4 "store_update_operand" - [(match_operand:SI 1 "register_operand" "0") - (match_operand:SI 2 "short_immediate_operand" "I")]) + [(set (match_operator:SF 4 "any_mem_operand" + [(plus:SI (match_operand:SI 1 "register_operand" "0") + (match_operand:SI 2 "short_immediate_operand" "I"))]) (match_operand:SF 3 "register_operand" "c")) (set (match_operand:SI 0 "dest_reg_operand" "=w") (plus:SI (match_dup 1) (match_dup 2)))] diff --git a/gcc/config/arc/predicates.md b/gcc/config/arc/predicates.md index 268ff7e..ba11cd1 100644 --- a/gcc/config/arc/predicates.md +++ b/gcc/config/arc/predicates.md @@ -460,24 +460,6 @@ } ) -;; Return true if OP is valid store with update operand. -(define_predicate "store_update_operand" - (match_code "mem") -{ - if (GET_CODE (op) != MEM - || GET_MODE (op) != mode) - return 0; - op = XEXP (op, 0); - if (GET_CODE (op) != PLUS - || GET_MODE (op) != Pmode - || !register_operand (XEXP (op, 0), Pmode) - || !(GET_CODE (XEXP (op, 1)) == CONST_INT - && SMALL_INT (INTVAL (XEXP (op, 1))))) - return 0; - return 1; -} -) - ;; Return true if OP is a non-volatile non-immediate operand. ;; Volatile memory refs require a special "cache-bypass" instruction ;; and only the standard movXX patterns are set up to handle them.