From: Evan Green <evan@rivosinc.com>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: Richard Henderson <richard.henderson@linaro.org>,
libc-alpha@sourceware.org, palmer@rivosinc.com,
slewis@rivosinc.com, vineetg@rivosinc.com,
Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH v4 3/3] riscv: Add and use alignment-ignorant memcpy
Date: Fri, 7 Jul 2023 14:37:03 -0700 [thread overview]
Message-ID: <CALs-HssGeE0WDJLHKfeh1axaEVCs3QLrU_a=WGtfAJq3eb1s9g@mail.gmail.com> (raw)
In-Reply-To: <c459cc64-2c95-0885-b4af-f7ff51d30b4e@gmail.com>
On Fri, Jul 7, 2023 at 8:25 AM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 7/7/23 03:22, Richard Henderson via Libc-alpha wrote:
> > On 7/6/23 20:29, Evan Green wrote:
> >> + /* Copy the last few individual bytes */
> >> + add a3, a1, a2
> >> +5:
> >> + lb a4, 0(a1)
> >> + addi a1, a1, 1
> >> + sb a4, 0(t6)
> >> + addi t6, t6, 1
> >> + bltu a1, a3, 5b
> >> +6:
> >> + ret
> >
> > The only time you should be copying individual bytes is when the copy is
> > smaller than SZREG. Otherwise the tail can be handled like
> >
> > add srcend, a1, a2
> > add dstend, a0, a2
> > REG_L tmp, -SZREG(srcend)
> > REG_S tmp, -SZREG(dstend)
> >
> > There are other tricks that can be used to reduce the number of branches
> > -- please examine the x86 code. See e.g. the copy_0_15 block in
> > sysdeps/x86_64/multiarch/memmove-ssse3.S.
> The bits we've got here from VRULL use this trick.
>
> Evan, I'm happy to pass those bits along if you want to take a look.
>
> I have no strong opinions if this should be fixed before integration or
> as a follow-up.
This is the vrull patch, right?
https://patchwork.sourceware.org/project/glibc/patch/20230207001618.458947-13-christoph.muellner@vrull.eu/
Sure, I can add the overlapping word access as suggested by Richard,
it's a good idea. My preference is a followup patch, but I am ok
either way. I should be able to get it sent next week.
-Evan
next prev parent reply other threads:[~2023-07-07 21:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 19:29 [PATCH v4 0/3] RISC-V: ifunced memcpy using new kernel hwprobe interface Evan Green
2023-07-06 19:29 ` [PATCH v4 1/3] riscv: Add Linux hwprobe syscall support Evan Green
2023-07-07 8:15 ` Florian Weimer
2023-07-07 22:10 ` Evan Green
2023-07-10 9:17 ` Florian Weimer
2023-07-11 17:08 ` Evan Green
2023-07-06 19:29 ` [PATCH v4 2/3] riscv: Add hwprobe vdso call support Evan Green
2023-07-06 19:29 ` [PATCH v4 3/3] riscv: Add and use alignment-ignorant memcpy Evan Green
2023-07-07 9:22 ` Richard Henderson
2023-07-07 15:25 ` Jeff Law
2023-07-07 21:37 ` Evan Green [this message]
2023-07-07 22:15 ` Jeff Law
2023-07-08 2:16 ` Stefan O'Rear
2023-07-10 16:19 ` Evan Green
2023-07-12 5:22 ` Stefan O'Rear
2023-07-06 20:11 ` [PATCH v4 0/3] RISC-V: ifunced memcpy using new kernel hwprobe interface Palmer Dabbelt
2023-07-06 22:20 ` Jeff Law
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='CALs-HssGeE0WDJLHKfeh1axaEVCs3QLrU_a=WGtfAJq3eb1s9g@mail.gmail.com' \
--to=evan@rivosinc.com \
--cc=fweimer@redhat.com \
--cc=jeffreyalaw@gmail.com \
--cc=libc-alpha@sourceware.org \
--cc=palmer@rivosinc.com \
--cc=richard.henderson@linaro.org \
--cc=slewis@rivosinc.com \
--cc=vineetg@rivosinc.com \
/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).