From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by sourceware.org (Postfix) with ESMTPS id 0E2123858405; Fri, 29 Apr 2022 22:08:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0E2123858405 Received: by mail-vs1-xe29.google.com with SMTP id y74so8836711vsy.7; Fri, 29 Apr 2022 15:08:21 -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=IXCVk9DlOJa+7Z8g3eQm5DgeWN0s9HF48tYBcmLSgvk=; b=W0uu3wzzPOjUamE3R43yCfZFBYGCCtCBE5z8sTU8WUqfzqp1cFmoM+FyuCioLbHIR2 AiqzkQQQTm4PMzGYl5QZdLLR80cJxM7QtBio2/b8Uya9fnTr7wWVAnZvY1QAWUUDju+L V7xK2fh5S4oOL+3eo2OZbLv6nOfdomUCOUIO9eGzqqKjZhEiMRgeSEOOBdwb36N7ppOF czrysRDZspWqH7Ry+0x4roCOAbD0yLxTwZBeBJwOIYZISI+W0uqfOfN3e973S1rGtipf M0YeZxrfxQhJJnTY8HgxBdlK+aaTnR6zoHmh/XDUMuZqDtEnn5oeAkMLdAGSzGggajo7 BNNw== X-Gm-Message-State: AOAM530u+RHrdM6JMjYYrMr1AeGf2ZyKCkHszdz7yFA5lInJXqeSQYYP gSyytrtdm1iVBsIcd/SArOnsjv2vY00+WbTSrSigfWY2Az8= X-Google-Smtp-Source: ABdhPJyKGoWGgzBel7NaSmnQw0+jqn97n7aCr7uy6TbkIdXZi9BGiIu82ozkH29ZcYBK7xDDhN46RGI/G3MYOhEyRSg= X-Received: by 2002:a05:6102:cc7:b0:325:a8a7:3a43 with SMTP id g7-20020a0561020cc700b00325a8a73a43mr519118vst.80.1651270100437; Fri, 29 Apr 2022 15:08:20 -0700 (PDT) MIME-Version: 1.0 References: <20210828131530.539387-1-hjl.tools@gmail.com> <3cbda329-bc8a-3076-f7c6-89491788fcf8@redhat.com> In-Reply-To: From: Sunil Pandey Date: Fri, 29 Apr 2022 15:07:44 -0700 Message-ID: Subject: Re: [PATCH] x86-64: Use testl to check __x86_string_control To: "H.J. Lu" Cc: "Carlos O'Donell" , GNU C Library , Libc-stable Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2022 22:08:23 -0000 On Tue, Aug 31, 2021 at 8:11 AM H.J. Lu via Libc-alpha wrote: > > On Mon, Aug 30, 2021 at 10:35 AM Carlos O'Donell wrote: > > > > On 8/28/21 9:15 AM, H.J. Lu via Libc-alpha wrote: > > > Use testl, instead of andl, to check __x86_string_control to avoid > > > updating __x86_string_control. > > > > The __x86_string_control is a global variable that is hidden from external > > linkage and used internally by various routines. Today the value is RW, > > but in the future it could become RO (and probably should after a call > > to init_cacheinfo()). We don't want to do an idempotent update (we have > > only one bit constant for now), but instead just want to check for the bit. > > This code will break when we get another bit, or when it becomes RO. > > > > LGTM. > > > > Reviewed-by: Carlos O'Donell > > I am backporting it to release branches. > > Thanks. > > > > --- > > > sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S > > > index 9f02624375..abde8438d4 100644 > > > --- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S > > > +++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S > > > @@ -325,7 +325,7 @@ L(movsb): > > > /* Avoid slow backward REP MOVSB. */ > > > jb L(more_8x_vec_backward) > > > # if AVOID_SHORT_DISTANCE_REP_MOVSB > > > - andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip) > > > + testl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip) > > > jz 3f > > > movq %rdi, %rcx > > > subq %rsi, %rcx > > > @@ -333,7 +333,7 @@ L(movsb): > > > # endif > > > 1: > > > # if AVOID_SHORT_DISTANCE_REP_MOVSB > > > - andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip) > > > + testl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip) > > > jz 3f > > > movq %rsi, %rcx > > > subq %rdi, %rcx > > > > > > > > > -- > > Cheers, > > Carlos. > > > > > -- > H.J. I would like to backport this patch to release branches. Any comments or objections? --Sunil