From patchwork Wed Nov 9 13:53:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 1701753 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=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=ArINMfTw; 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 4N6mfS34BKz1yqS for ; Thu, 10 Nov 2022 00:54:07 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2C5933858C39 for ; Wed, 9 Nov 2022 13:54:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C5933858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668002045; bh=9JYiA+ofhXmWr96GqmiQzqsldcPFBfyDTPXjxy+dx4c=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ArINMfTwkLh9Fs+OjG5OlZ7kQCdJk4nvnvAZ7rCPrQbmCkrVzFx+HJXGgylEIWKVY HdVHNwzbPbKMqJucEHMEC4C9XV0KmXXN/sSGpkOIsFK7m+ULseTaznPdKkXfDoHWbM 3ELEYFsqXDiDV/2UCZfKzOp6WtFLm93Cll0T+nJw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 3C1CA3858D1E for ; Wed, 9 Nov 2022 13:53:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3C1CA3858D1E Received: from xry111-x57s1.. (unknown [IPv6:240e:358:113a:1300:dc73:854d:832e:2]) (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 E897F66886; Wed, 9 Nov 2022 08:53:39 -0500 (EST) To: gcc-patches@gcc.gnu.org Cc: Lulu Cheng , Wang Xuerui , Chenghua Xu , Xiaolin Tang , Xi Ruoyao Subject: [PATCH v2 0/4] LoongArch: Add some floating-point operations Date: Wed, 9 Nov 2022 21:53:25 +0800 Message-Id: <20221109135329.952128-1-xry111@xry111.site> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP, KAM_SHORT, LIKELY_SPAM_FROM, PDS_OTHER_BAD_TLD, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Xi Ruoyao via Gcc-patches From: Xi Ruoyao Reply-To: Xi Ruoyao Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" These patches allow to expand the following builtins to floating point instructions for LoongArch: - __builtin_rint{,f} - __builtin_{l,ll}rint{,f} - __builtin_{l,ll}floor{,f} - __builtin_{l,ll}ceil{,f} - __builtin_scalb{n,ln}{,f} - __builtin_logb{,f} Bootstrapped and regtested on loongarch64-linux-gnu. And a modified Glibc using the builtins for rint{,f}, {l,ll}rint{,f}, and logb{,f} also survived Glibc test suite. Please review ASAP because GCC 13 stage 1 will end on Nov. 13th. v1 -> v2: Only use ftint{rm,rp} instructions if floor and ceil are allowed to raise inexact exception. Xi Ruoyao (4): LoongArch: Rename frint_ to rint2 LoongArch: Add ftint{,rm,rp}.{w,l}.{s,d} instructions LoongArch: Add fscaleb.{s,d} instructions as ldexp{sf,df}3 LoongArch: Add flogb.{s,d} instructions and expand logb{sf,df}2 gcc/config/loongarch/loongarch.md | 95 ++++++++++++++++++- gcc/testsuite/gcc.target/loongarch/flogb.c | 18 ++++ gcc/testsuite/gcc.target/loongarch/frint.c | 16 ++++ gcc/testsuite/gcc.target/loongarch/fscaleb.c | 48 ++++++++++ .../gcc.target/loongarch/ftint-no-inexact.c | 44 +++++++++ gcc/testsuite/gcc.target/loongarch/ftint.c | 44 +++++++++ 6 files changed, 261 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/flogb.c create mode 100644 gcc/testsuite/gcc.target/loongarch/frint.c create mode 100644 gcc/testsuite/gcc.target/loongarch/fscaleb.c create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint-no-inexact.c create mode 100644 gcc/testsuite/gcc.target/loongarch/ftint.c