From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4323 invoked by alias); 20 Aug 2015 10:32:48 -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 4311 invoked by uid 89); 20 Aug 2015 10:32:48 -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,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Aug 2015 10:32:47 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-5-ELSbXBUpQPuZ6Lbty73dmw-1; Thu, 20 Aug 2015 11:32:43 +0100 Received: from localhost ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 20 Aug 2015 11:32:42 +0100 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org,ebotcazou@libertysurf.fr, richard.sandiford@arm.com Cc: ebotcazou@libertysurf.fr Subject: [SPARC] Simplify const_all_ones_operand Date: Thu, 20 Aug 2015 10:34:00 -0000 Message-ID: <87d1yi9rn9.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: ELSbXBUpQPuZ6Lbty73dmw-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2015-08/txt/msg01187.txt.bz2 gen_rtx_CONST_VECTOR ensures that there is a single instance of: (const_vector:M [(const_int -1) ... (const_int -1)]) for each M, so pointer equality with CONSTM1_RTX is enough. Also, HOST_BITS_PER_WIDE_INT =3D=3D 32 is doubly dead: HOST_WIDE_INT is always 64 bits now, and we always use const_int rather than const_double or const_wide_int for all-ones values (or any other value that fits in a signed HOST_WIDE_INT). This seemed like a better fix than using the helper functions that I'm about to post. Tested with a cross-compiler and ensured that the predicate was still accepting all (-)1 values. OK to install? Thanks, Richard gcc/ * config/sparc/predicates.md (const_all_ones_operand): Use CONSTM1_RTX to simplify definition. diff --git a/gcc/config/sparc/predicates.md b/gcc/config/sparc/predicates.md index 88537c6..aa45f8e 100644 --- a/gcc/config/sparc/predicates.md +++ b/gcc/config/sparc/predicates.md @@ -27,31 +27,9 @@ ;; Return true if the integer representation of OP is ;; all-ones. (define_predicate "const_all_ones_operand" - (match_code "const_int,const_double,const_vector") -{ - if (GET_CODE (op) =3D=3D CONST_INT && INTVAL (op) =3D=3D -1) - return true; -#if HOST_BITS_PER_WIDE_INT =3D=3D 32 - if (GET_CODE (op) =3D=3D CONST_DOUBLE - && GET_MODE (op) =3D=3D VOIDmode - && CONST_DOUBLE_HIGH (op) =3D=3D ~(HOST_WIDE_INT)0 - && CONST_DOUBLE_LOW (op) =3D=3D ~(HOST_WIDE_INT)0) - return true; -#endif - if (GET_CODE (op) =3D=3D CONST_VECTOR) - { - int i, num_elem =3D CONST_VECTOR_NUNITS (op); - - for (i =3D 0; i < num_elem; i++) - { - rtx n =3D CONST_VECTOR_ELT (op, i); - if (! const_all_ones_operand (n, mode)) - return false; - } - return true; - } - return false; -}) + (and (match_code "const_int,const_double,const_vector") + (match_test "INTEGRAL_MODE_P (GET_MODE (op))") + (match_test "op =3D=3D CONSTM1_RTX (GET_MODE (op))"))) =20 ;; Return true if OP is the integer constant 4096. (define_predicate "const_4096_operand"