From patchwork Sat Oct 15 06:12:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 1690272 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=wbu8Hyw8; 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 4MqCbz5jJJz23jk for ; Sat, 15 Oct 2022 17:13:03 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8CFFC3858C62 for ; Sat, 15 Oct 2022 06:12:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CFFC3858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665814376; bh=bNXHjmJbrY0/lDPx6SIJf6cS1i8gUHZpWfi7RNXGdMI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=wbu8Hyw8QhHGT3x0XyoXt8km/z/lNrtcL7tNZ60KtoIwd8EBs6dNoLRDay6lF/NR4 mQXnIkgr7UWnk6FqpPGKYpxfFSxadppSBfRYx+yUO1nPjGpH9vRI+DU983RC6eEevR fps+LnNUy0IXnx72U7f3tmf+Sald3ZJM6/MZfiDQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id C3E883858D1E for ; Sat, 15 Oct 2022 06:12:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C3E883858D1E Received: from xry111-x57s1.. (unknown [IPv6:240e:358:116d:4900:dc73:854d:832e:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 13D4466777; Sat, 15 Oct 2022 02:12:33 -0400 (EDT) To: libc-alpha@sourceware.org Subject: [PATCH] longlong.h: update from GCC for LoongArch clz/ctz support Date: Sat, 15 Oct 2022 14:12:13 +0800 Message-Id: <20221015061212.23105-1-xry111@xry111.site> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP, GIT_PATCH_0, LIKELY_SPAM_FROM, PDS_OTHER_BAD_TLD, SPF_HELO_PASS, 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: Xi Ruoyao via Libc-alpha From: Xi Ruoyao Reply-To: Xi Ruoyao Cc: Wang Xuerui , Joseph Myers , caiyinyu Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Update longlong.h to GCC r13-3269. Keep our local change (prefer https for gnu.org URL). Reviewed-by: Adhemerval Zanella --- stdlib/longlong.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/stdlib/longlong.h b/stdlib/longlong.h index 9b89469ac2..d8f76a43b5 100644 --- a/stdlib/longlong.h +++ b/stdlib/longlong.h @@ -593,6 +593,18 @@ extern UDItype __umulsidi3 (USItype, USItype); #define UMUL_TIME 14 #endif +#ifdef __loongarch__ +# if W_TYPE_SIZE == 32 +# define count_leading_zeros(count, x) ((count) = __builtin_clz (x)) +# define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x)) +# define COUNT_LEADING_ZEROS_0 32 +# elif W_TYPE_SIZE == 64 +# define count_leading_zeros(count, x) ((count) = __builtin_clzll (x)) +# define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x)) +# define COUNT_LEADING_ZEROS_0 64 +# endif +#endif + #if defined (__M32R__) && W_TYPE_SIZE == 32 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ /* The cmp clears the condition bit. */ \