Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3315518imm; Thu, 17 May 2018 06:58:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqIEQ9SuYuMm3UfPaXYXCy7D1O+gMYMJEgKGEOUXtvmHQgxb0e7RPN+kyFCSFWjjYMwKpk5 X-Received: by 2002:a63:ad09:: with SMTP id g9-v6mr4124973pgf.74.1526565529231; Thu, 17 May 2018 06:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526565529; cv=none; d=google.com; s=arc-20160816; b=APVMiwL4XPHFBgm12qxFE+77TohMG1R0ewiXIvTvdw+z970ucKMIz+owD2YazjRRSu 6JghSPycgRXLu/o/RrZ0xBD4DMl3hZwCcJKXAOkMfWVRO5WCNt2Ij75hqabwUwUp3fne AigmSljnf/lBPjoS5UJhwCUZKZVtJYr43tfyUfer2xsgqAXlFBZwdl+ORFlJPWq1jnem SlXeChQc7vX4J9s5/ypcfuI2SwMmbVoiKPbrhVEtEs5lZQ0BYwXgtrFZphW/I5tz7xuH ihviGzl/qCybYlHrNN2baBmGG6LOAOMg4hy0VZNBGwfNJXuRJLhevy76/ITLS1gUzMmI TNYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=q8eMo/h/CIhhCNK+8PD5q0tcvyCFNp4AboXt8rxpUMA=; b=C0N+FL9LeXndNEDnf4arxZXfGFrarj5v0Gk69fK9uJfdijwddw5g5sfN5JuXRcw7V4 XdntI7erdFQe4+cyd6zaKhBpOzT4PLnlMrW1zIrJyzC8KQTPiAnTdmWRxes85jkMtzkj F+NzJ/9sqa3r15TlQdyO1qkKX+iqs6jmaaKDJMyUmv/5T+2T8s9xWyGaG9whnq1hBxSF Av2DqEDZciiqyFl0bUFwuo+fSPoU86Kd5ncBF5uUZ8pUjebLceYyKV0jfzAgR/0OauF+ BYTzopfHL2+nrgmxjzPWVywVHrHo45ml/mf2gW7R6FaV/TDeDptRPzw4XQjSdchLwYnZ nqDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si5012603pla.194.2018.05.17.06.58.34; Thu, 17 May 2018 06:58:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752186AbeEQN4h (ORCPT + 99 others); Thu, 17 May 2018 09:56:37 -0400 Received: from gate.crashing.org ([63.228.1.57]:55726 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751647AbeEQN40 (ORCPT ); Thu, 17 May 2018 09:56:26 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w4HDtq07005128; Thu, 17 May 2018 08:55:52 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id w4HDtpkJ005127; Thu, 17 May 2018 08:55:51 -0500 Date: Thu, 17 May 2018 08:55:51 -0500 From: Segher Boessenkool To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 5/5] powerpc/lib: inline memcmp() for small constant sizes Message-ID: <20180517135551.GT17342@gate.crashing.org> References: <8a6f90d882c8b60e5fa0826cd23dd70a92075659.1526553552.git.christophe.leroy@c-s.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8a6f90d882c8b60e5fa0826cd23dd70a92075659.1526553552.git.christophe.leroy@c-s.fr> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 17, 2018 at 12:49:58PM +0200, Christophe Leroy wrote: > In my 8xx configuration, I get 208 calls to memcmp() > Within those 208 calls, about half of them have constant sizes, > 46 have a size of 8, 17 have a size of 16, only a few have a > size over 16. Other fixed sizes are mostly 4, 6 and 10. > > This patch inlines calls to memcmp() when size > is constant and lower than or equal to 16 > > In my 8xx configuration, this reduces the number of calls > to memcmp() from 208 to 123 > > The following table shows the number of TB timeticks to perform > a constant size memcmp() before and after the patch depending on > the size > > Before After Improvement > 01: 7577 5682 25% > 02: 41668 5682 86% > 03: 51137 13258 74% > 04: 45455 5682 87% > 05: 58713 13258 77% > 06: 58712 13258 77% > 07: 68183 20834 70% > 08: 56819 15153 73% > 09: 70077 28411 60% > 10: 70077 28411 60% > 11: 79546 35986 55% > 12: 68182 28411 58% > 13: 81440 35986 55% > 14: 81440 39774 51% > 15: 94697 43562 54% > 16: 79546 37881 52% Could you show results with a more recent GCC? What version was this? What is this really measuring? I doubt it takes 7577 (or 5682) timebase ticks to do a 1-byte memcmp, which is just 3 instructions after all. Segher