From patchwork Tue Jul 2 13:41:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Zhu X-Patchwork-Id: 93240 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B629C38102AA for ; Tue, 2 Jul 2024 13:42:26 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from nisdydeair.tail4cdaa.ts.net (unknown [IPv6:2605:52c0:2:e9a:307b:dbff:fe9d:66cf]) by sourceware.org (Postfix) with ESMTP id 827E03849785 for ; Tue, 2 Jul 2024 13:41:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 827E03849785 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=nisdydeair.tail4cdaa.ts.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 827E03849785 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2605:52c0:2:e9a:307b:dbff:fe9d:66cf ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719927719; cv=none; b=fZjWGbKhyGnpue7PxOhMrUY+UzBngw7y0rWQqcSU9jsyQVcAD9wbN3Fp74lWNcf8VE2iokKAwEONehF8PDO/zR1qD6O2o6Q8BLzOkaMLKhlAWvHGl03D+zLaosfjdoTnan40SObzGAmX1/+T1t4/CaAPnqVHpUBo2V8j8IpSeyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719927719; c=relaxed/simple; bh=woIguQ1/b/RNyhnZJaKS9n1Ko4ul5S1hVile7lYxYLQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=WnLugWBgOnIQEGRclL8wNPUDVQ4BP6kIno60BXrb2xQCrUZKCCffRqZkmWd01jRe8NipjhhWFFV+342/fYxLGwPQWdKQsRYkiU/YSWaw8yGcHrbiM3fBTK65YAtxHXxr6X4q/m1ybTrH/Gw68K8EsZFlZAO8v9n+ssVv1rxRKD0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by nisdydeair.tail4cdaa.ts.net (Postfix, from userid 501) id 373CB2876C63; Tue, 2 Jul 2024 21:41:54 +0800 (CST) From: Julian Zhu To: libc-alpha@sourceware.org Cc: adhemerval.zanella@linaro.org, xry111@xry111.site, Julian Zhu Subject: [PATCH 2/3] RISC-V: Add compiler support check in string-fza.h and string-fzi.h Date: Tue, 2 Jul 2024 21:41:23 +0800 Message-ID: <20240702134124.74121-2-jz531210@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702134124.74121-1-jz531210@gmail.com> References: <20240702134124.74121-1-jz531210@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, MAY_BE_FORGED, NML_ADSP_CUSTOM_MED, NO_DNS_FOR_FROM, SPF_HELO_NONE, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Add macros from `compiler-ext-avail.h` to avoid using Zbb or XTheadBb in unsupported compiler versions. Signed-off-by: Julian Zhu --- sysdeps/riscv/string-fza.h | 5 ++++- sysdeps/riscv/string-fzi.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sysdeps/riscv/string-fza.h b/sysdeps/riscv/string-fza.h index ee5c31317f..57fe39e66a 100644 --- a/sysdeps/riscv/string-fza.h +++ b/sysdeps/riscv/string-fza.h @@ -19,7 +19,10 @@ #ifndef _RISCV_STRING_FZA_H #define _RISCV_STRING_FZA_H 1 -#if defined __riscv_zbb || defined __riscv_xtheadbb +#include "compiler-ext-avail.h" + +#if (defined COMPILER_ZBB_AVAIL && defined __riscv_zbb) \ + || (defined COMPILER_XTHEADBB_AVAIL && defined __riscv_xtheadbb) /* With bitmap extension we can use orc.b to find all zero bytes. */ # include # include diff --git a/sysdeps/riscv/string-fzi.h b/sysdeps/riscv/string-fzi.h index 66237c2f03..dccd759dca 100644 --- a/sysdeps/riscv/string-fzi.h +++ b/sysdeps/riscv/string-fzi.h @@ -19,7 +19,10 @@ #ifndef _STRING_RISCV_FZI_H #define _STRING_RISCV_FZI_H 1 -#if defined __riscv_zbb || defined __riscv_xtheadbb +#include "compiler-ext-avail.h" + +#if (defined COMPILER_ZBB_AVAIL && defined __riscv_zbb) \ + || (defined COMPILER_XTHEADBB_AVAIL && defined __riscv_xtheadbb) # include #else /* Without bitmap clz/ctz extensions, it is faster to direct test the bits