From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 11:13:00 -0000 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-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" 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 X-SW-Source: 2015-12/txt/msg02026.txt.bz2 --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1005 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 ^_^ ^_^ -- Dominik Vogt IBM Germany --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=0001-v2-ChangeLog Content-length: 335 gcc/ChangeLog * config/s390/predicates.md ("larl_operand"): Remove now superfluous const_int and const_double. * genrecog.c (safe_predicate_mode): Return false for VOIDmode LABEL_REFs even if the predicate does not handle const_int, const_double or const_wide_int. * genpreds.c (add_mode_tests): Treat LABEL_REF like CONST_INT. --+HP7ph2BbKc20aGI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-v2-Fix-handling-of-LABEL_REF-in-safe_predicate_mode.patch" Content-length: 2280 >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 --+HP7ph2BbKc20aGI--