From patchwork Mon Sep 4 11:26:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 111541 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp4104417ybm; Mon, 4 Sep 2017 04:26:35 -0700 (PDT) X-Received: by 10.99.47.66 with SMTP id v63mr88373pgv.259.1504524395590; Mon, 04 Sep 2017 04:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504524395; cv=none; d=google.com; s=arc-20160816; b=woNzHN1ZC9wTEGH/SZAkfr4C4Wwkbs3eHqDXtWWBFs/metUZLenaFBRpB/MplDQr0r vkJgNUK/BwsuYN0jbVowvzLc2s+3+RDrJNanYdWu2qr/L4uK+L6URiCBtiaJ+wCgS7mI RU9EIi5bSSlewJNiwg6Cb/3AVQzkfGXSnuhCwbJKJI0PlX5Oy+1syjLOCspGCys3QhC4 9G7AhFpDAC6EZGOgKB6w+OcWkZUJoDgz7aHxOV2+oMBOe9CPdDSmcRj/Tf+6lO6Ueah/ JfNFbuNmqw3QMYqWu1xBEz/9VF3pRJ0Hf5GHUR2A2+iQQyUCUwoFFQ7v67ackvFnvpN5 M9Jw== 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=nUz5+85GK+K4aloh2gHtEKKcgEezsiNyuikiqpJclrM=; b=Ixreb+mEqfJdYyG2q5pYpOzT7GouRvaMF9PfuY/YkYVrS+/OqbN1H1UQdtlNxXVttx dr4DoLVukW7ykQTXTv8+2Miin0Yn/FBcpSP8ZziKrA8vooqlcohV3o8W8/f/7pAIBb+/ MDoalEqsVCZxKQy5dq+33D9U9+oCEjgw0oXWNS5qcD2huuwiRQbF/aaJuP5hRjAna9QC BGdpyeyt2kyuxyaSDfD3AmtxctkkdqpXp7+MXgwa1J4EUNJspsX0O1kOmkyO0eXkbGVm 92NhUFtQApVIgpXYH9AhIossBoJ0vygDv+HS3sLEiJxtnhqocN3Ue6GMF06rcLEIFhhd glbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=f2h3uWkJ; spf=pass (google.com: domain of gcc-patches-return-461403-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-461403-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 u132si4803123pgc.404.2017.09.04.04.26.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 04:26:35 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-461403-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.s=default header.b=f2h3uWkJ; spf=pass (google.com: domain of gcc-patches-return-461403-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-461403-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=gZZkEyZrg/30z5Gp7SNDCFiYwGktA 0GGDrYZxLMEdqd0T5vtQin8xyL1NboUdNf3ZLTPHFYwN6//b8Q+OKJbR61MVcFg3 7C+q0y2J/xHWj6ppcv6nHTchJHbOgZruqKTmq4YSi7AWtuOeKY/ZwFrLJNRtuNSS dDRPLMIw1xyNFc= 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=LOISBu5WQTlWjXrCgBDLzsW1tng=; b=f2h 3uWkJHRfkNC6TMpGLO0BWUS6rbX/xRsDz3WJZkMh1TNMP3w7q82O0XklvyZUbnPt Uqvr77x0D0AMUPDDT3LCEcGlpM9FlbfivOiqBg/Q53qBGgW5BkFewWg5GJIG+o7u 4SWcETGgbocRrE3xtXC7gMXGo5+nMIe8qJJknLyo= 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-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 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 12:26:09 +0100 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 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);