From patchwork Mon Oct 23 17:02:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116752 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4867577qgn; Mon, 23 Oct 2017 10:02:50 -0700 (PDT) X-Received: by 10.98.64.207 with SMTP id f76mr13594405pfd.279.1508778169977; Mon, 23 Oct 2017 10:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508778169; cv=none; d=google.com; s=arc-20160816; b=dqRw/SsXJU6APQeLVBy2XapiD9SCcFoHK5gb2jOhdb70+ZegDgLXTrav2Pt+6Fwusz CDh3aXoKFUtUj3aBvnkBU4nw6SDf9aL4jnn2YvvKcKoVloNFTRTMGPzXODd/g48Mf/Z7 n5CtJSbfa14rcz6raHNVlu+D6/ljzGBSPiabmRzqDRU2jYtLrx5ee/BMTTJoSJPFXzc4 3R6Wky/3Wkdbt9PvtHXFlOHvjIpbaxd/5sZAIUdyicaKdC/QMxPqIcWYdRCpI+leyYPl GE26BocGTMm5vPB7w+8D+7NGS4wQV7uZ7mE37q73DWFiNyWUw+QNIGmxk20nlh/cSzQ/ Fz4g== 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=YwqlCoYcoAjgSaifNND9IpsibdiTmm82BcBRYxjZgL8=; b=GB4lum7LHD2qDhdQtDDk+TNjTwHGcAdddqlDV3qx+AauoSvYi8FpuvoJkXx/uFlvMh Y8dCir7Nqyi/5V6NLw4OOozH/2rU/PfCxiBqk+0bnuaxG0CaLvEcfMxhU5qtquO4++Xw AW/4FoV7RsNES0vQUWeQeiQEiQiqfltC3H0JUPMKXCpxexS47a48PTsB0VZzs4AVEMTL oorcaj8ic7MhVmQyIWSDlqcfS4cpRuYRssBl2DekKLc1n7OQCwrc4bxRo4VT2bmKoWpT 5st4LQ/pyHfdWkrYMOKXFWYS04tCz1iwfQwBX6cdZE9hg3E+h3LVlFabjhkIRoNV+7Cm XSuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WDMpb+T0; spf=pass (google.com: domain of gcc-patches-return-464783-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464783-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 e25si5606100pfi.451.2017.10.23.10.02.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:02:49 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464783-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=WDMpb+T0; spf=pass (google.com: domain of gcc-patches-return-464783-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464783-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=tt75AfmA7Uqqv0del6vQ6QRBJg+X3 F2y1cYLjffeT+twOo2uIcPLi2qAt8nB9OylFrrH1AWCZBnl0AEhaLr0eXdi2J/kt /BcoGyBfiwh1/vN70fWlacLR9e+TLZR6mwc1iniNvKF2mA5UWxAhIrpi47xI9ME8 +9cPxK29g+qMPo= 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=qnOaygJDZSBUYS3KnMUg/X4yYo8=; b=WDM pb+T0KB+N1UP5ZhLAC088ifMmeCVmY4RfBsiBWk5I2L+wm4KAHQAqKVeLXkv6tiB 8K56FECdnp6XFcjH7ry4zA2GWfRbOTzZDTpnpecaScNwxhVjAIZpg0/Zkd7DvdnE czjP6lrlWHuS78tYcg4ONS7hjT7KXh8gm4v8yp9w= Received: (qmail 105051 invoked by alias); 23 Oct 2017 17:02:36 -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 105041 invoked by uid 89); 23 Oct 2017 17:02:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.5 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-wm0-f51.google.com Received: from mail-wm0-f51.google.com (HELO mail-wm0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:02:34 +0000 Received: by mail-wm0-f51.google.com with SMTP id 196so9244934wma.1 for ; Mon, 23 Oct 2017 10:02:34 -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=YwqlCoYcoAjgSaifNND9IpsibdiTmm82BcBRYxjZgL8=; b=PO7AzZXzAeRNZo4/rmN8OKvcPVVlCxMKoMrMOdr6Bb/tEmZ2wTzAe4Q+PBHUeWmyWT 1HR/dJlj7taNmfYPvuI6w1ocuWbE3RqufKsQLFIQkEIKiNZrPThEYN39FPEf+gObHIMI z1hUnrCxwiLtxITeVpRqgaDIzueKshe8NMGu5oCatMYR/GfYKZO2EVratub/24leJwzs YSmEKPbRj+HheW9VplxfWjmQ1ymk5/Hiu3qNCvWTADSzjoNrn9dMCJitUozhyXAxct+d ltXvhA3DnSFtCGYN8hwNp18OvVrZNk7HkdI+qHnwb8IUtsXwrMjxRakloHLemvz9lcNV NiFw== X-Gm-Message-State: AMCzsaWT65Mu1hx/6G61ZAFcb2DwS1hrSOKIr1C92sPisNDjMkEwFVBi /yuJB1CEzHE1HVQdpHdq8mwR83jB/6I= X-Google-Smtp-Source: ABhQp+QADh3JnuyBQxhkAfr8zC01tTDeQv6s8wPFCMTXczn0Q7omuFdIF2p6m1YhWr4Eb0TCdjstBg== X-Received: by 10.28.143.130 with SMTP id r124mr6432073wmd.122.1508778152296; Mon, 23 Oct 2017 10:02:32 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id t131sm3487134wmd.12.2017.10.23.10.02.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:02:31 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [008/nnn] poly_int: create_integer_operand References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:02:30 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87zi8hsspl.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch generalises create_integer_operand so that it accepts poly_int64s rather than HOST_WIDE_INTs. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * optabs.h (expand_operand): Add an int_value field. (create_expand_operand): Add an int_value parameter and use it to initialize the new expand_operand field. (create_integer_operand): Replace with a declaration of a function that accepts poly_int64s. Move the implementation to... * optabs.c (create_integer_operand): ...here. (maybe_legitimize_operand): For EXPAND_INTEGER, check whether the mode preserves the value of int_value, instead of calling const_int_operand on the rtx. Index: gcc/optabs.h =================================================================== --- gcc/optabs.h 2017-10-23 16:52:20.393664364 +0100 +++ gcc/optabs.h 2017-10-23 17:01:02.532643107 +0100 @@ -60,6 +60,9 @@ struct expand_operand { /* The value of the operand. */ rtx value; + + /* The value of an EXPAND_INTEGER operand. */ + poly_int64 int_value; }; /* Initialize OP with the given fields. Initialise the other fields @@ -69,13 +72,14 @@ struct expand_operand { create_expand_operand (struct expand_operand *op, enum expand_operand_type type, rtx value, machine_mode mode, - bool unsigned_p) + bool unsigned_p, poly_int64 int_value = 0) { op->type = type; op->unsigned_p = unsigned_p; op->unused = 0; op->mode = mode; op->value = value; + op->int_value = int_value; } /* Make OP describe an operand that must use rtx X, even if X is volatile. */ @@ -142,18 +146,7 @@ create_address_operand (struct expand_op create_expand_operand (op, EXPAND_ADDRESS, value, Pmode, false); } -/* Make OP describe an input operand that has value INTVAL and that has - no inherent mode. This function should only be used for operands that - are always expand-time constants. The backend may request that INTVAL - be copied into a different kind of rtx, but it must specify the mode - of that rtx if so. */ - -static inline void -create_integer_operand (struct expand_operand *op, HOST_WIDE_INT intval) -{ - create_expand_operand (op, EXPAND_INTEGER, GEN_INT (intval), VOIDmode, false); -} - +extern void create_integer_operand (struct expand_operand *, poly_int64); /* Passed to expand_simple_binop and expand_binop to say which options to try to use if the requested operation can't be open-coded on the Index: gcc/optabs.c =================================================================== --- gcc/optabs.c 2017-10-23 16:52:20.393664364 +0100 +++ gcc/optabs.c 2017-10-23 17:01:02.531644016 +0100 @@ -6959,6 +6959,20 @@ valid_multiword_target_p (rtx target) return true; } +/* Make OP describe an input operand that has value INTVAL and that has + no inherent mode. This function should only be used for operands that + are always expand-time constants. The backend may request that INTVAL + be copied into a different kind of rtx, but it must specify the mode + of that rtx if so. */ + +void +create_integer_operand (struct expand_operand *op, poly_int64 intval) +{ + create_expand_operand (op, EXPAND_INTEGER, + gen_int_mode (intval, MAX_MODE_INT), + VOIDmode, false, intval); +} + /* Like maybe_legitimize_operand, but do not change the code of the current rtx value. */ @@ -7071,7 +7085,9 @@ maybe_legitimize_operand (enum insn_code case EXPAND_INTEGER: mode = insn_data[(int) icode].operand[opno].mode; - if (mode != VOIDmode && const_int_operand (op->value, mode)) + if (mode != VOIDmode + && must_eq (trunc_int_for_mode (op->int_value, mode), + op->int_value)) goto input; break; }