From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by sourceware.org (Postfix) with ESMTPS id A46E83854169 for ; Mon, 3 Oct 2022 20:47:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A46E83854169 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-xc29.google.com with SMTP id k10-20020a4ad10a000000b004756ab911f8so7533473oor.2 for ; Mon, 03 Oct 2022 13:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=V+Yl+Gn+6A+wedXtoquBlP8W9FHqvuV41cL/hdL8jgc=; b=SGsSje90shUFeL/QORlcj/NYLRja8Nf7dqXNKWbCi8nVZmnTNGU6YFPdqRDok9ZSBR oApuSq2M7WMJkLS2RgG5egaX8lFqvtZ6vX/pglW9ZNqzy+SXoAh3SxkaxqwcJ5eLZV2N RHFD5mSsM2W62Cv9noS0NGXxBWH+Ev1MUNA0DE4k2IaYOydu3rkHhexHhhB7/Ax39m0n Gv8QW5kc18UkBjOx1f1oaUWLBzyx0qpwtX3XG34w525hZVBans3ERpdAHjcSDLbfFEJf ATRlfAbVO2KMRBv6zHUOG1lWF9w20qIKZ56rUQt68g00V8d/lKQKkHfb2vDQXfI6qcB8 ornQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=V+Yl+Gn+6A+wedXtoquBlP8W9FHqvuV41cL/hdL8jgc=; b=eDNrQJXuAR1WPpF0FxTRKqAos/on4HmMm/e3sCkWDW888VLgAx9MPIV23AT5rDRmh6 Opmm/qOlMrt8tY8FAe99dyD1kVpzft6lJMl5/qyxFNTA4fmkvQ1EbP2WxTyl0NDVmLW7 e8o4L6uR2LfSCiZ0LQE7cs4GF0IbX/IZvVuWz04dr15sMs77NjDk+lGBbiAIPstFwL7L lh5MNx5Je95/aAn8NQU76WTA1B6B5anbCy2m50zYJrbz2z3AfFjWaYnOZN0hu9Z36FWu bNN3egUdN4eAYqRc8mpAVTvCHGbfVPfGqkpI2gkuRoCEEHGNHb/VahObLar0o8OD4Ce+ 3R+g== X-Gm-Message-State: ACrzQf05+m3shai0m1XWuaxq7aT0lw7bCl/8P2oFw7esgNGdwE2mo/Al fgpBLI+MbJWAbYgkL6UlI9gbl6mWpw31+Ugs+GA= X-Google-Smtp-Source: AMsMyM7FPLN/PpiOiFQMVMy7ZryV9L+Yr7/b/TVmwoUttWu/P0zZlASOfwcDm3kxAl/NeKRUOU7HT6eUiigW7zwY7pc= X-Received: by 2002:a05:6830:410e:b0:657:f539:708c with SMTP id w14-20020a056830410e00b00657f539708cmr8924070ott.244.1664830058935; Mon, 03 Oct 2022 13:47:38 -0700 (PDT) MIME-Version: 1.0 References: <20221003195944.3274548-1-aurelien@aurel32.net> In-Reply-To: <20221003195944.3274548-1-aurelien@aurel32.net> From: Sunil Pandey Date: Mon, 3 Oct 2022 13:47:03 -0700 Message-ID: Subject: Re: [PATCH v3 0/8] x86: Fix AVX2 string functions requiring BMI1, BMI2 or LZCNT (BZ #29611) To: Aurelien Jarno Cc: libc-alpha@sourceware.org, Noah Goldstein , "H . J . Lu" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: v3 looks good to me. On Mon, Oct 3, 2022 at 12:59 PM Aurelien Jarno wrote: > > Some early Intel Haswell CPU have AVX2 instructions, but do not have > BMI1 and BMI2 instructions. Some AVX2 string functions only check for > AVX2, but use BMI1, BMI2 or LZCNT instructions. This patchset tries to > fix that. > > While most fixes only change ifunc-impl-list.c, and thus only concerns > the testsuite, the changes to str*cmp and wcs(n)cmp are a real issue > affecting early Intel Haswell CPU, reported to affect Debian Sid and > Fedora Rawhide. > > On the other hand, the check for LZCNT in memrchr is purely for > correctness, I am not aware of a CPU implementing AVX2 without LZCNT. > > This has been tested by remplacing all BMI1 and BMI2 instructions in the > source code by the "ud2" instruction and disabling the BMI1, BMI2 > feature detection, and running the testsuite. > > Resolves: BZ #29611 > > Changes v2 -> v3: > - Change the way patches are split. No code change. > > Change v1 -> v2: > - Better scan for BMI2 instructions (shlx and shrx) and BMI1 > instructions (blsmsk) instructions following the feedback from Noah > Goldstein > > Aurelien Jarno (8): > x86: include BMI1 and BMI2 in x86-64-v3 level > x86-64: Require BMI2 for AVX2 str(n)casecmp implementations > x86-64: Require BMI2 for AVX2 strcmp implementation > x86-64: Require BMI2 for AVX2 strncmp implementation > x86-64: Require BMI2 for AVX2 wcs(n)cmp implementations > x86-64: Require BMI2 for AVX2 (raw|w)memchr implementations > x86-64: Require BMI2 and LZCNT for AVX2 memrchr implementation > x86-64: Require BMI1/BMI2 for AVX2 strrchr and wcsrchr implementations > > sysdeps/x86/get-isa-level.h | 2 + > sysdeps/x86/isa-level.h | 2 + > sysdeps/x86_64/multiarch/ifunc-avx2.h | 2 + > sysdeps/x86_64/multiarch/ifunc-impl-list.c | 86 ++++++++++++++++----- > sysdeps/x86_64/multiarch/ifunc-strcasecmp.h | 1 + > sysdeps/x86_64/multiarch/strcmp.c | 4 +- > sysdeps/x86_64/multiarch/strncmp.c | 4 +- > 7 files changed, 76 insertions(+), 25 deletions(-) > > -- > 2.35.1 >