public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Xi Ruoyao <xry111@xry111.site>,
	"dengjianbo@loongson.cn" <dengjianbo@loongson.cn>
Cc: libc-alpha <libc-alpha@sourceware.org>,
	caiyinyu <caiyinyu@loongson.cn>,
	xuchenghua <xuchenghua@loongson.cn>,
	"i.swmail" <i.swmail@xen0n.name>,
	joseph <joseph@codesourcery.com>
Subject: Re: [PATCH 0/2] LoongArch: Add optimized functions.
Date: Thu, 29 Sep 2022 08:45:40 -0300	[thread overview]
Message-ID: <4d22961b-017f-857d-bdba-f6f544860858@linaro.org> (raw)
In-Reply-To: <8411c465e01de9608633f8b1fd2d82d3ef16f001.camel@xry111.site>



On 26/09/22 10:49, Xi Ruoyao wrote:
> Hi Adhemerval and Jianbo,
> 
> I've customized string-fzi.h and string-maskoff.h for LoongArch (see
> attachment).  With them on top of Adhermerval's v5 "Improve generic
> string routines" patch and GCC & Binutils trunk, the benchmark result
> seems comparable with the assembly version for strchr, strcmp, and
> strchrnul.

Excellent, that's exactly what I was aiming for this generic string.
I see that Richard's sees that gcc should handle it better, although
I do not oppose adding this header to support older gcc versions.

> 
> By the way I've tried to unroll the loop in strchr manually, but then
> the compiler produced some bad thing (moving words from a register to
> another with no reason) and the result is slower.

Have you tried to use compiler flags to explicit use loops unrolls:

CFLAGS-strchr.c += --param max-variable-expansions-in-unroller=2 --param max-unroll-times=2 -funroll-loops 

We use this on powerpc, so it might worth a try.

Another options would be to use loop_unroll.h and add a per-arch flag
to define the expansion factor.  I would prefer if we could set this
by compiler.

> 
> I've not really plotted the the result, just took a quick look with my
> eyes.  You can try the bench with my headers in sysdeps/loongarch.


      parent reply	other threads:[~2022-09-29 11:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15  8:57 caiyinyu
2022-08-15  8:57 ` [PATCH 1/2] LoongArch: Add optimized string functions: str{chr, chrnul, cmp, ncmp} caiyinyu
2022-08-15  8:57 ` [PATCH 2/2] LoongArch: Add optimized function: memmove caiyinyu
2022-08-15 14:02 ` [PATCH 0/2] LoongArch: Add optimized functions Carlos O'Donell
2022-08-15 20:46   ` Joseph Myers
     [not found]     ` <ccc3c93d-07d0-ea9b-562c-aeaec8914f20@loongson.cn>
2022-09-02  9:05       ` Fwd: " dengjianbo
2022-09-02 12:27     ` Adhemerval Zanella Netto
     [not found]       ` <403f78f0-55d9-48cf-c62a-4a0462a76987@loongson.cn>
2022-09-19  2:03         ` dengjianbo
2022-09-19 20:16           ` Adhemerval Zanella Netto
2022-09-20  9:54             ` Xi Ruoyao
2022-09-22 18:05               ` Adhemerval Zanella Netto
2022-09-26 13:49                 ` Xi Ruoyao
2022-09-28 14:22                   ` Richard Henderson
2022-09-28 16:42                     ` Xi Ruoyao
2022-09-28 19:18                       ` Richard Henderson
2022-10-10  1:39                         ` Lulu Cheng
2022-09-29  3:00                       ` Lulu Cheng
2022-09-29 11:45                   ` Adhemerval Zanella Netto [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d22961b-017f-857d-bdba-f6f544860858@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=caiyinyu@loongson.cn \
    --cc=dengjianbo@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).