From patchwork Thu Jul 13 08:50:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107619 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1933513qge; Thu, 13 Jul 2017 01:51:33 -0700 (PDT) X-Received: by 10.84.137.1 with SMTP id 1mr8664593plm.75.1499935893517; Thu, 13 Jul 2017 01:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499935893; cv=none; d=google.com; s=arc-20160816; b=Y0IPVxBkQaRrADMUBzE7cfB9uQ/FsDx97ArJJM0U79vPnnEojB/Df40m26MVHiVOCz A4B+YujuB6y1Uw5hGct41tlGvU+w7lv365Hx2lBgvDh0p4e4WSY74e3dKu65X4po3sc6 6lbTjakWgmcE1+hwXrxkTDH41kOaIeG3Jw68bHdC9I8boBkIvpkNUfo92X4vT74VNvfR HqwHt3fcJtyJeUDDkZuGx8pSDorMuWFWvssyVYP7+RDZT5MqLO+mZ+G8GaxEZXm0NX0k NdebFDMZdwCOhdkSKYbjsDKT5Gbf2GR1Yw2ImIYrlx5nCvDM4YLQCcUj3yXR/WMKHhj5 W+0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=u0wevqStV7/32aAABbR7PZI/8yJ1wbh31pyHl6ajjDY=; b=YdrRrJ9J3YWETWA9fsjS9OU4nPZIbTIe//AmPcmSc2jDV9oGeyfIhqFzc61JZxliDc XyD8YaUCSQ5nGSNxl0yd4TXARl+XGnASqRI5P+r5frnyjzSeW1/swxRhIKEkFOZD4sOh w89EB8k5y+YUIyOieakS4XhxA0Gh9HtYoKXGaVrLY+guUoY4dzhJ3clIyyiyhkzZ3/In PCds+7PE7L9qYfrtNByiUHA5nDbwdyEKVIAfElhYEH0ziGG3CBZnO5M8UYNlJOH5ffQ0 CE5bvrGqHHW4UedpDEVzL06OXQ1C5l6P3L7oBNQuJVNQ043VP09Sl77TjI0GvfgLkQGn fsCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=ZpGBWdqb; spf=pass (google.com: domain of gcc-patches-return-458024-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458024-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h64si3843123pfg.456.2017.07.13.01.51.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 01:51:33 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458024-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=ZpGBWdqb; spf=pass (google.com: domain of gcc-patches-return-458024-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458024-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=JpOkCzlYOYjszjRIK4wQ07J4hpVcY TADm6naJqgiY4/s8BpXToghwr8a0R4yiz+ZaIu+tWTXLn1s4eCTLGdi+Vf5d6Hx+ pvSsgl8A9SWqaLvMi+3fDhqltV6zq6Y4t4jEuJOLWs7Opvkf61uJW6ysP5wXZtgb 9pI2Z1+ilk3PuI= 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=fvRGaOkKp1VZTjHgcIfxOkOUB5w=; b=ZpG BWdqbuC7ge1qc6iNT9BdBUrcqrbqy7WvKsrN0RuHGBNISk83/3a2yWYqCWrR9tH7 wvItnrxl9dmcuPMpiqDbMDMPaAzpl+RYHwk6sb8ZHbH2Nrss/j2EU0bd3jahOQC+ sZAkMPTjFw5r4+t0fz3Ylyx2lwqoUUGMoYc2/4so= 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-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 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 09:50:25 +0100 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 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));