From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 17:03:00 -0000 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 Content-Type: text/plain X-SW-Source: 2017-10/txt/msg01508.txt.bz2 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; }