From patchwork Tue Dec 22 11:12:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominik Vogt X-Patchwork-Id: 559979 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 5E1D7140BB7 for ; Tue, 22 Dec 2015 22:13:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=nlDR/Qdp; 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:reply-to:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=s5WgIbpz/chQs+5HH NCJokes6NnfoZoNmWr737+P+UZUN8rOtQAhVU0ip90Bx2rQeBJh0f5juU91M/HQ3 ri3hS0mrrFHo9CNW09jPaqpmQurU83RxBltyKY3NMxxsICww1LkswxHY5cDHnx4H 1qzYkcOOOnHk+kKodF5tHj++L0= 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:reply-to:references:mime-version :content-type:in-reply-to; s=default; bh=vKIY6k14cF3Qy0qvZani/iv FD0Q=; b=nlDR/QdpwGOclShacJIEZG/Az7zCg2i7rq591j+4QNVYXHJp3aILwNY FWY2F7BKHgCs9dIUHQiwsPopANqYtLbwLe873B3xjt3sRGUrOYKY5bfALdeejW2E usb6vN4ag2bhRj8wTv5U0J6W/dxfjc2TQWYizbHdmThQ+rwsoF0s= Received: (qmail 110047 invoked by alias); 22 Dec 2015 11:13:07 -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 110030 invoked by uid 89); 22 Dec 2015 11:13:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Although, Special, IBM, Treat X-HELO: e06smtp13.uk.ibm.com Received: from e06smtp13.uk.ibm.com (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Tue, 22 Dec 2015 11:13:04 +0000 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Dec 2015 11:13:01 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 22 Dec 2015 11:12:59 -0000 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: vogt@linux.vnet.ibm.com X-IBM-RcptTo: gcc-patches@gcc.gnu.org Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 68A3B17D8056 for ; Tue, 22 Dec 2015 11:13:37 +0000 (GMT) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tBMBCxJd5243176 for ; Tue, 22 Dec 2015 11:12:59 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tBMBCw3M006325 for ; Tue, 22 Dec 2015 04:12:59 -0700 Received: from bl3ahm9f.de.ibm.com (sig-9-81-94-146.evts.uk.ibm.com [9.81.94.146]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tBMBCwAW006277; Tue, 22 Dec 2015 04:12:58 -0700 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1aBKsD-0008Ep-2y; Tue, 22 Dec 2015 12:12:57 +0100 Date: Tue, 22 Dec 2015 12:12:56 +0100 From: Dominik Vogt To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford , Ulrich Weigand , Andreas Krebbel Subject: Re: [RFC][PATCH] Fix broken handling of LABEL_REF in genrecog + genpreds. Message-ID: <20151222111256.GA25715@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: gcc-patches@gcc.gnu.org, Richard Sandiford , Ulrich Weigand , Andreas Krebbel References: <20151216124305.GA12471@linux.vnet.ibm.com> <87twngt711.fsf@googlemail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87twngt711.fsf@googlemail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15122211-0013-0000-0000-00000814D07B On Fri, Dec 18, 2015 at 09:55:54AM +0000, Richard Sandiford wrote: > Dominik Vogt writes: > > The attached patch fixes the handling of LABEL_REF in genrecog and > > genpreds. > > > > The current code assumes that X can have only a mode than PRED (X, > > MODE) if X is CONST_INT, CONST_DOUBLE or CONST_WIDE_INT, but > > actually that can be also the case for a LABEL_REF with VOIDmode. > > Due to this it is necessary to add "const_int" (or similar) to > > match_code of some predicates handling label_ref but not > > const_int. > > OK, thanks. > > As mentioned in the other thread, I think LABEL_REFs shouldn't have > VOIDmode, so long-term we should be fixing the targets. I agree this > is the correct workaround until that happens though. All right, in the mean time the patch has passed the test suite on x86_64, s390x and s390. See attached version 2 of the patch (added just an additional comment in genpreds.c). Ciao Dominik ^_^ ^_^ From 84c51fbb773cb62a24b150063428ba74e42f4146 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Fri, 11 Dec 2015 17:14:25 +0100 Subject: [PATCH] Fix handling of LABEL_REF in safe_predicate_mode. The old code assumes that X can have only a mode than PRED (X, MODE) if X is CONST_INT, CONST_DOUBLE or CONST_WIDE_INT, but actually that can be also the case for LABEL_REF. Due to this it was necessary to add "const_int" (or similar) to match_code of some predicates handling label_ref but not const_int. --- gcc/config/s390/predicates.md | 5 +---- gcc/genpreds.c | 2 ++ gcc/genrecog.c | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md index 02a1e4e..1211cf01 100644 --- a/gcc/config/s390/predicates.md +++ b/gcc/config/s390/predicates.md @@ -122,10 +122,7 @@ ;; Return true if OP a valid operand for the LARL instruction. (define_predicate "larl_operand" -; Note: Although CONST_INT and CONST_DOUBLE are not handled in this predicate, -; at least one of them needs to appear or otherwise safe_predicate_mode will -; assume that a VOIDmode LABEL_REF is not accepted either (see genrecog.c). - (match_code "label_ref, symbol_ref, const, const_int, const_double") + (match_code "label_ref, symbol_ref, const") { /* Allow labels and local symbols. */ if (GET_CODE (op) == LABEL_REF) diff --git a/gcc/genpreds.c b/gcc/genpreds.c index eac2180..c82113d 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -320,6 +320,8 @@ add_mode_tests (struct pred_data *p) { case CONST_INT: case CONST_WIDE_INT: + /* Special handling for (VOIDmode) LABEL_REFs. */ + case LABEL_REF: matches_const_scalar_int_p = true; break; diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 599121f..81ea35b 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -3382,7 +3382,8 @@ safe_predicate_mode (const struct pred_data *pred, machine_mode mode) if (GET_MODE_CLASS (mode) == MODE_INT && (pred->codes[CONST_INT] || pred->codes[CONST_DOUBLE] - || pred->codes[CONST_WIDE_INT])) + || pred->codes[CONST_WIDE_INT] + || pred->codes[LABEL_REF])) return false; return !pred->special && mode != VOIDmode; -- 2.3.0