From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by sourceware.org (Postfix) with ESMTPS id B60F2385841F for ; Sat, 1 Oct 2022 22:14:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B60F2385841F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=aurel32.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Content-Transfer-Encoding:From:Reply-To: Subject:Content-ID:Content-Description:X-Debbugs-Cc; bh=NOeNFvYTyw40WUAvwW04inZDiyao4D3q2h0nltvi3wI=; b=XuMjvk+I8xHYrfMAaljTtXX/p5 RwcGy8bJ+Gm55Bq44YIlXblBctF6vQ+dlo4XfCpqMunMX2Hlh6khmg0hG7s4jJxu6XkPLumtwKg62 ayRlnCUUFbzoK3loyBnGKxREt0I4a5XjqA7Xi5Le6YRlNP5SDfFPhtE8NiwAWqhb7AEv7pMUYPXWo VnNHQC0Su7M/rUqOzlsuo7LQhiqZl7VmlrVRE/2Wd85c6t5AfllC7RkClHWdeYx8BDH3SiUldtFvA Z5lIRKWk+gOOv4ytEI8turY+eId1mhD8haCQ/JNC+ynqq6kqdQre+1kxWUWtf9/PJjZ2fLojxe1G9 T94HWXXA==; Received: from [2a01:e34:ec5d:a741:8a4c:7c4e:dc4c:1787] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oekkx-00Ex9y-EI; Sun, 02 Oct 2022 00:14:47 +0200 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.96) (envelope-from ) id 1oekkw-00Ceyo-3A; Sun, 02 Oct 2022 00:14:46 +0200 Date: Sun, 2 Oct 2022 00:14:46 +0200 From: Aurelien Jarno To: Noah Goldstein Cc: libc-alpha@sourceware.org, "H . J . Lu" , Sunil K Pandey Subject: Re: [PATCH 4/4] x86-64: Require LZCNT for AVX2 memrchr implementation Message-ID: Mail-Followup-To: Noah Goldstein , libc-alpha@sourceware.org, "H . J . Lu" , Sunil K Pandey References: <20221001190911.2994478-1-aurelien@aurel32.net> <20221001190911.2994478-5-aurelien@aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.7 (2022-08-07) X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-10-01 15:06, Noah Goldstein wrote: > On Sat, Oct 1, 2022 at 12:09 PM Aurelien Jarno wrote: > > > > The AVX2 memrchr implementation uses the lzcntl and lzcntq instructions, > > which belongs to the LZCNT CPU feature. > > > > Fixes: af5306a735eb ("x86: Optimize memrchr-avx2.S") > > Partially resolves: BZ #29611 > > --- > > sysdeps/x86_64/multiarch/ifunc-avx2.h | 1 + > > sysdeps/x86_64/multiarch/ifunc-impl-list.c | 7 +++++-- > > 2 files changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/sysdeps/x86_64/multiarch/ifunc-avx2.h b/sysdeps/x86_64/multiarch/ifunc-avx2.h > > index a57a9952f3..f1741083fd 100644 > > --- a/sysdeps/x86_64/multiarch/ifunc-avx2.h > > +++ b/sysdeps/x86_64/multiarch/ifunc-avx2.h > > @@ -37,6 +37,7 @@ IFUNC_SELECTOR (void) > > > > if (X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, AVX2) > > && X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, BMI2) > > + && X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, LZCNT) > > && X86_ISA_CPU_FEATURES_ARCH_P (cpu_features, > > AVX_Fast_Unaligned_Load, )) > > { > > diff --git a/sysdeps/x86_64/multiarch/ifunc-impl-list.c b/sysdeps/x86_64/multiarch/ifunc-impl-list.c > > index c628462d47..db5a2032d6 100644 > > --- a/sysdeps/x86_64/multiarch/ifunc-impl-list.c > > +++ b/sysdeps/x86_64/multiarch/ifunc-impl-list.c > > @@ -209,13 +209,16 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, > > IFUNC_IMPL (i, name, memrchr, > > X86_IFUNC_IMPL_ADD_V4 (array, i, memrchr, > > (CPU_FEATURE_USABLE (AVX512VL) > > - && CPU_FEATURE_USABLE (AVX512BW)), > > + && CPU_FEATURE_USABLE (AVX512BW) > > + && CPU_FEATURE_USABLE (LZCNT)), > > Also needs BMI2 for the `shlx`. Likewise for avx2 versions. Good catch, I haven't look for that one, so I haven't encountered the issue. Similarly there is 'shrx'. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net