From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) by sourceware.org (Postfix) with ESMTPS id 45243384400A for ; Sat, 17 Oct 2020 21:18:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 45243384400A Received: by mail-oo1-xc30.google.com with SMTP id z1so1651419ooj.3 for ; Sat, 17 Oct 2020 14:18:53 -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:cc; bh=zkEDosV6raxWa4KXMNSr7pgF25M7HrEsovUsVw3qnrc=; b=ORmkw2VIcmzcXzWHe4JTqiQeH9Oq9dXkzGMG3MLSbSXddLSUsj3aZ+g89WbgPytCi9 CRsXJcmqiqtibM6XALe3/Ilo2JV4cqVBk1trChRBuBCc/HFsXFuM3pbC+MV5IKbcNHjW Sd7/a2xBleEJYf5MxoziR2qgrGSbvQsM6FauQqcT1H+3Gx7TTNRM3JKNE56o4NnbPK3M fgXQTIr6gk5s15scLImu/IpO/IK6Lztvv9wXPD/ATu6RaSq2ztP1r6RsDm9jhfuDO3eo O6gZ+6UzfvOLys/dDnYbm2EXXwsOYJMgDmo3xwydesl8cAzdZG/S+qH8N/skdSF35Ba1 NNLw== X-Gm-Message-State: AOAM532FYoMewHPH83fTJEalcuUCy4ZoJnmAHng3dA086xW2zKYO5Z3Z nEKApGAXmegwq2qR5wXexr2H1mIwpKTNK/GVRaY= X-Google-Smtp-Source: ABdhPJyuIDnhtPkaxoxnmDaz7n00qX9sgeClPhkEMKp8DvoBWdDPbIvv9JKVRWR4e0Dz3CNal1ycZ5KoQchHjdKy+n8= X-Received: by 2002:a4a:e93a:: with SMTP id a26mr7573918ooe.58.1602969532656; Sat, 17 Oct 2020 14:18:52 -0700 (PDT) MIME-Version: 1.0 References: <20200517170637.104977-1-hjl.tools@gmail.com> In-Reply-To: From: "H.J. Lu" Date: Sat, 17 Oct 2020 14:18:16 -0700 Message-ID: Subject: Re: PING^3 [PATCH] x86: Add cmpmemsi for -minline-all-stringops To: Uros Bizjak , Jakub Jelinek , Jeffrey Law Cc: "gcc-patches@gcc.gnu.org" , Jan Hubicka Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3030.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Sat, 17 Oct 2020 21:18:54 -0000 On Fri, Oct 2, 2020 at 6:21 AM H.J. Lu wrote: > > On Wed, Sep 16, 2020 at 10:07 PM H.J. Lu wrote: > > > > On Wed, Aug 19, 2020 at 6:09 AM H.J. Lu wrote: > > > > > > On Tue, May 19, 2020 at 5:14 AM H.J. Lu wrote: > > > > > > > > On Tue, May 19, 2020 at 1:48 AM Uros Bizjak wrote: > > > > > > > > > > On Sun, May 17, 2020 at 7:06 PM H.J. Lu wrote: > > > > > > > > > > > > Duplicate the cmpstrn pattern for cmpmem. The only difference is that > > > > > > the length argument of cmpmem is guaranteed to be less than or equal to > > > > > > lengths of 2 memory areas. Since "repz cmpsb" can be much slower than > > > > > > memcmp function implemented with vector instruction, see > > > > > > > > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052 > > > > > > > > > > > > expand cmpmem to "repz cmpsb" only with -mgeneral-regs-only. > > > > > > > > > > If there is no benefit compared to the library implementation, then > > > > > enable these patterns only when -minline-all-stringops is used. > > > > > > > > Fixed. > > > > > > > > > Eventually these should be reimplemented with SSE4 string instructions. > > > > > > > > > > Honza is the author of the block handling x86 system, I'll leave the > > > > > review to him. > > > > > > > > We used to expand memcmp to "repz cmpsb" via cmpstrnsi. It was changed > > > > by > > > > > > > > commit 9b0f6f5e511ca512e4faeabc81d2fd3abad9b02f > > > > Author: Nick Clifton > > > > Date: Fri Aug 12 16:26:11 2011 +0000 > > > > > > > > builtins.c (expand_builtin_memcmp): Do not use cmpstrnsi pattern. > > > > > > > > * builtins.c (expand_builtin_memcmp): Do not use cmpstrnsi > > > > pattern. > > > > * doc/md.texi (cmpstrn): Note that the comparison stops if both > > > > fetched bytes are zero. > > > > (cmpstr): Likewise. > > > > (cmpmem): Note that the comparison does not stop if both of the > > > > fetched bytes are zero. > > > > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95151 > > > > > > > > is a regression. > > > > > > > > Honza, can you take a look at this? > > > > > > > > > > PING: > > > > > > https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546921.html > > > > > > > PING. > > > > PING. > I'd like to check it in next Tuesday if there are no comments. -- H.J.