Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp4115462rdb; Wed, 30 Aug 2023 16:41:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeDibssnpkyfaFrT0oMsGFeh2TKcPxlW7uWydGcFaQrUX46cx498TzXqbTIPFk/UMbPPKq X-Received: by 2002:a05:6a20:f398:b0:136:42c8:693c with SMTP id qr24-20020a056a20f39800b0013642c8693cmr3470700pzb.6.1693438872542; Wed, 30 Aug 2023 16:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693438872; cv=none; d=google.com; s=arc-20160816; b=IQ7LgnReCgcyBclti8umqtpzd5q3bcVfiXM4xeE99QK0BiN6VavMAig1/AgtQPQpSp F3ashvsaDwPT/A/ie6F6GL0tsdzwmsAjCGMtSKx/zvTGVSLNHwNsaahevPUqlG2Vb7Sq x2Z9SrCdmq0uxneFowPNstalXimRzaDJy58LWOQ7JoP+NOTuVDzOpmxrOAeIuu4F89Zk M7K3FJvCHcpUKbWnvpiy5OsUAtUUPUyOEmMWlxONnHRalJ/8wp+DGfZfbxFBePl9mpBt +1R9UUxtp7inpdoAK+HjzGN1qIlWupdfG5AMY5HHzUWOED6uoJTasyKxSJLTK3Bt+aJF qQGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=xiektBSObLRlhQYdYa07iRoaeeQzRpFUmoOHiv8hBF8=; fh=F4w2umFRHnFS4gCHrY2leGXavN+Ya3Xwf4sKQAdEscY=; b=VeTfj9laJd7hgV5zRGibDMnb5XH8gmojSFfDSD5k09aMxeXuVE/BVbWWOmvoJw8TT3 wV8GR2RU6Np7qnAiXMzQNEvpJA3K8NEyb0CntRN75eODTFa4hwm1+Qm0Hjol9easQQNW hneiw2Nc7BrsXUOPhr6d1WbVFRHj6g491L1J40ac/GZECeFl3VQlhjoFuccO/80Qoiw5 w7EZJNyisW5rhJFxQwIHkdVt4yn0R0Q7WLLKsqdif5nQ6TCkdIuyyq3FxFhRcE24P3Lv szcibZ6Z54NIVhemN8LSi6OYk+AYlmOGNI9E58vZHIlHDMJcWiotxoZZ3qQberieCja5 RLmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a633d07000000b005694ee2849dsi231275pga.313.2023.08.30.16.40.56; Wed, 30 Aug 2023 16:41:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241581AbjH3VeP (ORCPT + 99 others); Wed, 30 Aug 2023 17:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241574AbjH3VeO (ORCPT ); Wed, 30 Aug 2023 17:34:14 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 14748E66 for ; Wed, 30 Aug 2023 14:33:35 -0700 (PDT) Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 37ULW2rA001118; Wed, 30 Aug 2023 23:32:02 +0200 Date: Wed, 30 Aug 2023 23:32:02 +0200 From: Willy Tarreau To: Ammar Faizi Cc: Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Nicholas Rosenberg , Alviro Iskandar Setiawan , Michael William Jonathan , GNU/Weeb Mailing List , Linux Kernel Mailing List Subject: Re: [RFC PATCH v1 0/5] nolibc x86-64 string functions Message-ID: References: <20230830135726.1939997-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230830135726.1939997-1-ammarfaizi2@gnuweeb.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ammar, On Wed, Aug 30, 2023 at 08:57:21PM +0700, Ammar Faizi wrote: > Hi Willy, > > This is an RFC patchset for nolibc x86-64 string functions. There are 5 > patches in this series. > > ## Patch 1-3: Use `rep movsb`, `rep stosb`, and `rep cmpsb` for: > - memcpy() and memmove() > - memset() > - memcmp() > respectively. They can simplify the generated ASM code. > > Patch 4 and 5 are not related, just a small cleanup. So overall I'm fine with this, I think it's reasonable. As you said we're not trying to chase the very last byte, but for such functions it's also nice if they can remain small. Some of them might even benefit from being inlined by the way (in this case they'd rather move to C functions with an asm() statement), because the call instruction and the register moves or spilling code will generally be larger than the functions themselves. That might be worth checking. Ah no, we cannot because some of them are called from libgcc and friends. Or we may need to mark them inline and weak without static, I'm not sure how well that works. Please just let me know if you intend to change a few things based on previous comments, and also this memcmp() stuff that's both C and asm. Thanks! Willy