From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 07BD73858292 for ; Wed, 29 Jun 2022 19:32:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 07BD73858292 Received: by mail-pj1-x102b.google.com with SMTP id g20-20020a17090a579400b001ed52939d72so451378pji.4 for ; Wed, 29 Jun 2022 12:32:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DE4Hv78ZkUwejncAO01gAz72wWuyN5hKzXXSfSxm7/c=; b=px8RZtD/8+Fe74Lgv3CJxu43WWeTlyRJDXL+58QGg6ygd3sBtpxjI6dtsYTU6LaRVs b9h01nKlFu+B+A8vm3LITGCtHPEJa4j8xJn4n9QhRahCzxDM45mxp3/1sFycCTZ4qFAc 2XEy0asKmSVfY0U2NzLuxb7mVaWPj3MAq7L2YnGDDcTymF5h355Mp+XD+IWD+4j4Ik7q ydQieftA/mZ9dr9zU2oAA7sKeeZzc2XczjiHGlomg35F1FgMoDbEnNTJlx8c95r5DqaP 5muO8w9Fmzmfqdje85d6mxQie1U5Jf+TgBr/uPulGNAjCJteIKLBIcv1/QOuNXxrQJQu FtzA== X-Gm-Message-State: AJIora8xBaxVwjlw1Zh/YdEfFYTdAdlU9U1qhngntkmN/7ElAlFhz5hE j71rE2EtxOBG/Lnx11Veag1nSQLLik6B6uJk9ME= X-Google-Smtp-Source: AGRyM1v/pmGtxy2MP+DY3V9cR14xqnmCZF0k3arastaQxos6tbgQdfRsLqSe4n3uA2jMppKI9oLvHCSpmqbQnqJREKg= X-Received: by 2002:a17:902:a502:b0:15e:c251:b769 with SMTP id s2-20020a170902a50200b0015ec251b769mr10695249plq.115.1656531140034; Wed, 29 Jun 2022 12:32:20 -0700 (PDT) MIME-Version: 1.0 References: <20220628152757.17922-1-goldstein.w.n@gmail.com> In-Reply-To: <20220628152757.17922-1-goldstein.w.n@gmail.com> From: "H.J. Lu" Date: Wed, 29 Jun 2022 12:31:44 -0700 Message-ID: Subject: Re: [PATCH v1 1/2] x86: Move mem{p}{mov|cpy}_{chk_}erms to its own file To: Noah Goldstein Cc: GNU C Library , "Carlos O'Donell" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3025.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2022 19:32:28 -0000 On Tue, Jun 28, 2022 at 8:28 AM Noah Goldstein wrote: > > The primary memmove_{impl}_unaligned_erms implementations don't > interact with this function. Putting them in same file both > wastes space and unnecessarily bloats a hot code section. > --- > sysdeps/x86_64/multiarch/memmove-erms.S | 53 +++++++++++++++++++ > .../multiarch/memmove-vec-unaligned-erms.S | 50 ----------------- > 2 files changed, 53 insertions(+), 50 deletions(-) > create mode 100644 sysdeps/x86_64/multiarch/memmove-erms.S > > diff --git a/sysdeps/x86_64/multiarch/memmove-erms.S b/sysdeps/x86_64/multiarch/memmove-erms.S > new file mode 100644 > index 0000000000..d98d21644b > --- /dev/null > +++ b/sysdeps/x86_64/multiarch/memmove-erms.S > @@ -0,0 +1,53 @@ > +#include > + > +#if defined USE_MULTIARCH && IS_IN (libc) > + .text > +ENTRY (__mempcpy_chk_erms) > + cmp %RDX_LP, %RCX_LP > + jb HIDDEN_JUMPTARGET (__chk_fail) > +END (__mempcpy_chk_erms) > + > +/* Only used to measure performance of REP MOVSB. */ > +ENTRY (__mempcpy_erms) > + mov %RDI_LP, %RAX_LP > + /* Skip zero length. */ > + test %RDX_LP, %RDX_LP > + jz 2f > + add %RDX_LP, %RAX_LP > + jmp L(start_movsb) > +END (__mempcpy_erms) > + > +ENTRY (__memmove_chk_erms) > + cmp %RDX_LP, %RCX_LP > + jb HIDDEN_JUMPTARGET (__chk_fail) > +END (__memmove_chk_erms) > + > +ENTRY (__memmove_erms) > + movq %rdi, %rax > + /* Skip zero length. */ > + test %RDX_LP, %RDX_LP > + jz 2f > +L(start_movsb): > + mov %RDX_LP, %RCX_LP > + cmp %RSI_LP, %RDI_LP > + jb 1f > + /* Source == destination is less common. */ > + je 2f > + lea (%rsi,%rcx), %RDX_LP > + cmp %RDX_LP, %RDI_LP > + jb L(movsb_backward) > +1: > + rep movsb > +2: > + ret > +L(movsb_backward): > + leaq -1(%rdi,%rcx), %rdi > + leaq -1(%rsi,%rcx), %rsi > + std > + rep movsb > + cld > + ret > +END (__memmove_erms) > +strong_alias (__memmove_erms, __memcpy_erms) > +strong_alias (__memmove_chk_erms, __memcpy_chk_erms) > +#endif > diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S > index d1518b8bab..04747133b7 100644 > --- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S > +++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S > @@ -239,56 +239,6 @@ L(start): > #endif > #if defined USE_MULTIARCH && IS_IN (libc) > END (MEMMOVE_SYMBOL (__memmove, unaligned)) > -# if VEC_SIZE == 16 > -ENTRY (__mempcpy_chk_erms) > - cmp %RDX_LP, %RCX_LP > - jb HIDDEN_JUMPTARGET (__chk_fail) > -END (__mempcpy_chk_erms) > - > -/* Only used to measure performance of REP MOVSB. */ > -ENTRY (__mempcpy_erms) > - mov %RDI_LP, %RAX_LP > - /* Skip zero length. */ > - test %RDX_LP, %RDX_LP > - jz 2f > - add %RDX_LP, %RAX_LP > - jmp L(start_movsb) > -END (__mempcpy_erms) > - > -ENTRY (__memmove_chk_erms) > - cmp %RDX_LP, %RCX_LP > - jb HIDDEN_JUMPTARGET (__chk_fail) > -END (__memmove_chk_erms) > - > -ENTRY (__memmove_erms) > - movq %rdi, %rax > - /* Skip zero length. */ > - test %RDX_LP, %RDX_LP > - jz 2f > -L(start_movsb): > - mov %RDX_LP, %RCX_LP > - cmp %RSI_LP, %RDI_LP > - jb 1f > - /* Source == destination is less common. */ > - je 2f > - lea (%rsi,%rcx), %RDX_LP > - cmp %RDX_LP, %RDI_LP > - jb L(movsb_backward) > -1: > - rep movsb > -2: > - ret > -L(movsb_backward): > - leaq -1(%rdi,%rcx), %rdi > - leaq -1(%rsi,%rcx), %rsi > - std > - rep movsb > - cld > - ret > -END (__memmove_erms) > -strong_alias (__memmove_erms, __memcpy_erms) > -strong_alias (__memmove_chk_erms, __memcpy_chk_erms) > -# endif > > # ifdef SHARED > ENTRY (MEMMOVE_CHK_SYMBOL (__mempcpy_chk, unaligned_erms)) > -- > 2.34.1 > Please make a standalone patch. -- H.J.