[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6a33f1c9c0544c29904e29b06a7cff8@AcuMS.aculab.com>
Date: Fri, 1 Sep 2023 14:23:28 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Ammar Faizi' <ammarfaizi2@...weeb.org>, Willy Tarreau <w@....eu>
CC: Thomas Weißschuh <linux@...ssschuh.net>,
"Nicholas Rosenberg" <inori@...x.org>,
Alviro Iskandar Setiawan <alviro.iskandar@...weeb.org>,
Michael William Jonathan <moe@...weeb.org>,
GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: RE: [RFC PATCH v1 0/5] nolibc x86-64 string functions
From: Ammar Faizi
> Sent: 01 September 2023 14:06
...
> > You're completely right indeed, reminds me about the copy_up/copy_down
> > that were not used anymore :-)
>
> I'm an idiot, will fix that. Another attempt as suggested below:
>
> __asm__ (
> ".section .text.nolibc_memmove\n"
> ".weak memmove\n"
> "memmove:\n"
> " movq %rdx, %rcx\n"
> " movq %rdi, %rdx\n"
> " movq %rdi, %rax\n"
You seem to have confused yourself about whether you are using %eax or %edx.
> " subq %rsi, %rdx\n"
> " cmpq %rcx, %rdx\n"
> " jnb .Lforward_copy\n"
I think I'd fall through to the forwards copy
and not worry about replicating the 'reps movsb' and 'ret'.
IIRC 'cld' can be slow as well.
> " leaq -1(%rdi, %rcx, 1), %rdi\n"
> " leaq -1(%rsi, %rcx, 1), %rsi\n"
> " std\n"
> ".Lforward_copy:\n"
> " rep movsb\n"
> " cld\n"
> " ret\n"
> );
>
> --
> Ammar Faizi
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists