From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98464 invoked by alias); 13 Jul 2017 08:50:33 -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 97742 invoked by uid 89); 13 Jul 2017 08:50:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 08:50:30 +0000 Received: by mail-wm0-f45.google.com with SMTP id f67so18251669wmh.1 for ; Thu, 13 Jul 2017 01:50:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=u0wevqStV7/32aAABbR7PZI/8yJ1wbh31pyHl6ajjDY=; b=tLr1vIpy8qZFyRU0TWM0MmfSZMJbGbsqxkYVJjTv2ddVsww1TmYYZF3k47tw+4lert Tq1qY/+tZo2p1VJ/3Yv0jSt+F6pdOni19kjP/u0pggl5rPb2eS79MV74hLhCzUvzP5WO M3cZIoGhT7VfWdAE4U/EPFFs/8yNpQgsAl4GD9cqwc0v2oAsAEqqeqWrdCKaV2ipTvkC LJeYQu10fo4ThRj92Hpt+p3B+GXOmqlCDSPkJJUsOHogoMUrXNiTCRpcwOSeq4thqZ3r KVUdoR56ix0umU/lma3yyofJlVBwEu0quyKXiadwHnDMkp4E5s9P59l9WgV9ee2SGgoH xFEQ== X-Gm-Message-State: AIVw1128Xh0vr/PyDGx+i62HAtWS9Za3DXPaaiKAltXLD666pcJhGPXU XPXMx1xJEmWtjH6gUwZglg== X-Received: by 10.28.48.201 with SMTP id w192mr1123111wmw.28.1499935827819; Thu, 13 Jul 2017 01:50:27 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id 33sm3556883wrr.58.2017.07.13.01.50.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:50:27 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [33/77] Add a NARROWEST_INT_MODE macro References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 08:50:00 -0000 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <877ezciuum.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2017-07/txt/msg00673.txt.bz2 This patch replaces uses of GET_CLASS_NARROWEST_MODE (MODE_INT) with a new NARROWEST_INT_MODE macro, which has type scalar_int_mode. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * 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/ * gcc-interface/decl.c (validate_size): Use NARROWEST_INT_MODE instead of GET_CLASS_NARROWEST_MODE (MODE_INT). Index: gcc/machmode.h =================================================================== --- gcc/machmode.h 2017-07-13 09:18:31.699428322 +0100 +++ gcc/machmode.h 2017-07-13 09:18:38.043865449 +0100 @@ -656,6 +656,12 @@ #define GET_MODE_ALIGNMENT(MODE) get_mod #define GET_CLASS_NARROWEST_MODE(CLASS) \ ((machine_mode) class_narrowest_mode[CLASS]) +/* The narrowest full integer mode available on the target. */ + +#define NARROWEST_INT_MODE \ + (scalar_int_mode \ + (scalar_int_mode::from_int (class_narrowest_mode[MODE_INT]))) + /* Return the narrowest mode in T's class. */ template Index: gcc/expr.c =================================================================== --- gcc/expr.c 2017-07-13 09:18:36.841969327 +0100 +++ gcc/expr.c 2017-07-13 09:18:38.043865449 +0100 @@ -707,7 +707,7 @@ alignment_for_piecewise_move (unsigned i { 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 @@ -3910,7 +3910,7 @@ push_block (rtx size, int extra, int bel 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. */ Index: gcc/stor-layout.c =================================================================== --- gcc/stor-layout.c 2017-07-13 09:18:32.529352614 +0100 +++ gcc/stor-layout.c 2017-07-13 09:18:38.044865363 +0100 @@ -2697,7 +2697,7 @@ fixup_unsigned_type (tree type) 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) Index: gcc/tree-vrp.c =================================================================== --- gcc/tree-vrp.c 2017-07-13 09:18:24.776086502 +0100 +++ gcc/tree-vrp.c 2017-07-13 09:18:38.045865278 +0100 @@ -10115,7 +10115,7 @@ simplify_float_conversion_using_ranges ( 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 Index: gcc/ada/gcc-interface/decl.c =================================================================== --- gcc/ada/gcc-interface/decl.c 2017-07-13 09:18:32.518353613 +0100 +++ gcc/ada/gcc-interface/decl.c 2017-07-13 09:18:38.042865534 +0100 @@ -8574,7 +8574,7 @@ validate_size (Uint uint_size, tree gnu_ 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));