From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25982 invoked by alias); 29 May 2015 17:52:38 -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 25874 invoked by uid 89); 29 May 2015 17:52:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 29 May 2015 17:52:37 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 8474F1BE372; Fri, 29 May 2015 17:52:35 +0000 (UTC) Received: from anchor.twiddle.net (vpn-229-182.phx2.redhat.com [10.3.229.182]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4THqY3k031847; Fri, 29 May 2015 13:52:34 -0400 Message-ID: <5568A761.20705@redhat.com> Date: Fri, 29 May 2015 19:27:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" , Andreas Krebbel , richard.sandiford@arm.com Subject: Re: RFA: Fix mode checks for possibly-constant predicates References: <87egn5yis1.fsf@e105548-lin.cambridge.arm.com> <5556DF07.6020000@linux.vnet.ibm.com> <87bnhix61c.fsf@e105548-lin.cambridge.arm.com> <555F4FCC.5020501@linux.vnet.ibm.com> <87siao38dq.fsf@e105548-lin.cambridge.arm.com> <87pp5jl2m1.fsf_-_@e105548-lin.cambridge.arm.com> In-Reply-To: <87pp5jl2m1.fsf_-_@e105548-lin.cambridge.arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg02815.txt.bz2 On 05/29/2015 10:23 AM, Richard Sandiford wrote: > + /* Check whether the predicate accepts const scalar ints (which always > + have a stored mode of VOIDmode, but logically have a real mode) > + and whether it matches anything besides const scalar ints. */ > + bool matches_const_scalar_int_p = false; > + bool matches_other_p = false; > + for (int i = 0; i < NUM_RTX_CODE; ++i) > + if (p->codes[i]) > + switch (i) > + { > + CASE_CONST_SCALAR_INT: > + matches_const_scalar_int_p = true; > + break; > + > + default: > + matches_other_p = true; > + break; > + } > + > + /* There's no need for a mode check if the predicate only accepts > + constant integers. The code checks in the predicate are enough > + to establish that the mode is VOIDmode. > + > + Note that the predicate itself should check whether a scalar > + integer is in range of the given mode. */ > + if (!matches_other_p && !p->codes[CONST_DOUBLE]) > + return; I think perhaps it would be cleaner to not use CASE_CONST_SCALAR_INT, and then do switch (i) { case CONST_INT: case CONST_WIDE_INT: matches_const_scalar_int_p = true; break; case CONST_DOUBLE: if (!TARGET_SUPPORTS_WIDE_INT) matches_const_scalar_int_p = true; matches_other_p = true; break; default: matches_other_p = true; break; } if (!matches_other_p) return; Otherwise ok. r~