From patchwork Wed Aug 4 12:52:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1513431 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=S84NUcAf; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GfsB44Yqcz9sW5 for ; Wed, 4 Aug 2021 22:53:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 74533385C411 for ; Wed, 4 Aug 2021 12:53:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74533385C411 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1628081624; bh=Co8jGwEKaz2+4Kbr7g7NZgAZqmL17nXAmgUg2gxQfmk=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=S84NUcAf+MFXNBE2Cc8sHHCs34CBR+7FThxhiIZcy6vodzc2vTpg0rB68+cjkLh5Y f1fJ9+5padH6cxY1yDVbdrPGzqAp1WNVXMv5rJ1sBgZ5iIpynASTxvOsgX5jN4q/x6 bDL/oR1ijeUh9+9/McMK0HDlJ0fD5N+Bv55nUkRM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id C304E3943438 for ; Wed, 4 Aug 2021 12:53:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C304E3943438 Received: by mail-pj1-x102e.google.com with SMTP id g23-20020a17090a5797b02901765d605e14so3359771pji.5 for ; Wed, 04 Aug 2021 05:53:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Co8jGwEKaz2+4Kbr7g7NZgAZqmL17nXAmgUg2gxQfmk=; b=HYUxf4uamERjWu5ina8k88jePSv4XQId033HTasJm1J52rTfIjZ+cOvwp6P9U1Sg4M w3pnoJ73Co6gxlSUdxc/hzFWQBE38TRHfDHFBNX9W/SRx9QH9OsJV0s4r+Pa8eXUo7s2 FtqAlBaPSyYn5oGKJGUIaHBKi1S5ZNQtGnXaSyBshe+IgTKWpqedUtp9FBwzPcN2KiMg GvI7Et+oza0bnXd7A6/PmUMLorBRGnO/upGuUfNHlithVOT+P0Hm+emMUqi8Ji24pzRl FqbvnH9FhqzTBC2mG1dHd8HMBMnn4m+tHsGonIQs0hr5bwGvMkJm0DxpBFbneeaMYqxs VaxQ== X-Gm-Message-State: AOAM531z/YfWU9GhUAKKP9ixjwxaNlCcKnvP3/TjnZqNT1pVdVxgIMOx T+gUp5Z26aKyUhM9ywv4SHaMC6i280IfHhTu73OpVh8O X-Google-Smtp-Source: ABdhPJxhfSquJvEfzcizf5dG+YpRpvRwM2AMTOztv/DEvwLlQBr9wb3g7p0gMcNMVDQ+LxpouQV3WwhDTJIXwofwE88= X-Received: by 2002:a17:902:b407:b029:12c:aadd:90d7 with SMTP id x7-20020a170902b407b029012caadd90d7mr906238plr.79.1628081579198; Wed, 04 Aug 2021 05:52:59 -0700 (PDT) MIME-Version: 1.0 References: <20210803135646.2545430-1-hjl.tools@gmail.com> In-Reply-To: Date: Wed, 4 Aug 2021 05:52:23 -0700 Message-ID: Subject: [PATCH v2] by_pieces: Pass MAX_PIECES to op_by_pieces_d To: "H.J. Lu via Gcc-patches" , Richard Sandiford X-Spam-Status: No, score=-3031.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Gcc-patches" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" On Wed, Aug 4, 2021 at 12:27 AM Richard Sandiford wrote: > > "H.J. Lu via Gcc-patches" writes: > > @@ -1122,8 +1122,8 @@ class op_by_pieces_d > > and its associated FROM_CFN_DATA can be used to replace loads with > > constant values. LEN describes the length of the operation. */ > > > > -op_by_pieces_d::op_by_pieces_d (rtx to, bool to_load, > > - rtx from, bool from_load, > > +op_by_pieces_d::op_by_pieces_d (unsigned int max_pieces, rtx to, > > + bool to_load, rtx from, bool from_load, > > by_pieces_constfn from_cfn, > > void *from_cfn_data, > > unsigned HOST_WIDE_INT len, > > The comment above the function needs to describe the new parameter. > > OK with that change, thanks. > This is the patch I am checking in. Thanks. --- H.J. From 27343601ab064553eac695ed58e741c7b2f6059d Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 3 Aug 2021 06:17:22 -0700 Subject: [PATCH v2] by_pieces: Pass MAX_PIECES to op_by_pieces_d Pass MAX_PIECES to op_by_pieces_d::op_by_pieces_d for move, store and compare. PR target/101742 * expr.c (op_by_pieces_d::op_by_pieces_d): Add a max_pieces argument to set m_max_size. (move_by_pieces_d): Pass MOVE_MAX_PIECES to op_by_pieces_d. (store_by_pieces_d): Pass STORE_MAX_PIECES to op_by_pieces_d. (compare_by_pieces_d): Pass COMPARE_MAX_PIECES to op_by_pieces_d. diff --git a/gcc/expr.c b/gcc/expr.c index b65cfcfdcd1..096c0315ecc 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1110,8 +1110,8 @@ class op_by_pieces_d } public: - op_by_pieces_d (rtx, bool, rtx, bool, by_pieces_constfn, void *, - unsigned HOST_WIDE_INT, unsigned int, bool, + op_by_pieces_d (unsigned int, rtx, bool, rtx, bool, by_pieces_constfn, + void *, unsigned HOST_WIDE_INT, unsigned int, bool, bool = false); void run (); }; @@ -1120,10 +1120,12 @@ class op_by_pieces_d objects named TO and FROM, which are identified as loads or stores by TO_LOAD and FROM_LOAD. If FROM is a load, the optional FROM_CFN and its associated FROM_CFN_DATA can be used to replace loads with - constant values. LEN describes the length of the operation. */ + constant values. MAX_PIECES describes the maximum number of bytes + at a time which can be moved efficiently. LEN describes the length + of the operation. */ -op_by_pieces_d::op_by_pieces_d (rtx to, bool to_load, - rtx from, bool from_load, +op_by_pieces_d::op_by_pieces_d (unsigned int max_pieces, rtx to, + bool to_load, rtx from, bool from_load, by_pieces_constfn from_cfn, void *from_cfn_data, unsigned HOST_WIDE_INT len, @@ -1131,7 +1133,7 @@ op_by_pieces_d::op_by_pieces_d (rtx to, bool to_load, bool qi_vector_mode) : m_to (to, to_load, NULL, NULL), m_from (from, from_load, from_cfn, from_cfn_data), - m_len (len), m_max_size (MOVE_MAX_PIECES + 1), + m_len (len), m_max_size (max_pieces + 1), m_push (push), m_qi_vector_mode (qi_vector_mode) { int toi = m_to.get_addr_inc (); @@ -1324,8 +1326,8 @@ class move_by_pieces_d : public op_by_pieces_d public: move_by_pieces_d (rtx to, rtx from, unsigned HOST_WIDE_INT len, unsigned int align) - : op_by_pieces_d (to, false, from, true, NULL, NULL, len, align, - PUSHG_P (to)) + : op_by_pieces_d (MOVE_MAX_PIECES, to, false, from, true, NULL, + NULL, len, align, PUSHG_P (to)) { } rtx finish_retmode (memop_ret); @@ -1421,8 +1423,8 @@ class store_by_pieces_d : public op_by_pieces_d store_by_pieces_d (rtx to, by_pieces_constfn cfn, void *cfn_data, unsigned HOST_WIDE_INT len, unsigned int align, bool qi_vector_mode) - : op_by_pieces_d (to, false, NULL_RTX, true, cfn, cfn_data, len, - align, false, qi_vector_mode) + : op_by_pieces_d (STORE_MAX_PIECES, to, false, NULL_RTX, true, cfn, + cfn_data, len, align, false, qi_vector_mode) { } rtx finish_retmode (memop_ret); @@ -1618,8 +1620,8 @@ class compare_by_pieces_d : public op_by_pieces_d compare_by_pieces_d (rtx op0, rtx op1, by_pieces_constfn op1_cfn, void *op1_cfn_data, HOST_WIDE_INT len, int align, rtx_code_label *fail_label) - : op_by_pieces_d (op0, true, op1, true, op1_cfn, op1_cfn_data, len, - align, false) + : op_by_pieces_d (COMPARE_MAX_PIECES, op0, true, op1, true, op1_cfn, + op1_cfn_data, len, align, false) { m_fail_label = fail_label; }