From patchwork Wed Aug 23 10:52:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 110732 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp3942433qge; Wed, 23 Aug 2017 03:53:02 -0700 (PDT) X-Received: by 10.84.231.193 with SMTP id g1mr2496953pln.213.1503485582834; Wed, 23 Aug 2017 03:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503485582; cv=none; d=google.com; s=arc-20160816; b=d1hqhMCvreo6+eXUYt2BQkHWBnAMdFPErW98LJtbF6avbNW2pOlGcpVnEekqA8haxV lELFinValv6Yo1HcKtwW3pimJBB8eGydGeU/p8N465e0B5ljh1hUrYBroi68ArUFYGvL +iB/mbsisEXi26AsTY57kUgCKEllAMcuzMlX3aZ2h7+lBUOOggs/Hd4uOz/KTQfgOsCL 06iktT6lG9cIJjgQG+NDoj4Jo5T00UaIigZR832YZGHLTwHO3DxUYLISGuzaDzK4vLVn 4csFuoie8oMxcxzct3kmklbAVsI2wSw0NJ1qIgD7gTYF48PK2RuL9QKTQ25s0AlvpPHq ekQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date: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=ZhdTa6f0zExgcD1mWeCYHo1okh+uQS7rccjr1D15mCk=; b=Vt6Zzuz8lGQ2tJTrSoKAsPqxMhioZIAG1N2pdIL0ggpkyVwIl8q8kY0YaPuLTgeSZL S9H/xA82fvkLO/D4fY1WsB3wx5Z3FEja4Az5xXbwhMxwJhxw9ayiW4P/FmFb9LhexAU4 66Ii3d+Gz++ttBNGjWhyRAPDTp4ZurKJf8+xqexmq1qdsjIvnfZ4I/NxB5QRchBWduQz CE4jkZstYa40ti2D6O4TUWSnj1TFaLDE8QaFp56owVB6Oj74afhsqfvyZLbjDdAQOJGS 6iuk43a5kD5IAgPxSFB7XX6qB9QaPWAGR1TxBfKNdWB85YbwjjzVHW9ROhh4aDEHqJDi 53Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GBNHiRMb; spf=pass (google.com: domain of gcc-patches-return-460785-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460785-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 p8si1014414pli.313.2017.08.23.03.53.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Aug 2017 03:53:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-460785-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=GBNHiRMb; spf=pass (google.com: domain of gcc-patches-return-460785-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460785-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:date:message-id:mime-version:content-type; q=dns; s= default; b=RWb+Oh+Vjc6cwi12LPlhrAScUJ7mGeCBJMGK9jfQbanJNtT7u6bqt Akv5A/XpVAj2vPGyEia2zRPKupjk+BeeidCKObE+kAUSA859uj9hES82l9yMbyPh qKFU07Kd/EVdr7OfDmmJzrj54QHzdvkfx43hnqCnqkHTP4bsM+oF5Q= 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:date:message-id:mime-version:content-type; s= default; bh=AbfO8YNwfwa87q3E6cKz3wrr53A=; b=GBNHiRMb2Tulqjm9ickI 3WtSUBi+9HgPilOLwUa8COZdj2q2uWe/1UKT9pAhMW46o30kTeLkUjLSlba5iBK7 GLatqmYdlkIRTRX+m496Dfzr12RUnOXo8TNcR6gYjHkT+WQoQ/DNb9a1FVb24I05 pzZPkOpI/9GLi68tUq4B0w4= Received: (qmail 5422 invoked by alias); 23 Aug 2017 10:52:45 -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 5392 invoked by uid 89); 23 Aug 2017 10:52:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 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= X-HELO: mail-wr0-f172.google.com Received: from mail-wr0-f172.google.com (HELO mail-wr0-f172.google.com) (209.85.128.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Aug 2017 10:52:42 +0000 Received: by mail-wr0-f172.google.com with SMTP id p14so4375637wrg.1 for ; Wed, 23 Aug 2017 03:52:42 -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:date:message-id :user-agent:mime-version; bh=ZhdTa6f0zExgcD1mWeCYHo1okh+uQS7rccjr1D15mCk=; b=FL81Bf5WiB2poJzH1Nim8Hv2WqeJYQ1zTHJHU3lRyI+5Vg9ns20VFoYTr0czKjlu9w Y2ltBCe8HNqubMf1jVrzd+JIyP3MoXFOr9tuG8Z4BPRgAUj6SgI11BNSfBg9gD9uN2wu zdV10seyJNt6dQzZF70aLdFJE+eCpxypaUpfiMpvTBDhZA16NBzuURc++Ehq9f90ib8w mwWnmNhTGyPVN71sgTd4i8NvEcg0Sh+3KyqItlcnKDw9oLju4CmimfAnhMu53fsOUAiI qu2+GtSjrlfrdRPMvCIqB/VsGs5/dtrTvkDqhAC7nPkF7q6nqwUwLOZDbd1muOKh8dPM 1PIg== X-Gm-Message-State: AHYfb5htpTZl01kzQh86mLilReVrr+Dj3ZZUWaGWCU42vCgjiOUQOjGm V/3qNDlIHthMuGtr5b1VTQ== X-Received: by 10.223.174.209 with SMTP id y75mr1562458wrc.19.1503485560346; Wed, 23 Aug 2017 03:52:40 -0700 (PDT) Received: from localhost (92.40.249.210.threembb.co.uk. [92.40.249.210]) by smtp.gmail.com with ESMTPSA id 65sm1262366wmf.0.2017.08.23.03.52.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Aug 2017 03:52:39 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Make more use of subreg_size_lowpart_offset Date: Wed, 23 Aug 2017 11:52:38 +0100 Message-ID: <87wp5utv2h.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch uses subreg_size_lowpart_offset in places that open-coded the calculation. The reload use (and the LRA one that was based on it) seemed to ignore the BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN case; it's not obvious whether that was deliberate or an oversight. Tested on aarch64-linux-gnu and x86_64-linux-gnu, and by making sure that there were no differences in testsuite assembly output for one target per CPU. OK to install? Richard 2017-08-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * lra-spills.c (assign_mem_slot): Use subreg_size_lowpart_offset. * regcprop.c (maybe_mode_change): Likewise. * reload1.c (alter_reg): Likewise. Index: gcc/lra-spills.c =================================================================== --- gcc/lra-spills.c 2017-05-18 07:51:05.680420976 +0100 +++ gcc/lra-spills.c 2017-08-23 10:46:45.029672093 +0100 @@ -153,9 +153,7 @@ assign_mem_slot (int i) /* On a big endian machine, the "address" of the slot is the address of the low part that fits its inherent mode. */ - if (BYTES_BIG_ENDIAN && inherent_size < total_size) - adjust += (total_size - inherent_size); - + adjust += subreg_size_lowpart_offset (inherent_size, total_size); x = adjust_address_nv (x, GET_MODE (regno_reg_rtx[i]), adjust); /* Set all of the memory attributes as appropriate for a spill. */ Index: gcc/regcprop.c =================================================================== --- gcc/regcprop.c 2017-08-23 10:46:06.553156355 +0100 +++ gcc/regcprop.c 2017-08-23 10:46:45.029672093 +0100 @@ -410,13 +410,9 @@ maybe_mode_change (machine_mode orig_mod int use_nregs = hard_regno_nregs[copy_regno][new_mode]; int copy_offset = GET_MODE_SIZE (copy_mode) / copy_nregs * (copy_nregs - use_nregs); - int offset - = GET_MODE_SIZE (orig_mode) - GET_MODE_SIZE (new_mode) - copy_offset; - int byteoffset = offset % UNITS_PER_WORD; - int wordoffset = offset - byteoffset; - - offset = ((WORDS_BIG_ENDIAN ? wordoffset : 0) - + (BYTES_BIG_ENDIAN ? byteoffset : 0)); + unsigned int offset + = subreg_size_lowpart_offset (GET_MODE_SIZE (new_mode) + copy_offset, + GET_MODE_SIZE (orig_mode)); regno += subreg_regno_offset (regno, orig_mode, offset, new_mode); if (HARD_REGNO_MODE_OK (regno, new_mode)) return gen_raw_REG (new_mode, regno); Index: gcc/reload1.c =================================================================== --- gcc/reload1.c 2017-08-22 17:14:30.339835581 +0100 +++ gcc/reload1.c 2017-08-23 10:46:45.030666964 +0100 @@ -2253,8 +2253,7 @@ alter_reg (int i, int from_reg, bool don /* On a big endian machine, the "address" of the slot is the address of the low part that fits its inherent mode. */ - if (BYTES_BIG_ENDIAN && inherent_size < total_size) - adjust += (total_size - inherent_size); + adjust += subreg_size_lowpart_offset (inherent_size, total_size); /* If we have any adjustment to make, or if the stack slot is the wrong mode, make a new stack slot. */