From patchwork Wed Aug 23 10:50:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 110730 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp3940128qge; Wed, 23 Aug 2017 03:50:36 -0700 (PDT) X-Received: by 10.98.99.131 with SMTP id x125mr2253290pfb.285.1503485435994; Wed, 23 Aug 2017 03:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503485435; cv=none; d=google.com; s=arc-20160816; b=dism3+44EKF8yjdMiNE8LCmUiQLs1qNh9r9NVTiQ4D/vBK9B+v00zhwGV+CGYwAHJK Omgm7TPp76kcH9Fpoo9I5JDw7ofC8EVU6OQI71fSVy4i/FwfRnSg73R8GnggYpqdpMVo 3LfI/nxiQDQHqiG0AEalyZMNM+1GpM8GPBD1yv1oImt7prJ9mPcpV8zgcavTk9QL1CNi uRhaaK9X+I7Q/QRx8C+tKq+CNW2ASMYgXgyAb6Qid59kn9cHREKzvv/1CghAI+pHKtMw EP0Ucr+8yCDpUcpwvYazkjVGkrYH9n0dHDHiL4Lt3a6xRLkib0q6rbEIAKiZXgportIo 0TQg== 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=zUtMSEsTK3Qlv7YHqOCowNyh0Ix/muHTGFXxL+a9HYk=; b=Xf6K5pNx1/UEybIooDhWw9aBh3L8+gxS6yvUjBFxza6jj8YjuMxHlpOSZ1KRf68Aoe 4OLsFBmCmd8Zzr1ddWxUwJ34wNAc0Gp+K2NNXPmDtJeJywpib30EQjPLqD05vexOCBQC d4n1XeVs0jT83ZnocsckCgmfGGhpKJpO/1q3ebOM1aK8X+y9l1UiMtRA7n5ugyfulg3E EP0wdgl9aOWnSo4mziSWQ/zrcjVXar7px5ohG7NBxDCNcNYjqrlQiGhMenqnjTv9hTTt oS55COCuqI9QJ0xpDs67OXP+cP4/dYCRct7hox6Slb1OurkAK5QCdUY1XAs5TsZslDEr 4/cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YeTx21J5; spf=pass (google.com: domain of gcc-patches-return-460783-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460783-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 d13si830786pgn.926.2017.08.23.03.50.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Aug 2017 03:50:35 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-460783-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=YeTx21J5; spf=pass (google.com: domain of gcc-patches-return-460783-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-460783-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=SOR7qlZHlG7kriPyIUfZ+uO57bmrODpR7twBaR9MCPnzRSR2IAMT4 259434Pg1KQy9yiiRAwp2b3pfcfdqdyeL/vbr1Mr8o59a0vD3bTh6e2zFRYIeHXy 4szxM1JCRtl+ujfBXQ9iPoH6aUk9XV8NrRQVHbUvdXz/Wplo4IyVrY= 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=9BAidjL3U5zlLxs2xJrJP2n15UU=; b=YeTx21J5Ual3xILXqu0z Y+auVtBHZuz5fSb7Vh8n5AacmbC3ESqMXnM/6vdg4EbSVI00FBJKP9HAPRCVk/o7 7XfhZlIl1+3U2aUb7w08KzPsIUmEbNVFYFDfMIJs3Yk62wYILHO9DhdXW0g8mUz6 T1nfo9NKC1PZADmIOYg/Q0c= Received: (qmail 126758 invoked by alias); 23 Aug 2017 10:50:22 -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 126737 invoked by uid 89); 23 Aug 2017 10:50:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f176.google.com Received: from mail-wr0-f176.google.com (HELO mail-wr0-f176.google.com) (209.85.128.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Aug 2017 10:50:17 +0000 Received: by mail-wr0-f176.google.com with SMTP id a47so4330937wra.0 for ; Wed, 23 Aug 2017 03:50: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:date:message-id :user-agent:mime-version; bh=zUtMSEsTK3Qlv7YHqOCowNyh0Ix/muHTGFXxL+a9HYk=; b=cmQ5iFBjPbzM4mtFn8vDrlu0Pdcd49zmM9fIyj6gtYMtiuY221Q3c12gfJjfIEv5tg VXkxrGeGBE1DYPq1LSTJbm/z0BvpiV+KJCKzfdrfxtbWnxDBq7pSP5AyCw2k90iVmcVK SDNRBvbe3gqnyB3qesPRGmPWibU49zo3OL4b/YY2Whg1jJ2j8d3OShCUhuY8qEubOWco r1yFFt7SS8LRtPs9wJ5yJsQs56mCt12pMACyhnn/jQCPSOEuvOQ/JMWYXdFOCl0UXP/D 2yAFbE9Wqi+aE/DvePnge8Lk6nquXJUMqiAZM10xkEwA3EUBYypQZMGi5qbnmk8DKXaq OOyg== X-Gm-Message-State: AHYfb5jkQv1csX7NJf7SqYIeflRg43Ym5t2PEzU1Sx8hzL4z5VrWB9sb id40/s49J1WGkr7oex7gbA== X-Received: by 10.223.185.53 with SMTP id k50mr1611979wrf.44.1503485415333; Wed, 23 Aug 2017 03:50:15 -0700 (PDT) Received: from localhost (92.40.249.210.threembb.co.uk. [92.40.249.210]) by smtp.gmail.com with ESMTPSA id n67sm1806977wmi.43.2017.08.23.03.50.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Aug 2017 03:50:14 -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_offset_from_lsb Date: Wed, 23 Aug 2017 11:50:13 +0100 Message-ID: <8760dev9qy.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes use of the subreg_offset_from_lsb function added by an earlier patch in the SVE series. 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/ * combine.c (make_extraction): Use subreg_offset_from_lsb. Index: gcc/combine.c =================================================================== --- gcc/combine.c 2017-08-23 10:44:56.293484623 +0100 +++ gcc/combine.c 2017-08-23 10:45:34.493718192 +0100 @@ -7482,26 +7482,15 @@ make_extraction (machine_mode mode, rtx return a new hard register. */ if (pos || in_dest) { - HOST_WIDE_INT final_word = pos / BITS_PER_WORD; - - if (WORDS_BIG_ENDIAN - && GET_MODE_SIZE (inner_mode) > UNITS_PER_WORD) - final_word = ((GET_MODE_SIZE (inner_mode) - - GET_MODE_SIZE (tmode)) - / UNITS_PER_WORD) - final_word; - - final_word *= UNITS_PER_WORD; - if (BYTES_BIG_ENDIAN && - GET_MODE_SIZE (inner_mode) > GET_MODE_SIZE (tmode)) - final_word += (GET_MODE_SIZE (inner_mode) - - GET_MODE_SIZE (tmode)) % UNITS_PER_WORD; + unsigned int offset + = subreg_offset_from_lsb (tmode, inner_mode, pos); /* Avoid creating invalid subregs, for example when simplifying (x>>32)&255. */ - if (!validate_subreg (tmode, inner_mode, inner, final_word)) + if (!validate_subreg (tmode, inner_mode, inner, offset)) return NULL_RTX; - new_rtx = gen_rtx_SUBREG (tmode, inner, final_word); + new_rtx = gen_rtx_SUBREG (tmode, inner, offset); } else new_rtx = gen_lowpart (tmode, inner);