From patchwork Sun Feb 4 10:11:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxian Zhu X-Patchwork-Id: 1895003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oss.cipunited.com header.i=@oss.cipunited.com header.a=rsa-sha256 header.s=feishu2303200042 header.b=6H6ujd9A; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TSQLG4pjHz1yhq for ; Sun, 4 Feb 2024 21:12:38 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA829385828B for ; Sun, 4 Feb 2024 10:12:36 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from va-2-38.ptr.blmpb.com (va-2-38.ptr.blmpb.com [209.127.231.38]) by sourceware.org (Postfix) with ESMTPS id 5AECF3858D3C for ; Sun, 4 Feb 2024 10:12:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5AECF3858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=oss.cipunited.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=oss.cipunited.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5AECF3858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.127.231.38 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707041544; cv=none; b=tqiPsMws3TMU816FZIK7KqG5OVXrS+d3ta+LGWEMq+QHw7URFKbpq+ZZ/5oLPl8eT5OyOix6jq0ntac2DCRvs48rAMuU6Aa+0J9hrvdZFhrdaiTGhlYJ96N30gI0XApPCNiJ0fmUqF/iLi3WO4ae6V4BjEuhQeSlJdJ9c8lsIGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707041544; c=relaxed/simple; bh=NMHs8zJgDwZ4sgn9gSpvo2imZkz5kQDcaYIjrn78LqM=; h=DKIM-Signature:From:Date:Message-Id:Subject:Mime-Version:To; b=PtHQZ9E0LpTOaiG/dgq+f0T7/sHHAVZGXrJkTdwr/2f0zajUvfw1uBYkGgWp6PvKvFCEbqarRZP3BDArqzw7P79HZk6YWApg/dfoisSJVBekREGgvg8b0WVSr5puvIvIEs5Y8r50S/FzDo6BUA63k9DzgCinnZfFeakw5K+MN00= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2303200042; d=oss.cipunited.com; t=1707041536; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=WzPSm0x4fESMd8cp+YUEq0l8Uo15+xj9qmTVWofGC28=; b=6H6ujd9Am1zq5mxBYr+H08S963PFCC9QmsR2o/HUxXvxXwjtzDwoMOOu19MtHBdG7qf8Fv DxBqwC59LsyZWvNjfauQTbQBep+UGgKjHM5HIssjTa2+Ui5zPyzrL6mpkeyR3kk20zOrW4 yYOChJSGnMSWiXOWmQS/9F4INnj+t1wZg5YXLlaPXWistrzEcOy7Q9++GSX+KOKjuRNKSC A2AmjCESW3SB1misBEmeTmcGrhhjj1FGLYF6dfqK8XmgScSgHaPY1L7h/B1b7jL9QwJ62e xRFK+cv8oK7WcmWDuSDMsHXejBMWkLiOskmdSt/B1Sjeq1wEtvfkMZ+EOxKMAA== X-Mailer: git-send-email 2.43.0.windows.1 From: "Junxian Zhu" Date: Sun, 4 Feb 2024 18:11:33 +0800 Message-Id: <20240204101132.653-2-zhujunxian@oss.cipunited.com> Received: from localhost.localdomain ([123.52.19.224]) by smtp.feishu.cn with ESMTPS; Sun, 04 Feb 2024 18:12:15 +0800 X-Original-From: zhujunxian@oss.cipunited.com Subject: [PATCH] mips: Use builtins for ffs and ffsll Cc: "Junxian Zhu" Mime-Version: 1.0 To: X-Lms-Return-Path: X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, 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.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org From: Junxian Zhu __builtin_ffs{,ll} basically on __builtin_ctz{,ll} in MIPS GCC compiler. The hardware ctz instructions were available after MIPS{32,64} Release1. By using builtin ctz. It can also reduce code size of ffs/ffsll. Checked on mips o32. mips64. Signed-off-by: Junxian Zhu Reviewed-by: Adhemerval Zanella --- sysdeps/mips/math-use-builtins-ffs.h | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sysdeps/mips/math-use-builtins-ffs.h diff --git a/sysdeps/mips/math-use-builtins-ffs.h b/sysdeps/mips/math-use-builtins-ffs.h new file mode 100644 index 0000000000..78b3f14fae --- /dev/null +++ b/sysdeps/mips/math-use-builtins-ffs.h @@ -0,0 +1,2 @@ +#define USE_FFS_BUILTIN (__mips_isa_rev >= 1) +#define USE_FFSLL_BUILTIN (__mips_isa_rev >= 1)