From patchwork Mon Oct 23 17:10:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116770 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4876945qgn; Mon, 23 Oct 2017 10:11:15 -0700 (PDT) X-Received: by 10.101.75.141 with SMTP id t13mr12242238pgq.122.1508778675803; Mon, 23 Oct 2017 10:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508778675; cv=none; d=google.com; s=arc-20160816; b=U1/rTQHvmJrADy+IQwuLcH9DvFIQhwgkVXsoLeg3Q38MqcaZ+7Uv6JTKzo+ni2RRAk +GJoLZI8gqb4gFx1UgNEV308rVruATqldj5reY3LFbuQwfZlcoDeoiGAr17d/2uE3WpP 2aZC2SFZgPVP108Otr8kAdSOM9pRT334SZMnwj+SyKPJ8CwcQmcXW23zofhrwiKcPHUv yMy0C8+ivxzYEKzQDctjbNPDijojfn1XAhwZdI7+wXgYb7WbyQY3sRlCxzO/Z7nv+XMc usEhEfc+WMw9ftgWu67kp2Tls+jN66HDsPRD1dk0GckRXtGLi6Jtod0sz2Lt/jBsMgbD oufQ== 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=mvUrg+JvavuoIHbgMg9emGoStXJHuIc3C2vOx/W98TA=; b=RrUioOK8XVTCc++w5naVfZgZmEwuMCTXmdDpVDhgqrUjtdTRPSXCu4/dypo1XouspI mconC9Ld/ljGxRlp4LZYtKam1wimWeDKkaj2XYz2yLIQ55jx2BR4qq4T/GwZH2Ej3c4v Lb4uU2/MJWw/eUKHQ6mGxtBOHD5g7f3h3reP3sssqUKPA2zBFuN64uddeZ1X2qY2yxIC gyDS2F/kLJa2jlSPR3dhXZE2p7l7xii/i41FUhi+/RGpcbteO5QMFPlV8iXaXGOhfmhi NsFl7by89uJBFXPz/KO1hRiJq6/yQZI+AgsWNxdP4J+8xZdjIruoC1jQCo2CAhVQGMMi Y2oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=uMHzTkkk; spf=pass (google.com: domain of gcc-patches-return-464802-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464802-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 r80si5595163pfb.495.2017.10.23.10.11.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464802-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=uMHzTkkk; spf=pass (google.com: domain of gcc-patches-return-464802-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464802-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=jEZsxlzne6nxEvKCFyHaBpsiA8AeI /qUjHXZZ9D9/m0UFl8JTl4w2aFqJGhngZmEDVuetH4N7fI0lYMlydeVto6K2dSVV Q9b2USSevobBP1cOBWEn8nXTn59SwKXvWHlfvF/ObN+JomKmQMkL38+obv+KIcx/ KsJ8F0ufGd8p7E= 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=wq6k+Qu168VGjWKnFn1SE8wWUhg=; b=uMH zTkkkRPOFANVW7sKsZib9puvuupdV9kWNCqRf2/niTNyA/233X1q/aG1TjZdPJvX /JCvMMRVYXHklmsCaq1NMjoXobVTK9UrD2gDtqgkw8JxX5cnfbpqT/zgPsXL2H9r ecx/kp+Y31yRXgD1EqCdy9tbSWti4+zHkLdyrRK0= Received: (qmail 9767 invoked by alias); 23 Oct 2017 17:10:42 -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 9747 invoked by uid 89); 23 Oct 2017 17:10:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=026 X-HELO: mail-wm0-f53.google.com Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:10:40 +0000 Received: by mail-wm0-f53.google.com with SMTP id u138so11225521wmu.4 for ; Mon, 23 Oct 2017 10:10:39 -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=mvUrg+JvavuoIHbgMg9emGoStXJHuIc3C2vOx/W98TA=; b=II67b4MEEqOjfbPJDndnkAuBbb7phmX4cDI3zrkPvuBWoHaBP0/Ll2u2gmq8kqJys0 I7ocP51k/eNu2LT8EZ9F2z9GW6bsL2DEteuiTx9TMG1oMoVWM1uRlSRBqkQUrn1MeVfj W3+cQBuEibNxhZxvnxI3MteJabvE1Bahb/ZNJuUXbnblJeggHUSCiq8HKA2TmlLo7/Vm 31eQtfsU1/vpdVzLRwMI/G78G2KGA8Dhonv/f0NGG1GFyhhOHj3dyESkF5xlF57Kczhl cDywXLiFmPSwroOzPYKwmPwOMxl/rwfZVIXVncjAN57vw1ZIEHVkkdpeMTKDtdfedXDa PyCg== X-Gm-Message-State: AMCzsaXIMdHLLPXTVUiwgWDZig3AmXpg4NYHEmRWSRZRMbyYOQqRv/QE 91DTITARiyAgWcFXb+NOOH2C9fd435g= X-Google-Smtp-Source: ABhQp+Qgxtwp7AIC/Cu+/1jBX8Nr7wLt11Dw2pdCqYAP7tohOvN9aD/RvbFddCY/XpQiwS3HkPkjog== X-Received: by 10.28.193.136 with SMTP id r130mr3394445wmf.141.1508778637409; Mon, 23 Oct 2017 10:10:37 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id s67sm5344361wmd.23.2017.10.23.10.10.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:10:36 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [026/nnn] poly_int: operand_subword References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:10:36 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87r2ttpz77.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes operand_subword and operand_subword_force take polynomial offsets. This is a fairly old-school interface and these days should only be used when splitting multiword operations into word operations. It still doesn't hurt to support polynomial offsets and it helps make callers easier to write. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * rtl.h (operand_subword, operand_subword_force): Take the offset as a poly_uint64 an unsigned int. * emit-rtl.c (operand_subword, operand_subword_force): Likewise. Index: gcc/rtl.h =================================================================== --- gcc/rtl.h 2017-10-23 17:16:50.374527737 +0100 +++ gcc/rtl.h 2017-10-23 17:16:55.754801166 +0100 @@ -3017,10 +3017,10 @@ extern rtx gen_lowpart_if_possible (mach /* In emit-rtl.c */ extern rtx gen_highpart (machine_mode, rtx); extern rtx gen_highpart_mode (machine_mode, machine_mode, rtx); -extern rtx operand_subword (rtx, unsigned int, int, machine_mode); +extern rtx operand_subword (rtx, poly_uint64, int, machine_mode); /* In emit-rtl.c */ -extern rtx operand_subword_force (rtx, unsigned int, machine_mode); +extern rtx operand_subword_force (rtx, poly_uint64, machine_mode); extern int subreg_lowpart_p (const_rtx); extern poly_uint64 subreg_size_lowpart_offset (poly_uint64, poly_uint64); Index: gcc/emit-rtl.c =================================================================== --- gcc/emit-rtl.c 2017-10-23 17:16:50.363529222 +0100 +++ gcc/emit-rtl.c 2017-10-23 17:16:55.754801166 +0100 @@ -1736,7 +1736,8 @@ subreg_lowpart_p (const_rtx x) */ rtx -operand_subword (rtx op, unsigned int offset, int validate_address, machine_mode mode) +operand_subword (rtx op, poly_uint64 offset, int validate_address, + machine_mode mode) { if (mode == VOIDmode) mode = GET_MODE (op); @@ -1745,12 +1746,12 @@ operand_subword (rtx op, unsigned int of /* If OP is narrower than a word, fail. */ if (mode != BLKmode - && (GET_MODE_SIZE (mode) < UNITS_PER_WORD)) + && may_lt (GET_MODE_SIZE (mode), UNITS_PER_WORD)) return 0; /* If we want a word outside OP, return zero. */ if (mode != BLKmode - && (offset + 1) * UNITS_PER_WORD > GET_MODE_SIZE (mode)) + && may_gt ((offset + 1) * UNITS_PER_WORD, GET_MODE_SIZE (mode))) return const0_rtx; /* Form a new MEM at the requested address. */ @@ -1784,7 +1785,7 @@ operand_subword (rtx op, unsigned int of MODE is the mode of OP, in case it is CONST_INT. */ rtx -operand_subword_force (rtx op, unsigned int offset, machine_mode mode) +operand_subword_force (rtx op, poly_uint64 offset, machine_mode mode) { rtx result = operand_subword (op, offset, 1, mode);