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: 1390 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp344946wru; Wed, 9 Nov 2022 05:55:00 -0800 (PST) X-Google-Smtp-Source: AMsMyM7OAegcy7x8k+aUGoWJMR8y2NyfJbVNwc9gT6+BpF77sHRMUTCCJfEqmKyz+rH9IpZtkA6k X-Received: by 2002:aa7:c956:0:b0:43b:206d:c283 with SMTP id h22-20020aa7c956000000b0043b206dc283mr60134621edt.381.1668002100110; Wed, 09 Nov 2022 05:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668002100; cv=none; d=google.com; s=arc-20160816; b=IzeMPADk/GC+nuFtTjJFf/J0WN991BmaNchN8Dt7RQ/PexhIId+iNnhIrahXWHU3Nm 4bR3pL1wJ4vRuUwJlT6Pz4osVzri9SjKLskhgi24d2i1aKM3+kllmkSlOUnV3Zf+3p93 xxXGEyi/AgAVDfjwxgb+2O0XXbJYpMFK6MKzKO5+z7tqwV8MRH/1ilulFXyJXXnF3RIx 7c/FG/r/xm3CNUayvdC1VlRP0mBGmCEaoROpJM7OVsMRt8I6H4BWdPOvwMHEo6U63qUA kPBhcJ7E7MXCudy5ZGjkV5RpfuEIHoNwJvRWsKbe1iadeAxT4SwaCvLB6KsMY9pFFpPW HXHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=9JYiA+ofhXmWr96GqmiQzqsldcPFBfyDTPXjxy+dx4c=; b=VFH+bVh9GrHu6GJ9w2qt5S/CupNUiEuAx6kMj6Mf10uD8VEXYUXHGqNXyIi7QjV6eu WzGtF1/3xL7f9FTbhFApSpBXV8SaFybzW2AfFZE70O/3pSJh/2MSmIIKgh7rYPZ2QEoD lFbnELeBcl/VYDRFBTsZ2QtAu+Nn0T163qGq3HXB6m8RZkMP7bEKMlBOuRb2noy+mjMH Mi5bN5vyC0q98WEzStwI6Fij6j8j3O6ulFT0x2y0nMdreksY1ZWFQZE3BpsjEZ2dcFvc scmB71AHDHfbCFmqkHXHqXmEUBNalAo+PNDyb2wr5njlWOuj6Xo+4kpB0nCTkax7B3cY KcCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=yvbNjVy7; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c20-20020a05640227d400b00461ebe2a168si18466154ede.447.2022.11.09.05.54.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 05:55:00 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=yvbNjVy7; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BEBCE3887F70 for ; Wed, 9 Nov 2022 13:54:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEBCE3887F70 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668002068; 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=yvbNjVy7ncf4rCLwE2pa7hgotrMqP3ipvXGoAZ6GFGf1VGbl8FBHIvraN9L0goX+q uSpKsqmz3+lzNHfZIa/1zEoaoaY1WtXISps14Ya4EOhQuy/d6z9cmNaukkqX5KwK3i U7a54q7EIkSvQTjR3jEnpcocUj5cgV7p7juiB4Kw= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749002369197089455?= X-GMAIL-MSGID: =?utf-8?q?1749026970148969068?= 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