[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOG64qMkQJ-znXbeBz=zubhbonzEKtzJ5y6xQZPvXUpkC-=TDg@mail.gmail.com>
Date: Wed, 30 Aug 2023 21:08:05 +0700
From: Alviro Iskandar Setiawan <alviro.iskandar@...weeb.org>
To: Ammar Faizi <ammarfaizi2@...weeb.org>
Cc: Willy Tarreau <w@....eu>,
Thomas Weißschuh <linux@...ssschuh.net>,
Nicholas Rosenberg <inori@...x.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 2/5] tools/nolibc: x86-64: Use `rep stosb` for `memset()`
On Wed, Aug 30, 2023 at 8:57 PM Ammar Faizi wrote:
> +".section .text.nolibc_memset\n"
> +".weak memset\n"
> +"memset:\n"
> + "movq %rsi, %rax\n"
> + "movq %rdx, %rcx\n"
> + "movq %rdi, %rdx\n"
> + "rep stosb\n"
> + "movq %rdx, %rax\n"
> + "retq\n"
The first instruction could be:
movl %esi, %eax
That's smaller. Also, the second argument of memset() is an int
anyway, so there is no need to have a full 64-bit copy of %rsi in
%rax.
-- Viro
Powered by blists - more mailing lists