From patchwork Fri Jun 24 16:41:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1648088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=uUA8QdJ1; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV2w73gKFz9s0r for ; Sat, 25 Jun 2022 02:42:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5DBA8383D80F for ; Fri, 24 Jun 2022 16:42:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5DBA8383D80F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1656088933; bh=gUbq3wqNg8aGbn6oo4po7SN07MH864C6uJhKXnazTiM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=uUA8QdJ1sset3TExH2gBIswHaaqdW63h7BKvKpQCHBKo/LUVjao+U6jrSrn+pS54h dKt6BY7rTHMI4PVUBTjQlb1b3nm9BNYnqxPWbY+0x/2jvZbY7u+eeLCXZpZ95a0YhP w4rqxKrS7iB2BoLhS3c+cOmiVE2wTDT7XGIsb4DU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 6796E383D833 for ; Fri, 24 Jun 2022 16:41:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6796E383D833 Received: by mail-pl1-x631.google.com with SMTP id k7so2571480plg.7 for ; Fri, 24 Jun 2022 09:41:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gUbq3wqNg8aGbn6oo4po7SN07MH864C6uJhKXnazTiM=; b=e8yghSMZ8HLKRoDpoHbyJ+TE9BtAYkWoyF72+8a8xRN3cie11uiD/P+OVwudPeGYFl BkHgFHCczd6SgnktIkNH8e+UHzN6DL75vX1RkZLmmJ91LFehzzFP5/UBJo9jdbNJNO44 R+DFmzFm5pmcaxt1hypf351gwHcbso9TkD2qMpx4rMtcp333Z5kZOqcBRDaURS43si0i jlBE354Yy/8k1i87V8cRbvF9WVhIstIhG66KQ0tCXm94xLI/N19cUxFzBVwMHyfHhimN YmmdKd8bUd/RPvmtlxWgun/rzI7Xx/OFlM8oVaxc56RtMdhhPWCgY+qnEi0tLcHNAVPb BGyw== X-Gm-Message-State: AJIora/KcSAVF3zMgScips1yXraTv7IFGAlkef+Ejy9h0fnUallQykJx Na/FF8tZ8hriLNTLWm8WmzZOhQ7tGqc= X-Google-Smtp-Source: AGRyM1soCRHY8q1QugKIx55FklxV/DDzMKbKsKtI3rTWONMwB687EFYhDoMu0VBe/uvw7LTpEiP6Mg== X-Received: by 2002:a17:903:2585:b0:16a:3c86:c76b with SMTP id jb5-20020a170903258500b0016a3c86c76bmr56715plb.88.1656088908228; Fri, 24 Jun 2022 09:41:48 -0700 (PDT) Received: from noah-tgl.. ([192.55.60.37]) by smtp.gmail.com with ESMTPSA id f1-20020a635541000000b003fcfdc9946dsm1791290pgm.51.2022.06.24.09.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 09:41:48 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 1/2] x86: Add macro for NOT of a cpu arch feature and improve comments Date: Fri, 24 Jun 2022 09:41:44 -0700 Message-Id: <20220624164145.2129377-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Some ARCH_P features such as Prefer_No_VZEROUPPER used to disable implementations if true as opposed fo the majority of features such as AVX2 which are used to enabled features. Different ISA build levels want override certain disabling features. For example ISA build level >= 3 should ignore Prefer_No_VZEROUPPER which means converting the check to false (as opposed to true for a feature like AVX2). --- sysdeps/x86/isa-ifunc-macros.h | 4 ++++ sysdeps/x86/isa-level.h | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sysdeps/x86/isa-ifunc-macros.h b/sysdeps/x86/isa-ifunc-macros.h index ba6826d518..e229e612a4 100644 --- a/sysdeps/x86/isa-ifunc-macros.h +++ b/sysdeps/x86/isa-ifunc-macros.h @@ -67,4 +67,8 @@ (X86_ISA_CPU_FEATURE_CONST_CHECK_ENABLED (name) \ || CPU_FEATURES_ARCH_P (ptr, name)) +#define X86_ISA_CPU_FEATURES_ARCH_P_NOT(ptr, name) \ + (!X86_ISA_CPU_FEATURE_CONST_CHECK_ENABLED (name) \ + && !CPU_FEATURES_ARCH_P (ptr, name)) + #endif diff --git a/sysdeps/x86/isa-level.h b/sysdeps/x86/isa-level.h index 7cae11c228..e1a30ed83e 100644 --- a/sysdeps/x86/isa-level.h +++ b/sysdeps/x86/isa-level.h @@ -66,10 +66,10 @@ /* - * CPU Features that are hard coded as enabled depending on ISA build - * level. + * CPU Features that are hard coded as enabled/disabled depending on + * ISA build level. * - Values > 0 features are always ENABLED if: - * Value >= MINIMUM_X86_ISA_LEVEL + * Value <= MINIMUM_X86_ISA_LEVEL */ @@ -92,6 +92,7 @@ /* * KNL (the only cpu that sets this supported in cpu-features.h) * builds with ISA V1 so this shouldn't harm any architectures. + * NB: Only use this feature with the ARCH_P_NOT macro. */ #define Prefer_No_VZEROUPPER_X86_ISA_LEVEL 3 From patchwork Fri Jun 24 16:41:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1648089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=ykfVRtKA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LV2wy719Yz9s0r for ; Sat, 25 Jun 2022 02:42:58 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 23F20383D805 for ; Fri, 24 Jun 2022 16:42:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23F20383D805 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1656088976; bh=f+G1k8f5sPkUjH1p5XAKdWB9ZNiGGZDSu1AmJcUUO7Q=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ykfVRtKAMaTN9tr9F+otPvJFI55mPPGUiqYblB1DRn2ynCFD5NlRPLYd/nfb4bmps L4QABwk7uGnss33rJOl92k8Ez/zABDu/xCK5xxxHBzYZm88F6YOpHpCA8Ky8kMQirP 0wzaSgnykdd/2zRm6BvJlCjMUaORjvsqt0szO+W8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id D922B383DBB1 for ; Fri, 24 Jun 2022 16:41:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D922B383DBB1 Received: by mail-pj1-x1035.google.com with SMTP id b12-20020a17090a6acc00b001ec2b181c98so6310331pjm.4 for ; Fri, 24 Jun 2022 09:41:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f+G1k8f5sPkUjH1p5XAKdWB9ZNiGGZDSu1AmJcUUO7Q=; b=qAyuKAvre2KIfW781t/eXVfR70HjSB+JVrHWv5hlrNeKVhD6qDBkd4HAqx0tbzjAeL KUF1MY/cXQ1WApp4RC7qjbsS0ph6rpPkN5GttxGaYFlOH1fk5fbZBG2cB7nCohxy8em/ 2xP6qudpGkMrKal0FT2YqrDNubfmYueG/OA2mOhL0z4mn+eZNyutrq/hBCYRAKnRwail cKvbgnXamPioScJmVQ2iTe3iEUrL05lC2GXBwgv7q5ky1L3j0J/uFiuULF3N1neRX9zH IW0aByeEzl/gO8AGgvvmzz/UTkt/JzUWrePonltVaqPrsbTBuqMrUidEbWnlLXPNBBUi bMyw== X-Gm-Message-State: AJIora80AnCvPq0degzDr0GA0AmsaQQL0VA0itNXdOQRKfOp4AonTPiP 8ghntgqJ4diyJ3/5ETYg87+dkwNdkhE= X-Google-Smtp-Source: AGRyM1vt2BsKLuhY8tmqirbGEyBxGiHqxPrevyGbizUoZYiAZfcwj1pf59p/xqh6cII/Yxs5vthYNg== X-Received: by 2002:a17:902:cf42:b0:16a:7402:2b5c with SMTP id e2-20020a170902cf4200b0016a74022b5cmr859758plg.33.1656088909831; Fri, 24 Jun 2022 09:41:49 -0700 (PDT) Received: from noah-tgl.. ([192.55.60.37]) by smtp.gmail.com with ESMTPSA id f1-20020a635541000000b003fcfdc9946dsm1791290pgm.51.2022.06.24.09.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 09:41:49 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 2/2] x86: Use ARCH_P_NOT to check Prefer_No_VZeroupper in ifunc-evex.h Date: Fri, 24 Jun 2022 09:41:45 -0700 Message-Id: <20220624164145.2129377-2-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624164145.2129377-1-goldstein.w.n@gmail.com> References: <20220624164145.2129377-1-goldstein.w.n@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" We want to Prefer_No_VZEROUPPER feature to always be false (i.e we want to prefer with vzeroupper) when building with ISA level >= 3. --- sysdeps/x86_64/multiarch/ifunc-evex.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/x86_64/multiarch/ifunc-evex.h b/sysdeps/x86_64/multiarch/ifunc-evex.h index 856c6261f8..454f3c1eab 100644 --- a/sysdeps/x86_64/multiarch/ifunc-evex.h +++ b/sysdeps/x86_64/multiarch/ifunc-evex.h @@ -51,8 +51,8 @@ IFUNC_SELECTOR (void) if (CPU_FEATURE_USABLE_P (cpu_features, RTM)) return OPTIMIZE (avx2_rtm); - if (X86_ISA_CPU_FEATURES_ARCH_P (cpu_features, - Prefer_No_VZEROUPPER)) + if (X86_ISA_CPU_FEATURES_ARCH_P_NOT (cpu_features, + Prefer_No_VZEROUPPER)) return OPTIMIZE (avx2); }