From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2995 invoked by alias); 16 Dec 2015 12:43:14 -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 2984 invoked by uid 89); 16 Dec 2015 12:43:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: e06smtp10.uk.ibm.com Received: from e06smtp10.uk.ibm.com (HELO e06smtp10.uk.ibm.com) (195.75.94.106) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 16 Dec 2015 12:43:12 +0000 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 16 Dec 2015 12:43:08 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 16 Dec 2015 12:43:07 -0000 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: vogt@linux.vnet.ibm.com X-IBM-RcptTo: gcc-patches@gcc.gnu.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id D362A219005F for ; Wed, 16 Dec 2015 12:42:58 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tBGCh7rw8388884 for ; Wed, 16 Dec 2015 12:43:07 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tBGCh6d5017030 for ; Wed, 16 Dec 2015 05:43:06 -0700 Received: from bl3ahm9f.de.ibm.com (dyn-9-152-212-91.boeblingen.de.ibm.com [9.152.212.91]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tBGCh6ew017025; Wed, 16 Dec 2015 05:43:06 -0700 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1a9BQ9-0003Ql-Vn; Wed, 16 Dec 2015 13:43:06 +0100 Date: Wed, 16 Dec 2015 12:43:00 -0000 From: Dominik Vogt To: gcc-patches@gcc.gnu.org Cc: Ulrich Weigand , Andreas Krebbel , rdsandiford@googlemail.com Subject: [RFC][PATCH] Fix broken handling of LABEL_REF in genrecog + genpreds. Message-ID: <20151216124305.GA12471@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: gcc-patches@gcc.gnu.org, Ulrich Weigand , Andreas Krebbel , rdsandiford@googlemail.com MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="pf9I7BMVVzbSWLtt" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15121612-0041-0000-0000-000006AE9598 X-SW-Source: 2015-12/txt/msg01594.txt.bz2 --pf9I7BMVVzbSWLtt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 458 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. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany --pf9I7BMVVzbSWLtt Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=0001-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. --pf9I7BMVVzbSWLtt Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-broken-handling-of-LABEL_REF-in-genrecog-genpreds.patch" Content-length: 2234 >From a211b6e3e2a64bdf47507c0e6151f137bcd4641f Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Fri, 11 Dec 2015 17:14:25 +0100 Subject: [PATCH] Fix broken handling of LABEL_REF in genrecog + genpreds. The old code assumed 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 bug 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 | 1 + gcc/genrecog.c | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md index 5c462c4..f7ab836 100644 --- a/gcc/config/s390/predicates.md +++ b/gcc/config/s390/predicates.md @@ -121,10 +121,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..3791f6d 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -320,6 +320,7 @@ add_mode_tests (struct pred_data *p) { case CONST_INT: case CONST_WIDE_INT: + 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 --pf9I7BMVVzbSWLtt--