From patchwork Thu Jul 13 09:03:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107655 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1945139qge; Thu, 13 Jul 2017 02:05:04 -0700 (PDT) X-Received: by 10.99.140.7 with SMTP id m7mr8239413pgd.49.1499936704808; Thu, 13 Jul 2017 02:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499936704; cv=none; d=google.com; s=arc-20160816; b=NBBVXUKNX2PEM80KLOPoiZvIVhxgoFtssyA2Hyck1ug7z6V6c+JaSXljb1oL9Koujx EmYrIyVuhE3aJr3KATLr7ooO56/UyqBlQYig9fJsgNuudZeQvI4YdxV3S+9fdFB0dZFo DdfWalPyeGyZhWyBQ2HfkNdNYa/HOOuiUpy1JRUAGqkPYUYQ7ocGB8GW2+ZCYzX8P+v8 CIQoRWmiTQqFSgoQ+iECfzzr59eJjjiALASA1dqDhErWy0QEaSIXU4pe/MlZQtYkHEaM E4FxhcTaY8jKthpA39GRo6mNaNFp14JXtq4jedIshdRxGxxQDpg1JcHjsvBj5dmi/fk1 UpZw== 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=KI3dOeHhSJb+vICGAz2f7zOoWprj+3sA/0a9riaQMmU=; b=pGzgOFnS3teNrSBIDepZELRn8pbujBcSJrggBJQwLgsb6jv7Sulo0QdMTXyDj8a7QU OQdElWeikKgeOlys5cSEHktoJU13pIHpW3wjMA8v/fRg8g3K60slsH8+mPpPwsVtfCjP rfgoWkOxbQ/p02HEZg+F8Uu6NhuEsxUl1gppwStk65rUQxM7ip2R12/9bI80psqDKaYH N18MTqYkiJrNZkGECnwiTW4ENyRc5Qr1MyCYR9J6EGmscb1EwJCJtlXRWB37Xvd2P84+ YBJCqoKl4ZUEo4zZbsAM5x1ItBzcRB4Wb/LxyvrDQV32NqvBA7T8qhXYj3emrzlL2Lgt sK+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=yXe1tFe3; spf=pass (google.com: domain of gcc-patches-return-458060-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458060-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 p5si3842421pgs.60.2017.07.13.02.05.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 02:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458060-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=yXe1tFe3; spf=pass (google.com: domain of gcc-patches-return-458060-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458060-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=jjOIUYFWnZWVVWXFVTg+QG6xAcvSr Vl/faZNcNV/dmxzCi5kxBeaTdlfgGQ2u3EWtZkEXphZXahht7e1roHuj2geJtiHl bVAlf4Dfvp7v6j5o24QYlv5rztXEs7O34SWcktqF6sDgQB2vqpZ7ckzLcD/snRn7 WWn4yj2kzKXpzg= 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=gkIeUmmX9/O8iUkF91+tRwWcZr4=; b=yXe 1tFe3wlnBaJLugbG+rFk1nypK12/rfRndWfYx0xkkUrw2A9NMFInirgZiw+6qzvj DGLY4f2Rw8GkA+2FJzmX3fzhcYmLd5SRzIOn3Pn/WsYrNqw+tP27WYZzEBi+6ogo RMYEn65oW9gqmrfAdDqOD+XaTpq9HJJPOJdKjj3E= Received: (qmail 30466 invoked by alias); 13 Jul 2017 09:03:15 -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 28810 invoked by uid 89); 13 Jul 2017 09:03:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2556 X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 09:03:08 +0000 Received: by mail-wm0-f47.google.com with SMTP id i127so18584020wma.0 for ; Thu, 13 Jul 2017 02:03:08 -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=KI3dOeHhSJb+vICGAz2f7zOoWprj+3sA/0a9riaQMmU=; b=mvMSdn2h5rBu79tYlLl/KeDrwytLAhXsgGysgTF+ala5lG4NsWSPl77VkPlcHmrIMB r3zXb3GdV3Kzhxe9HtAqcH5S3pL4S04Vc7LXzzN5k6KzI7MwUKtYOOebsvtejziHe+rn jGIXM7zZ51GSr/N97BDc9qOUrXomhfUjC9hBvJn+T+6YPdbSRTYoYEcBIrJdICchfGpo KmPfwNDxk6tErxAaSBCil6EoaX5rYBjoPx7uzMl0+lTcQcfkQJyv0DYKo/EkJTpyyw5j YqoepkaMQkHzkdZx2jj+X3MCJrbbljQ+n1ltuT8RmTvB015pmvFjF+sqmEnJJDpg4uAM /Ckw== X-Gm-Message-State: AIVw113Qc3Gw+Ayzz+PfatY7xKkUR36gqWcJA5+maYYPJ6UGpYWSsOF3 Av4k6auONlYmbZ3dgLOb5w== X-Received: by 10.28.40.215 with SMTP id o206mr1185222wmo.74.1499936586543; Thu, 13 Jul 2017 02:03:06 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id x131sm3767368wmg.13.2017.07.13.02.03.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 02:03:05 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [69/77] Split scalar-only part out of convert_mode References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 10:03:04 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87vamwbtfb.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch splits the final scalar-only part of convert_mode out into its own subroutine and treats the modes as scalar_modes there. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * expr.c (convert_mode): Split scalar handling out into... (convert_mode_scalar): ...this new function. Treat the modes as scalar_modes. Index: gcc/expr.c =================================================================== --- gcc/expr.c 2017-07-13 09:18:53.997596816 +0100 +++ gcc/expr.c 2017-07-13 09:18:56.007450082 +0100 @@ -102,6 +102,7 @@ static rtx const_vector_from_tree (tree) static rtx const_scalar_mask_from_tree (scalar_int_mode, tree); static tree tree_expr_size (const_tree); static HOST_WIDE_INT int_expr_size (tree); +static void convert_mode_scalar (rtx, rtx, int); /* This is run to set up which modes can be used @@ -216,17 +217,7 @@ convert_move (rtx to, rtx from, int unsi { machine_mode to_mode = GET_MODE (to); machine_mode from_mode = GET_MODE (from); - int to_real = SCALAR_FLOAT_MODE_P (to_mode); - int from_real = SCALAR_FLOAT_MODE_P (from_mode); - enum insn_code code; - rtx libcall; - - /* rtx code for making an equivalent value. */ - enum rtx_code equiv_code = (unsignedp < 0 ? UNKNOWN - : (unsignedp ? ZERO_EXTEND : SIGN_EXTEND)); - - gcc_assert (to_real == from_real); gcc_assert (to_mode != BLKmode); gcc_assert (from_mode != BLKmode); @@ -277,6 +268,28 @@ convert_move (rtx to, rtx from, int unsi return; } + convert_mode_scalar (to, from, unsignedp); +} + +/* Like convert_move, but deals only with scalar modes. */ + +static void +convert_mode_scalar (rtx to, rtx from, int unsignedp) +{ + /* Both modes should be scalar types. */ + scalar_mode from_mode = as_a (GET_MODE (from)); + scalar_mode to_mode = as_a (GET_MODE (to)); + bool to_real = SCALAR_FLOAT_MODE_P (to_mode); + bool from_real = SCALAR_FLOAT_MODE_P (from_mode); + enum insn_code code; + rtx libcall; + + gcc_assert (to_real == from_real); + + /* rtx code for making an equivalent value. */ + enum rtx_code equiv_code = (unsignedp < 0 ? UNKNOWN + : (unsignedp ? ZERO_EXTEND : SIGN_EXTEND)); + if (to_real) { rtx value; @@ -413,7 +426,7 @@ convert_move (rtx to, rtx from, int unsi rtx fill_value; rtx lowfrom; int i; - machine_mode lowpart_mode; + scalar_mode lowpart_mode; int nwords = CEIL (GET_MODE_SIZE (to_mode), UNITS_PER_WORD); /* Try converting directly if the insn is supported. */