From patchwork Tue Feb 6 08:34:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxian Zhu X-Patchwork-Id: 85336 X-Patchwork-Delegate: maxim.kuvyrkov@gmail.com 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 B48EC3858C98 for ; Tue, 6 Feb 2024 08:36:00 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from va-2-34.ptr.blmpb.com (va-2-34.ptr.blmpb.com [209.127.231.34]) by sourceware.org (Postfix) with ESMTPS id DB4DE3858D35 for ; Tue, 6 Feb 2024 08:35:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB4DE3858D35 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 DB4DE3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.127.231.34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707208532; cv=none; b=NOMvteUe6/LnGjoyTl8Fx0jHqYuXpnDxrrYjKRJ9gyApVQ1vw7fZBpWtlFyDcXFooNZw6be5w+WFS1razr/c+0Gb/nwm0yfrit+r3qlj8/VMDx6f2M8NE8wE1vWwF3hLYtqFmRFPnG0hGk96HZQz7JRucZdCaLe8BG2xU2fiZUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707208532; c=relaxed/simple; bh=QUE4XoInQQyno/a50tU8I9fpj/GzKOawaDoI+Hr8S8c=; h=DKIM-Signature:Message-Id:From:Subject:Mime-Version:To:Date; b=p0xhTOfYNGnxzf51Wp4MlBHAWETgrLFpQC9H5jAeWIxdmwzYjvlH2nTC+An17Gb+pD5HJsDh9NYhTkOI29AQPFfEFMX4gaGcWVbQ5rdyXTKLeexZlc4i3F1hW0bMutb9U32byuvITtY6kCa5huETgjoOL8Ygsg6aDUIB29Gi+ao= 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=1707208512; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=7Ok8gIEXMixDlRyuVasu9Y1I8l0AX6aAg1jGONFPrww=; b=Pr3VavlX9mevWhoQyECT2Yn+0/AOAw0S1UNz/bMOMcLmII5B/n8E9c4ONdiL/kBZ9KIoLr 0+ooX55yn2CHKvel3J+Xa01qf42H3q0TXmrc7VM6o35+p5hgJP4SMNOuCPSSzMCTyZEjsO xn1Dh8rjunFCR3Wr9P1wRWlFFZm3WaYQBJTUq6fdnT15K7AGt+fBqNxHXVMTIiiX6yUZK4 T9A0xIdJRRv1PPhAhgojB8wIY1C5i/8OnFT0sfaij9TCcIplkEv8zhSm85glvmM4BA/4wi dmdzHoiQmZdVDTa0km/GD7udLGpeH0RQuXey4Vu9AhRhI146G980xtj2tRzFRw== Message-Id: <20240206083456.721-1-zhujunxian@oss.cipunited.com> X-Lms-Return-Path: From: "Junxian Zhu" Subject: [PATCH v2] mips: Use builtins for ffs and ffsll Mime-Version: 1.0 To: Cc: "Junxian Zhu" Date: Tue, 6 Feb 2024 16:34:56 +0800 X-Original-From: zhujunxian@oss.cipunited.com Received: from localhost.localdomain ([123.52.19.224]) by smtp.feishu.cn with ESMTPS; Tue, 06 Feb 2024 16:35:11 +0800 X-Mailer: git-send-email 2.43.0.windows.1 X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_STATUS, 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+patchwork=sourceware.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 Reviewed-by: Maxim Kuvyrkov --- sysdeps/mips/math-use-builtins-ffs.h | 3 +++ 1 file changed, 3 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..2ab6a03a16 --- /dev/null +++ b/sysdeps/mips/math-use-builtins-ffs.h @@ -0,0 +1,3 @@ +#include +#define USE_FFS_BUILTIN (__mips_isa_rev >= 1) +#define USE_FFSLL_BUILTIN (__mips_isa_rev >= 1)