From patchwork Wed Nov 23 02:38:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaolin Tang X-Patchwork-Id: 55316 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 63185385221F for ; Wed, 23 Nov 2022 02:39:17 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id C1DA5385843D for ; Wed, 23 Nov 2022 02:38:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C1DA5385843D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.5]) by gateway (Coremail) with SMTP id _____8AxhfC+h31jVCcAAA--.466S3; Wed, 23 Nov 2022 10:38:55 +0800 (CST) Received: from 5.5.5 (unknown [10.2.5.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxoOK9h31jy3kYAA--.63733S2; Wed, 23 Nov 2022 10:38:53 +0800 (CST) From: Xiaolin Tang To: adhemerval.zanella@linaro.org, libc-alpha@sourceware.org, caiyinyu@loongson.cn, xry111@xry111.site Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, Xiaolin Tang Subject: [PATCH 0/9] LoongArch: Use builtins with GCC >= 13 Date: Wed, 23 Nov 2022 10:38:48 +0800 Message-Id: <20221123023851.751187-1-tangxiaolin@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxoOK9h31jy3kYAA--.63733S2 X-CM-SenderInfo: pwdqw5xldrzx3q6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoWxCw18Xw17Cr47Xw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=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Patch 0001-0007: GCC 13, LoongArch support builtins for {,l,ll}rint, logb, use these built-ins instead of generic function implementation. Patch 0008: GCC 13, LoongArch support ___builtin_scalbn{,f} with -fno-math-errno, but only "libm" can use -fno-math-errno in GLIBC, and scalbn is in libc instead of libm because __printf_fp calls it. So inline assembler of the scalbn functions is a better choice for LoongArch. Patch 0009: Add LoongArch support for scalb[f]. Discuss with Xi Ruoyao Link: https://sourceware.org/pipermail/libc-alpha/2022-November/143425.html Xi Ruoyao (1): LoongArch: Use __builtin_rint{,f} with GCC >= 13 Xiaolin Tang (8): Use GCC builtins for lrint functions if desired. LoongArch: Use __builtin_lrint{,f} with GCC >= 13 Use GCC builtins for llrint functions if desired. LoongArch: Use __builtin_llrint{,f} with GCC >= 13 Use GCC builtins for logb functions if desired. LoongArch: Use __builtin_logb{,f} with GCC >= 13 LoongArch: Add support for scalbn[f] LoongArch: Add support for scalb[f] sysdeps/generic/math-use-builtins-llrint.h | 4 ++ sysdeps/generic/math-use-builtins-logb.h | 4 ++ sysdeps/generic/math-use-builtins-lrint.h | 4 ++ sysdeps/generic/math-use-builtins.h | 3 + sysdeps/ieee754/dbl-64/s_llrint.c | 18 ++++-- sysdeps/ieee754/dbl-64/s_logb.c | 5 ++ sysdeps/ieee754/dbl-64/s_lrint.c | 18 ++++-- sysdeps/ieee754/float128/float128_private.h | 6 ++ sysdeps/ieee754/flt-32/s_llrintf.c | 18 ++++-- sysdeps/ieee754/flt-32/s_logbf.c | 5 ++ sysdeps/ieee754/flt-32/s_lrintf.c | 18 ++++-- sysdeps/ieee754/ldbl-128/s_llrintl.c | 17 ++++-- sysdeps/ieee754/ldbl-128/s_logbl.c | 6 ++ sysdeps/ieee754/ldbl-128/s_lrintl.c | 17 ++++-- sysdeps/loongarch/fpu/e_scalb.c | 60 +++++++++++++++++++ sysdeps/loongarch/fpu/e_scalbf.c | 60 +++++++++++++++++++ .../loongarch/fpu/math-use-builtins-llrint.h | 10 ++++ .../loongarch/fpu/math-use-builtins-logb.h | 10 ++++ .../loongarch/fpu/math-use-builtins-lrint.h | 10 ++++ .../loongarch/fpu/math-use-builtins-rint.h | 9 +++ sysdeps/loongarch/fpu/s_scalbn.c | 29 +++++++++ sysdeps/loongarch/fpu/s_scalbnf.c | 29 +++++++++ 22 files changed, 326 insertions(+), 34 deletions(-) create mode 100644 sysdeps/generic/math-use-builtins-llrint.h create mode 100644 sysdeps/generic/math-use-builtins-logb.h create mode 100644 sysdeps/generic/math-use-builtins-lrint.h create mode 100644 sysdeps/loongarch/fpu/e_scalb.c create mode 100644 sysdeps/loongarch/fpu/e_scalbf.c create mode 100644 sysdeps/loongarch/fpu/math-use-builtins-llrint.h create mode 100644 sysdeps/loongarch/fpu/math-use-builtins-logb.h create mode 100644 sysdeps/loongarch/fpu/math-use-builtins-lrint.h create mode 100644 sysdeps/loongarch/fpu/math-use-builtins-rint.h create mode 100644 sysdeps/loongarch/fpu/s_scalbn.c create mode 100644 sysdeps/loongarch/fpu/s_scalbnf.c