From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id B9E6D3858D35 for ; Sun, 18 Oct 2020 15:16:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B9E6D3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=hubicka@kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 9ACA7280873; Sun, 18 Oct 2020 17:16:27 +0200 (CEST) Date: Sun, 18 Oct 2020 17:16:27 +0200 From: Jan Hubicka To: "H.J. Lu" Cc: Uros Bizjak , Jakub Jelinek , Jeffrey Law , "gcc-patches@gcc.gnu.org" Subject: Re: PING^3 [PATCH] x86: Add cmpmemsi for -minline-all-stringops Message-ID: <20201018151627.GB70631@kam.mff.cuni.cz> References: <20200517170637.104977-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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: Sun, 18 Oct 2020 15:16:33 -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. I still plan to intorduce the two-level optimize_for_size predicates. Will try to do that by tuesday. Honza > > -- > H.J.