From patchwork Sat Jan 3 19:34:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 425125 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 9E47C14007D for ; Sun, 4 Jan 2015 06:35:13 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:from:content-type:date:subject:to:mime-version; q= dns; s=default; b=A0A0vSD2iBBw5QiVDcX7hI9cFsPQ67ze0v5SoN5EupY162 47YDUu8DNEAbJm1uRrJ7DTxZk96GkYzBX9+ZYu4aMvrVbecvPBQc/QCbBCHGJx1E MbKHCf0g7PaXemWcxqY9lBGW1/AC+ZFltjKF1t4OlfZ3eO+0gPKhwLCjY3G3w= 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 :message-id:from:content-type:date:subject:to:mime-version; s= default; bh=c23bnKxNy4k9Ud3EO+JBy2LuTL4=; b=W3ixgtKZE8NbjvvKttJk z5XXnGYUBEgivh8IEQ9Okcr6XIeRL/eLT84f18QxP3XJCFsS1+vuA4NZk4yTNFV9 mCNRVt3cvKxCaewDfC2xGfILtMTDpmRhPhkk3jOz7rimpCRAhBsHwjV6UyMuua9o N/xa7+qYiHrJ24+dPV6P3EU= Received: (qmail 4589 invoked by alias); 3 Jan 2015 19:35:05 -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 4575 invoked by uid 89); 3 Jan 2015 19:35:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: BLU004-OMC3S3.hotmail.com Received: from blu004-omc3s3.hotmail.com (HELO BLU004-OMC3S3.hotmail.com) (65.55.116.78) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Sat, 03 Jan 2015 19:35:01 +0000 Received: from BLU437-SMTP89 ([65.55.116.72]) by BLU004-OMC3S3.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Sat, 3 Jan 2015 11:34:59 -0800 X-TMN: [kj55DJmiXDqNrFK01crG1MU8/ibbPimq] Message-ID: From: John David Anglin Date: Sat, 3 Jan 2015 14:34:56 -0500 Subject: [committed] Fix memory constraint issue on PA To: GCC Patches MIME-Version: 1.0 (Apple Message framework v1085) The attached change fixes a memory constraint issue found building the asterisk package on hppa-linux: http://buildd.debian-ports.org/status/fetch.php?pkg=asterisk&arch=hppa&ver=1%3A13.1.0%7Edfsg-1&stamp=1420088700 The problem was the `m' constraint allowed reload to substitute a register indexed memory form which is invalid for store instructions. This wasn't detected by the predicate but it was detected by the assembler. The patch changes to using the `Q' constraint which doesn't allow the register indexed memory form. The predicate was also tightened to reject the register indexed memory and LO_SUM DLT memory address forms that are unsuitable for stores on hppa. Tested on hppa-unknown-linux-gnu, hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11 with no objserved regressions. Committed to trunk and 4.9 branch. Dave --- John David Anglin dave.anglin@bell.net 2015-01-03 John David Anglin * config/pa/pa.md (decrement_and_branch_until_zero): Use `Q' constraint instead of `m' constraint. Likewise for unnamed movb comparison patterns using reg_before_reload_operand predicate. * config/pa/predicates.md (reg_before_reload_operand): Tighten predicate to reject register index and LO_SUM DLT memory forms after reload. Index: config/pa/pa.md =================================================================== --- config/pa/pa.md (revision 219114) +++ config/pa/pa.md (working copy) @@ -8922,7 +8922,7 @@ ;; strength reduction is used. It is actually created when the instruction ;; combination phase combines the special loop test. Since this insn ;; is both a jump insn and has an output, it must deal with its own -;; reloads, hence the `m' constraints. The `!' constraints direct reload +;; reloads, hence the `Q' constraints. The `!' constraints direct reload ;; to not choose the register alternatives in the event a reload is needed. (define_insn "decrement_and_branch_until_zero" [(set (pc) @@ -8929,7 +8929,7 @@ (if_then_else (match_operator 2 "comparison_operator" [(plus:SI - (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*m") + (match_operand:SI 0 "reg_before_reload_operand" "+!r,!*f,*Q") (match_operand:SI 1 "int5_operand" "L,L,L")) (const_int 0)]) (label_ref (match_operand 3 "" "")) @@ -9018,7 +9018,7 @@ [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)]) (label_ref (match_operand 3 "" "")) (pc))) - (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q") + (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*Q,!*q") (match_dup 1))] "" "* return pa_output_movb (operands, insn, which_alternative, 0); " @@ -9090,7 +9090,7 @@ [(match_operand:SI 1 "register_operand" "r,r,r,r") (const_int 0)]) (pc) (label_ref (match_operand 3 "" "")))) - (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*m,!*q") + (set (match_operand:SI 0 "reg_before_reload_operand" "=!r,!*f,*Q,!*q") (match_dup 1))] "" "* return pa_output_movb (operands, insn, which_alternative, 1); " Index: config/pa/predicates.md =================================================================== --- config/pa/predicates.md (revision 219114) +++ config/pa/predicates.md (working copy) @@ -528,20 +528,29 @@ ;; This predicate is used for branch patterns that internally handle ;; register reloading. We need to accept non-symbolic memory operands ;; after reload to ensure that the pattern is still valid if reload -;; didn't find a hard register for the operand. +;; didn't find a hard register for the operand. We also reject index +;; and lo_sum DLT address as these are invalid for move destinations. (define_predicate "reg_before_reload_operand" (match_code "reg,mem") { + rtx op0; + if (register_operand (op, mode)) return true; - if (reload_completed - && memory_operand (op, mode) - && !symbolic_memory_operand (op, mode)) - return true; + if (!reload_in_progress && !reload_completed) + return false; - return false; + if (! MEM_P (op)) + return false; + + op0 = XEXP (op, 0); + + return (memory_address_p (mode, op0) + && !IS_INDEX_ADDR_P (op0) + && !IS_LO_SUM_DLT_ADDR_P (op0) + && !symbolic_memory_operand (op, mode)); }) ;; True iff OP is a register or const_0 operand for MODE.