From patchwork Fri Dec 9 13:14:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 704504 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 3tZt4f6LgQz9t1H for ; Sat, 10 Dec 2016 00:14:58 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="IEtJw5MU"; 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:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=Zg4zCffTwD7I7W7eCqQvJkqtnAkYG S+IK8uascroBB/lPf+JPYmO/2WfqLECk5L6W6V45Ijae7qrxpQo8Xpw9viAOWZW3 yKjY59RvJdlWE+a4B0PCj3aV8jvkk6DSZSYsp5bGaSAjQtdOUsiysMsxK3eVTzk+ 9bDP48WEDGR4P0= 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:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=xeF5qnuSvpeSdNGvdzR/XKhhnZQ=; b=IEt Jw5MUPoNkDhp96FeTnMW85KxAVpHnZWPHYIDksNL07wJ36EuRFUjwxLO5QSFWzJ1 deMl2ZQOd5iy58NUXvRch1Ae/06fwUUg9RgQlXR6eAiKr2RTkOXa4Oy6PuAZ7qdv bP4iVLLoReMNt4cMwCDIcTKO4HjKPaNb5OalItD0= Received: (qmail 107575 invoked by alias); 9 Dec 2016 13:14:51 -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 107566 invoked by uid 89); 9 Dec 2016 13:14:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 13:14:47 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C6DA1707; Fri, 9 Dec 2016 05:14:45 -0800 (PST) Received: from localhost (e105548-lin.manchester.arm.com [10.45.32.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B361E3F477 for ; Fri, 9 Dec 2016 05:14:44 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [33/67] Add a NARROWEST_INT_MODE macro References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 13:14:42 +0000 In-Reply-To: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 09 Dec 2016 12:48:01 +0000") Message-ID: <87inqtjlbx.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Replace uses of GET_CLASS_NARROWEST_MODE (MODE_INT) with a new NARROWEST_INT_MODE macro, which has type scalar_int_mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * machmode.h (NARROWEST_INT_MODE): New macro. * expr.c (alignment_for_piecewise_move): Use it instead of GET_CLASS_NARROWEST_MODE (MODE_INT). (push_block): Likewise. * stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator): Likewise. * tree-vrp.c (simplify_float_conversion_using_ranges): Likewise. gcc/ada/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * gcc-interface/decl.c (validate_size): Use NARROWEST_INT_MODE instead of GET_CLASS_NARROWEST_MODE (MODE_INT). diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index e300892..eb21cd6 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -8526,7 +8526,7 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object, by the smallest integral mode that's valid for pointers. */ if (TREE_CODE (gnu_type) == POINTER_TYPE || TYPE_IS_FAT_POINTER_P (gnu_type)) { - machine_mode p_mode = GET_CLASS_NARROWEST_MODE (MODE_INT); + scalar_int_mode p_mode = NARROWEST_INT_MODE; while (!targetm.valid_pointer_mode (p_mode)) p_mode = *GET_MODE_WIDER_MODE (p_mode); type_size = bitsize_int (GET_MODE_BITSIZE (p_mode)); diff --git a/gcc/expr.c b/gcc/expr.c index 0d88e41..ea66027 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -705,7 +705,7 @@ alignment_for_piecewise_move (unsigned int max_pieces, unsigned int align) { machine_mode tmode, xmode; - xmode = GET_CLASS_NARROWEST_MODE (MODE_INT); + xmode = NARROWEST_INT_MODE; FOR_EACH_MODE_IN_CLASS (tmode, MODE_INT) { if (GET_MODE_SIZE (tmode) > max_pieces @@ -3903,7 +3903,7 @@ push_block (rtx size, int extra, int below) negate_rtx (Pmode, size)); } - return memory_address (GET_CLASS_NARROWEST_MODE (MODE_INT), temp); + return memory_address (NARROWEST_INT_MODE, temp); } /* A utility routine that returns the base of an auto-inc memory, or NULL. */ diff --git a/gcc/machmode.h b/gcc/machmode.h index fdbf174..75184b5 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -656,6 +656,11 @@ extern const unsigned char class_narrowest_mode[MAX_MODE_CLASS]; #define GET_CLASS_NARROWEST_MODE(CLASS) \ (machine_mode ((machine_mode_enum) class_narrowest_mode[CLASS])) +/* The narrowest full integer mode available on the target. */ + +#define NARROWEST_INT_MODE \ + (scalar_int_mode::from_int (class_narrowest_mode[MODE_INT])) + /* Return the narrowest mode in T's class. */ template diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 5cf4433..a1b6c94 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -2687,7 +2687,7 @@ bit_field_mode_iterator HOST_WIDE_INT bitregion_start, HOST_WIDE_INT bitregion_end, unsigned int align, bool volatilep) -: m_mode (GET_CLASS_NARROWEST_MODE (MODE_INT)), m_bitsize (bitsize), +: m_mode (NARROWEST_INT_MODE), m_bitsize (bitsize), m_bitpos (bitpos), m_bitregion_start (bitregion_start), m_bitregion_end (bitregion_end), m_align (align), m_volatilep (volatilep), m_count (0) diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 88ddbf8..9a5f69d 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -9995,7 +9995,7 @@ simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi, integer mode available. */ else { - mode = GET_CLASS_NARROWEST_MODE (MODE_INT); + mode = NARROWEST_INT_MODE; for (;;) { /* If we cannot do a signed conversion to float from mode