From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 2908D3858423 for ; Sat, 28 Aug 2021 02:57:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2908D3858423 Received: by mail-pj1-x1030.google.com with SMTP id u11-20020a17090adb4b00b00181668a56d6so6168115pjx.5 for ; Fri, 27 Aug 2021 19:57:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ok3y+MgG6M9HG0Vm0lagpFK1xU/CqVCnMi6Zzdx3oeA=; b=MZiOzZTFZ7yolWfdhEqPXLpe1koj1mREc1n65z27IVfJExZwvyIZV7uOp8sX/hwI6U CWgRom2Zr2X03rJuAc7ZJwuSmpMkdJ2aTJGDgZOA/cZ6BJ9mVR7fwmb7fYm8xlJ4fCmk zlZbyeL2zTnCJXC6ZHVBePueF3982xy+ZMIWF3iaeI5F4nFYoP1LmGWphXKn7Y5R1u5i 12Fj/16iMNC+JW7r78IpWexfLqxBmuSYz46NvMt+bCEkaHxdaXtjNmJUo+pnyr9KyreA r05w6DbPTiI6fxjxp40xP23qNad5+ynkN4yxVn6O+s9ew2TaA5K6RmojrhW05a+CP6yi kf8g== X-Gm-Message-State: AOAM531olNvbPk7cKnlESV32V3gyMsTUTXL6LIcEplZNYQTlllm2R+dY HKdf4XrE/TrKAQUxFmEDdYYI8lWYGrakuM65efg= X-Google-Smtp-Source: ABdhPJy+BCqX2RmHhznIBa4V6k9Va4AU8enuKiCcjb1YSEVCTN3My3CbGbhe6fz9vpjwLqQRRWLQnZmNUkIUuTAlBQo= X-Received: by 2002:a17:90a:8b95:: with SMTP id z21mr25779234pjn.131.1630119461321; Fri, 27 Aug 2021 19:57:41 -0700 (PDT) MIME-Version: 1.0 References: <20210726120055.1089971-1-hjl.tools@gmail.com> In-Reply-To: From: Noah Goldstein Date: Fri, 27 Aug 2021 22:57:30 -0400 Message-ID: Subject: Re: [PATCH] x86-64: Add Avoid_Short_Distance_REP_MOVSB To: Alexey Tourbin Cc: GNU C Library X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Sat, 28 Aug 2021 02:57:43 -0000 On Fri, Aug 27, 2021 at 8:28 PM Alexey Tourbin via Libc-alpha < libc-alpha@sourceware.org> wrote: > On Mon, Jul 26, 2021 at 3:03 PM H.J. Lu via Libc-alpha > wrote: > > --- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S > > +++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S > > @@ -325,12 +325,16 @@ 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) > > + jz 3f > > movq %rdi, %rcx > > subq %rsi, %rcx > > jmp 2f > > # endif > > 1: > > # if AVOID_SHORT_DISTANCE_REP_MOVSB > > + andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, > __x86_string_control(%rip) > > + jz 3f > > movq %rsi, %rcx > > subq %rdi, %rcx > > 2: > > Why "andl" rather than "testl"? > +1. I missed that before. My patches: [PATCH 5/5] X86-64: Optimize memmove-vec-unaligned-erms.S uses `testl` instead. Although my patch might not be checked in (and it may be a while) as we are still looking into the causes of the slowdown.