From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED, URIBL_DBL_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1693410301; bh=C+m0B3MqZ+rrcZQO51wczW2Uy/Wthx7qnrlmeTa0W9o=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ieGNKi2w+gVGTboyK8clI32Zwfk7Yfv129ChX6HCXNl1SQ7vZ0QjpcI8c3rp+nfyy /JaZlnOd28sUbs2+ZdhSKIXk20mtdefMlRRblElXfHQNKIKgCT9DMKbuc/JVf3+KF1 2uFurtuAAa2em17tpIpelP5pZMqECR6z+czXacSW4QQb0QduMNi1U9fvs27Linhh73 n/7EfgbNQ6RY/Hf6bA4acGAJSWRHve6wt5EaOZ/zLbVgNYbuSQttFGr+V735W2pZoF vWWsqs9JMP0WOkpWtihYK/EoApJQydW+qzJeji3YosfuQPS2SUYmtOHH3q8tF1BuvQ HFX+zZLZ711nA== Received: from biznet-home.integral.gnuweeb.org (unknown [182.253.126.208]) by gnuweeb.org (Postfix) with ESMTPSA id 7148C24B32D; Wed, 30 Aug 2023 22:44:58 +0700 (WIB) Date: Wed, 30 Aug 2023 22:44:53 +0700 From: Ammar Faizi To: Willy Tarreau Cc: Alviro Iskandar Setiawan , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Nicholas Rosenberg , Michael William Jonathan , GNU/Weeb Mailing List , Linux Kernel Mailing List Subject: Re: [RFC PATCH v1 2/5] tools/nolibc: x86-64: Use `rep stosb` for `memset()` Message-ID: References: <20230830135726.1939997-1-ammarfaizi2@gnuweeb.org> <20230830135726.1939997-3-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bpl: hUx9VaHkTWcLO7S8CQCslj6OzqBx2hfLChRz45nPESx5VSB/xuJQVOKOB1zSXE3yc9ntP27bV1M1 List-Id: On Wed, Aug 30, 2023 at 05:23:22PM +0200, Willy Tarreau wrote: > Then "xchg %esi, %eax" is just one byte with no memory access ;-) Perfect! Now I got this, shorter than "movl %esi, %eax": ``` 0000000000001500 : 1500: 96 xchg %eax,%esi 1501: 48 89 d1 mov %rdx,%rcx 1504: 57 push %rdi 1505: f3 aa rep stos %al,%es:(%rdi) 1507: 58 pop %rax 1508: c3 ret ``` Unfortunately, the xchg trick doesn't yield smaller machine code for %rdx, %rcx. Lol. -- Ammar Faizi