From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 397773858C20 for ; Sat, 1 Oct 2022 22:11:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 397773858C20 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-ej1-x631.google.com with SMTP id lh5so15522925ejb.10 for ; Sat, 01 Oct 2022 15:11:45 -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=aIEsBpEJyPaIGb88DtYyxxuXcDEziy07CpEwXNrdPnw=; b=KOFzcWKXvKNI32W0ayqyrV9kM+gNEq3nI6NpOUC48kcOjW4QI51cks1W64m67QLanU V8VLtKE1IL81QSkHTqEfCx+9g+Yj5HHe6hg2f532FJl7HAXYKbN+ATUQV6Ui1ozUtIOB 5OzEGVzIMwpkVlm+/b5PwbbI1ROufaalpz62b52WAynxYOOJHEKNdxgi2p62iZWtdOsw wA8EUxfEcIBKTfqVwg9AdWROWBgYoEY8EdbIq7VrCtO/t+FIfKKzRZqPcOA82wVwBqSC HVsHOChbVpT95QAHAXUyS5hKt2ghDLM2N+6uvLX5cpR8xHHuh1xDOYA34dKHnoSM0Etv avHw== 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=aIEsBpEJyPaIGb88DtYyxxuXcDEziy07CpEwXNrdPnw=; b=ZNvWvQd+WaVcFIUhg3P2o6G09y4nIjzODBwI0fkWMgyf0fSbqmLQpG3aT9JRnBdAfu 8JvyiOFhOBa26TuOuSAaLSAAjgSLQytKsfOfbeTxai5RB4WvmJssgFFSIvpPS8cTurkw KbBwYEammbhF+XY051/gchD4Qg4h96GjgFw+6bpNVbVvfNYEMsJQmBGURisxvHDhnFuZ fJ5JYnP+BPv+E4NdLUCXsCeUOvu+nyAjJh8UgBFTJWq9mIsRvBOi656g/MxRNbuWeqr4 kIfwEd2gPbUZMtL6OLGUGs7wHLeXWg91Leu1EUXD6RLLWx5lrWDpV/4Qwyd5ccr3CuUB ou1A== X-Gm-Message-State: ACrzQf3FZqTo1h8pacIe22pklZ2zedkLI1GErN8F7CIfuumpWuHrzqHP 9v55LBNoAHAB5sXp61GOWIyY/r0NZs/RSJeLsWY7xQ5S X-Google-Smtp-Source: AMsMyM5W6XIlu1z47P0I2CyZ9M5boIIkW8D+wdROkGm9qeGtPaEaIAHCDdqqKAxJ5RFHmdU1U8egRRmU+1fBWZkS0bA= X-Received: by 2002:a17:906:2bc7:b0:72f:dc70:a3c6 with SMTP id n7-20020a1709062bc700b0072fdc70a3c6mr10801331ejg.645.1664662303885; Sat, 01 Oct 2022 15:11:43 -0700 (PDT) MIME-Version: 1.0 References: <20221001190911.2994478-1-aurelien@aurel32.net> In-Reply-To: <20221001190911.2994478-1-aurelien@aurel32.net> From: Noah Goldstein Date: Sat, 1 Oct 2022 15:11:32 -0700 Message-ID: Subject: Re: [PATCH 0/4] x86: Fix AVX2 string functions requiring BMI2 or LZCNT (BZ #29611) To: Aurelien Jarno Cc: libc-alpha@sourceware.org, "H . J . Lu" , Sunil K Pandey Content-Type: text/plain; charset="UTF-8" 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,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Sat, Oct 1, 2022 at 12:09 PM Aurelien Jarno wrote: > > Some early Intel Haswell CPU have AVX2 instructions, but do not have > BMI2 instructions. Some AVX2 string functions only check for AVX2, but > use 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 strn(case)cmp is 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 BMI2 and LZCNT instruction in the > source code by the "ud2" instruction and disabling the BMI1, BMI2 > feature detection, and running the testsuite. > > Resolves: BZ #29611 > > Aurelien Jarno (4): > x86: include BMI1 and BMI2 in x86-64-v3 level > x86-64: Require BMI2 for AVX2 strn(case)cmp and wcsncmp > implementations > x86-64: Require BMI2 for AVX2 (raw|w)memchr implementations > x86-64: Require LZCNT for AVX2 memrchr implementation > We also need BMI2 check in ifunc-impl-list for: strcasecmp strcmp strcasecmp_l strrchr wcsrchr wcscmp If you want you can make patches, otherwise I can. > sysdeps/x86/get-isa-level.h | 2 + > sysdeps/x86_64/multiarch/ifunc-avx2.h | 1 + > sysdeps/x86_64/multiarch/ifunc-impl-list.c | 44 +++++++++++++++------ > sysdeps/x86_64/multiarch/ifunc-strcasecmp.h | 1 + > sysdeps/x86_64/multiarch/strncmp.c | 4 +- > 5 files changed, 38 insertions(+), 14 deletions(-) > > -- > 2.35.1 >