From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 407DE38582AA; Mon, 5 Feb 2024 18:39:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 407DE38582AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1707158395; bh=UeFn3WFRMu0Z3qzM82kRCd0ilKeUVU5LkLA10tW94IQ=; h=From:To:Subject:Date:From; b=oFBoLFUEIq+zb1fxPhzq8Hkjp01dSh2Xmm0CBCqMfAa4jxHjxpdHVrgZowmSvQl+Q Rg8179vz4W0L7p0iNKo+xKkaNTKi9rtuJX6+RsV2RaZkFhziKab/PixEzP6jwhO/Z4 kq7uwhlyv1ztD4GU8/0/TQUfnZYJ7KFPKX1YoZSE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] LoongArch: Use builtins for ffs and ffsll X-Act-Checkin: glibc X-Git-Author: Xi Ruoyao X-Git-Refname: refs/heads/master X-Git-Oldrev: 814ed22eab4f3f43bb02229edab5d50004310258 X-Git-Newrev: 2e80f139376450acdb7d879d799439578a41810e Message-Id: <20240205183955.407DE38582AA@sourceware.org> Date: Mon, 5 Feb 2024 18:39:55 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2e80f139376450acdb7d879d799439578a41810e commit 2e80f139376450acdb7d879d799439578a41810e Author: Xi Ruoyao Date: Sun Feb 4 08:27:50 2024 +0800 LoongArch: Use builtins for ffs and ffsll On LoongArch GCC compiles __builtin_ffs{,ll} to basically `(x ? __builtin_ctz (x) : -1) + 1`. Since a hardware ctz instruction is available, this is much better than the table-driven generic implementation. Tested on loongarch64. Signed-off-by: Xi Ruoyao Reviewed-by: Adhemerval Zanella Diff: --- sysdeps/loongarch/math-use-builtins-ffs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sysdeps/loongarch/math-use-builtins-ffs.h b/sysdeps/loongarch/math-use-builtins-ffs.h new file mode 100644 index 0000000000..a83bb15414 --- /dev/null +++ b/sysdeps/loongarch/math-use-builtins-ffs.h @@ -0,0 +1,2 @@ +#define USE_FFS_BUILTIN 1 +#define USE_FFSLL_BUILTIN 1