From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26040 invoked by alias); 4 Sep 2017 11:26:23 -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 26023 invoked by uid 89); 4 Sep 2017 11:26:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=45037 X-HELO: mail-wr0-f178.google.com Received: from mail-wr0-f178.google.com (HELO mail-wr0-f178.google.com) (209.85.128.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Sep 2017 11:26:18 +0000 Received: by mail-wr0-f178.google.com with SMTP id j3so699836wrb.3 for ; Mon, 04 Sep 2017 04:26:17 -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=nUz5+85GK+K4aloh2gHtEKKcgEezsiNyuikiqpJclrM=; b=e3AlLxAc29NUk7oPIKyBzVOdQTYPzqQb7PraoxVQOy8bwJsgm3ZoJVEdDeGQ1eJ69S n69OI2JFKe/tJrZqh4JLV2fhNio+VUxHw33O8s5MZqTdsztCzXK/HqQMxGXEqS9DLLCc lKzwP5rXFX7dE02ipL/+SsuTuBNGOC7ZiPqxvgLDVnRLme3I2xvUZifvsV39+orM2s/v 2bywhYTkUAKGZJwvYq81UDzjXBQnkre7FXj6UhAkG4yw2AZAgKRGA2ela1xJ9NcLdgKS t7lSAO7S5ehBTdusI3/PmknfhImFIBEXa1mfvZ6l7vZWAe+ID/q9ENtNmXyZJIqwczrA mYoA== X-Gm-Message-State: AHPjjUhzjVrYjp9SZXj+Dcs8MWVHAh4fsLrDU1LGGW2naMnZzSZvE4X7 0t0lkkvrvy3VesMeU+fsLQ== X-Google-Smtp-Source: ADKCNb7HR2Ui4Z0HGGltsOIEYcWpTs3ccOhXwzm8uAOVnV0bEZ8fnCmS0ffvVk7bUOAJbnJUwbtlzw== X-Received: by 10.223.151.198 with SMTP id t6mr91808wrb.89.1504524375879; Mon, 04 Sep 2017 04:26:15 -0700 (PDT) Received: from localhost (94.197.120.41.threembb.co.uk. [94.197.120.41]) by smtp.gmail.com with ESMTPSA id l4sm8972017wrb.70.2017.09.04.04.26.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Sep 2017 04:26:15 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [1/9] Make more use of int_mode_for_mode References: <87tw0iiu51.fsf@linaro.org> Date: Mon, 04 Sep 2017 11:26:00 -0000 In-Reply-To: <87tw0iiu51.fsf@linaro.org> (Richard Sandiford's message of "Mon, 04 Sep 2017 12:24:26 +0100") Message-ID: <87pob6iu26.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-09/txt/msg00165.txt.bz2 This patch converts more places that could use int_mode_for_mode instead of mode_for_size. This is in preparation for an upcoming patch that makes mode_for_size itself return an opt_mode. The reason for using required () in exp2_immediate_p is that we go on to do: trunc_int_for_mode (..., int_mode) which would be invalid for (and have failed for) BLKmode. The reason for using required () in spu_convert_move and resolve_simple_move is that we go on to use registers of the returned mode in non-call rtl instructions, which would be invalid for BLKmode. 2017-09-04 Richard Sandiford gcc/ * config/spu/spu.c (exp2_immediate_p): Use int_mode_for_mode. (spu_convert_move): Likewise. * lower-subreg.c (resolve_simple_move): Likewise. Index: gcc/config/spu/spu.c =================================================================== --- gcc/config/spu/spu.c 2017-09-04 11:50:24.563372530 +0100 +++ gcc/config/spu/spu.c 2017-09-04 12:18:41.572976650 +0100 @@ -3372,7 +3372,7 @@ arith_immediate_p (rtx op, machine_mode constant_to_array (mode, op, arr); bytes = GET_MODE_UNIT_SIZE (mode); - mode = mode_for_size (GET_MODE_UNIT_BITSIZE (mode), MODE_INT, 0); + mode = int_mode_for_mode (GET_MODE_INNER (mode)).require (); /* Check that bytes are repeated. */ for (i = bytes; i < 16; i += bytes) @@ -3415,7 +3415,7 @@ exp2_immediate_p (rtx op, machine_mode m mode = GET_MODE_INNER (mode); bytes = GET_MODE_SIZE (mode); - int_mode = mode_for_size (GET_MODE_BITSIZE (mode), MODE_INT, 0); + int_mode = int_mode_for_mode (mode).require (); /* Check that bytes are repeated. */ for (i = bytes; i < 16; i += bytes) @@ -4503,7 +4503,7 @@ spu_expand_mov (rtx * ops, machine_mode spu_convert_move (rtx dst, rtx src) { machine_mode mode = GET_MODE (dst); - machine_mode int_mode = mode_for_size (GET_MODE_BITSIZE (mode), MODE_INT, 0); + machine_mode int_mode = int_mode_for_mode (mode).require (); rtx reg; gcc_assert (GET_MODE (src) == TImode); reg = int_mode != mode ? gen_reg_rtx (int_mode) : dst; Index: gcc/lower-subreg.c =================================================================== --- gcc/lower-subreg.c 2017-09-04 11:50:08.544543511 +0100 +++ gcc/lower-subreg.c 2017-09-04 12:18:41.572976650 +0100 @@ -956,11 +956,7 @@ resolve_simple_move (rtx set, rtx_insn * if (real_dest == NULL_RTX) real_dest = dest; if (!SCALAR_INT_MODE_P (dest_mode)) - { - dest_mode = mode_for_size (GET_MODE_SIZE (dest_mode) * BITS_PER_UNIT, - MODE_INT, 0); - gcc_assert (dest_mode != BLKmode); - } + dest_mode = int_mode_for_mode (dest_mode).require (); dest = gen_reg_rtx (dest_mode); if (REG_P (real_dest)) REG_ATTRS (dest) = REG_ATTRS (real_dest);