From patchwork Wed Apr 5 16:21:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1765662 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.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=Doa1bgJk; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Ps95h6R27z1yY8 for ; Thu, 6 Apr 2023 02:27:36 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D4FA3856DC6 for ; Wed, 5 Apr 2023 16:27:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D4FA3856DC6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680712054; bh=X2hXVs+boDvmY/dl5w2aOxXblh23VI3rvIG07AuwjyA=; 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=Doa1bgJkQcqGCjUX5aYwTiBFQNtCLtUb4d0Ju/hzZXa9+ANoncldXNam4mYgwpWcR oRXZv1E0r/wPWteKuecdgWiow+5w0A+hE6jO0hv4pl2EUt3g5coPJJ7tJNusBFqMkc Dx5f1b+wi0zC8ZU7FL9xByWq+zDxZni9opv1I9eQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 0F7DA3858D20 for ; Wed, 5 Apr 2023 16:27:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0F7DA3858D20 Received: by mail-pl1-x634.google.com with SMTP id c18so34893350ple.11 for ; Wed, 05 Apr 2023 09:27:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680712037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X2hXVs+boDvmY/dl5w2aOxXblh23VI3rvIG07AuwjyA=; b=FPsJTvy3KmQU2k6CGltkVCjKGPdUI//EJA94T+KyNhfVFiPd35eVzMm44IQI9Aahh1 EsrQEN6SJtB/ApzXA2dezkOT7sWlqotWthGVi5A1woazemR/C5e3YTM0/SISvRaudpTf XGYozEGMuGTpidY21gy0DM2AvSkQukvVp/nExnCaM7tPmjiQP6rnF1XeLCtFm+628APW 2sR+B4AVxqnXu/IMr7cAutUUf47m1nso+aog72BEnp9OgRX0+OMQliEA5z8mURmesbVh U2n9zSLajPcXp0H1fNm+M8f5Comcv6Nl8hxJL8al0n2jMqTNq+Xs0JsN6DlHn5otkQRn h8lw== X-Gm-Message-State: AAQBX9f8T5HuAuHDlLa+KnEpll/1INGa8rgp0/1DdbyseoSrsl/ZNXwS guUpXzikXET2HHhCAxUGeJmj6eioCuw= X-Google-Smtp-Source: AKy350Z1WveZDAwwrNySXCRyGTAVvmwUnMVXwc/PotjlhKEVYMVX31oNIICcs/zRhZM6K2ovkXpfwA== X-Received: by 2002:a17:90b:224f:b0:23c:ffbf:859e with SMTP id hk15-20020a17090b224f00b0023cffbf859emr7115153pjb.35.1680712036858; Wed, 05 Apr 2023 09:27:16 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.59.161.240]) by smtp.gmail.com with ESMTPSA id g15-20020a17090a7d0f00b002309279baf8sm1557389pjl.43.2023.04.05.09.27.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 09:27:16 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 4F61E740176 for ; Wed, 5 Apr 2023 09:21:45 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 19/19] : Add PREFETCHI support Date: Wed, 5 Apr 2023 09:21:44 -0700 Message-Id: <20230405162144.984598-20-hjl.tools@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405162144.984598-1-hjl.tools@gmail.com> References: <20230405162144.984598-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3025.5 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 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: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Add PREFETCHI support to . Reviewed-by: Noah Goldstein --- manual/platform.texi | 3 +++ sysdeps/x86/bits/platform/x86.h | 1 + sysdeps/x86/cpu-features.c | 1 + sysdeps/x86/include/cpu-features.h | 3 +++ sysdeps/x86/tst-get-cpu-features.c | 2 ++ 5 files changed, 10 insertions(+) diff --git a/manual/platform.texi b/manual/platform.texi index e7448ffc1a..c6ed73cb97 100644 --- a/manual/platform.texi +++ b/manual/platform.texi @@ -533,6 +533,9 @@ extended state management using XSAVE/XRSTOR. @item @code{PREFETCHWT1} -- PREFETCHWT1 instruction. +@item +@code{PREFETCHI} -- PREFETCHIT0/1 instructions. + @item @code{PSE} -- Page Size Extension. diff --git a/sysdeps/x86/bits/platform/x86.h b/sysdeps/x86/bits/platform/x86.h index 96eb4c070d..6555f9b91d 100644 --- a/sysdeps/x86/bits/platform/x86.h +++ b/sysdeps/x86/bits/platform/x86.h @@ -311,6 +311,7 @@ enum x86_cpu_AVX_VNNI_INT8 = x86_cpu_index_7_ecx_1_edx + 4, x86_cpu_AVX_NE_CONVERT = x86_cpu_index_7_ecx_1_edx + 5, x86_cpu_AMX_COMPLEX = x86_cpu_index_7_ecx_1_edx + 8, + x86_cpu_PREFETCHI = x86_cpu_index_7_ecx_1_edx + 14, x86_cpu_index_19_ebx = (CPUID_INDEX_19 * 8 * 4 * sizeof (unsigned int) diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index c2bea6a32d..5bff8ec0b4 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -104,6 +104,7 @@ update_active (struct cpu_features *cpu_features) CPU_FEATURE_SET_ACTIVE (cpu_features, FZLRM); CPU_FEATURE_SET_ACTIVE (cpu_features, FSRS); CPU_FEATURE_SET_ACTIVE (cpu_features, FSRCS); + CPU_FEATURE_SET_ACTIVE (cpu_features, PREFETCHI); CPU_FEATURE_SET_ACTIVE (cpu_features, PTWRITE); if (!CPU_FEATURES_CPU_P (cpu_features, RTM_ALWAYS_ABORT)) diff --git a/sysdeps/x86/include/cpu-features.h b/sysdeps/x86/include/cpu-features.h index f14c1078d5..40b8129d6a 100644 --- a/sysdeps/x86/include/cpu-features.h +++ b/sysdeps/x86/include/cpu-features.h @@ -318,6 +318,7 @@ enum #define bit_cpu_AVX_VNNI_INT8 (1u << 4) #define bit_cpu_AVX_NE_CONVERT (1u << 5) #define bit_cpu_AMX_COMPLEX (1u << 8) +#define bit_cpu_PREFETCHI (1u << 14) /* CPUID_INDEX_19. */ @@ -560,6 +561,7 @@ enum #define index_cpu_AVX_VNNI_INT8 CPUID_INDEX_7_ECX_1 #define index_cpu_AVX_NE_CONVERT CPUID_INDEX_7_ECX_1 #define index_cpu_AMX_COMPLEX CPUID_INDEX_7_ECX_1 +#define index_cpu_PREFETCHI CPUID_INDEX_7_ECX_1 /* CPUID_INDEX_19. */ @@ -804,6 +806,7 @@ enum #define reg_AVX_VNNI_INT8 edx #define reg_AVX_NE_CONVERT edx #define reg_AMX_COMPLEX edx +#define reg_PREFETCHI edx /* CPUID_INDEX_19. */ diff --git a/sysdeps/x86/tst-get-cpu-features.c b/sysdeps/x86/tst-get-cpu-features.c index 87fe27340f..1bd7e0be53 100644 --- a/sysdeps/x86/tst-get-cpu-features.c +++ b/sysdeps/x86/tst-get-cpu-features.c @@ -218,6 +218,7 @@ do_test (void) CHECK_CPU_FEATURE_PRESENT (AVX_VNNI_INT8); CHECK_CPU_FEATURE_PRESENT (AVX_NE_CONVERT); CHECK_CPU_FEATURE_PRESENT (AMX_COMPLEX); + CHECK_CPU_FEATURE_PRESENT (PREFETCHI); CHECK_CPU_FEATURE_PRESENT (AESKLE); CHECK_CPU_FEATURE_PRESENT (WIDE_KL); CHECK_CPU_FEATURE_PRESENT (PTWRITE); @@ -388,6 +389,7 @@ do_test (void) CHECK_CPU_FEATURE_ACTIVE (AVX_VNNI_INT8); CHECK_CPU_FEATURE_ACTIVE (AVX_NE_CONVERT); CHECK_CPU_FEATURE_ACTIVE (AMX_COMPLEX); + CHECK_CPU_FEATURE_ACTIVE (PREFETCHI); CHECK_CPU_FEATURE_ACTIVE (AESKLE); CHECK_CPU_FEATURE_ACTIVE (WIDE_KL); CHECK_CPU_FEATURE_ACTIVE (PTWRITE);