From patchwork Wed Nov 9 13:53:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 17553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp345039wru; Wed, 9 Nov 2022 05:55:15 -0800 (PST) X-Google-Smtp-Source: AMsMyM6h5byVqzPywUvq74JPUN9JUSEabvYeEa4T84r1HuHT8jj98zHpHFhsOeBrhD/cpoaD4KTU X-Received: by 2002:a05:6402:42c6:b0:462:1abc:e576 with SMTP id i6-20020a05640242c600b004621abce576mr60103669edc.223.1668002115457; Wed, 09 Nov 2022 05:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668002115; cv=none; d=google.com; s=arc-20160816; b=YE2fDhMmOT/r5pZlk+n6mmXOh5rkmAztADCXDAkWyDS2j7u+Pf8+XqiQNzy0qS+ynJ +DtZI0KNGmOzHinIFJ0s3QwsNfbkA+5I0An+NkNqPxq4OXa9RRsjm0MlQ/XZ34kfVNm0 IOyC0KL75/Q/3/CmbtiSofwY49WM7BUJqgsdJ9+AS4aVC06mFHIxsLPGYvUX/7FH0nMW nLQ1SnjC4co+v0KuZug922xgvL+xocBj0mZ9GVoC+Jo8Pgft7aWjlQhdJvlmyZGYNXaz 8qbPLy5iisO/iJebGOQ7LfKqzKMo34KiNCaBrixr0IHpj75+NQ97YU6Ynhrbg7oNIMtA G1Kw== 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:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=RggD1Vm/Jdi0f7jbQ5OReSxaGHia3RrXeR/9/dOlaWc=; b=SKNOfcmdUzFjbUrYxFB5qZZFYgEJLTev7WxfviSGH2HayJhQJkW32xUofzyZSX9FdJ O8lpKWFkdlCddGmrQ0kP/lPBUASAWPM4NxgeX3Ne8mQxU6LuKuG07sgkU6YnYRne12Rx HJQi8rRv3VaoZY7z08lOQP+XVaNCUk5czEieDO6sQg6HdPaObS8uMHi2mYDinMrb+5xT CwL1eWyiiTGS6trJivMngXAYIk5/vpoTH+elEB3QBmh2C+4fPJtluXmi3OQtRlP02/bH 0hoWI8/1gZLmFJdXaoPCqt3sDqPC4iHtlLDm6iw6AOF/+kUY8hq1SBbMLhd9VaszAgo/ bgYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ITvWaGfa; 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 c11-20020a05640227cb00b0045c3f5b458fsi19010267ede.397.2022.11.09.05.55.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 05:55:15 -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=ITvWaGfa; 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 3903C3887F58 for ; Wed, 9 Nov 2022 13:54:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3903C3887F58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668002075; bh=RggD1Vm/Jdi0f7jbQ5OReSxaGHia3RrXeR/9/dOlaWc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ITvWaGfaB+GwvOeaWVJwvsylS6Aq8hZlQ0R/JocLMk6c3YGQXUrO+XHKyWLuz5tXE pbqkuAPN6CobJigKPdVJ+BVJBUhgGJBifjYiKHXvx04kL4d7J8gMSV6E1hyvBDIbCj 9Z975vnYV40m9EFH5wJgSmrNXN5HfTsZ0hRnyzF4= 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 279223858434 for ; Wed, 9 Nov 2022 13:53:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 279223858434 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 88EA166887; Wed, 9 Nov 2022 08:53:45 -0500 (EST) To: gcc-patches@gcc.gnu.org Cc: Lulu Cheng , Wang Xuerui , Chenghua Xu , Xiaolin Tang , Xi Ruoyao Subject: [PATCH v2 1/4] LoongArch: Rename frint_ to rint2 Date: Wed, 9 Nov 2022 21:53:26 +0800 Message-Id: <20221109135329.952128-2-xry111@xry111.site> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221109135329.952128-1-xry111@xry111.site> References: <20221109135329.952128-1-xry111@xry111.site> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, 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: 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?1749026986113257058?= X-GMAIL-MSGID: =?utf-8?q?1749026986113257058?= Use standard name so __builtin_rint{,f} can be expanded to one instruction. gcc/ChangeLog: * config/loongarch/loongarch.md (frint_): Rename to .. (rint2): .. this. gcc/testsuite/ChangeLog: * gcc.target/loongarch/frint.c: New test. --- gcc/config/loongarch/loongarch.md | 4 ++-- gcc/testsuite/gcc.target/loongarch/frint.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/loongarch/frint.c diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index bda34d0f3db..a14ab14ac24 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -2012,8 +2012,8 @@ (define_insn "lui_h_hi12" [(set_attr "type" "move")] ) -;; Convert floating-point numbers to integers -(define_insn "frint_" +;; Round floating-point numbers to integers +(define_insn "rint2" [(set (match_operand:ANYF 0 "register_operand" "=f") (unspec:ANYF [(match_operand:ANYF 1 "register_operand" "f")] UNSPEC_FRINT))] diff --git a/gcc/testsuite/gcc.target/loongarch/frint.c b/gcc/testsuite/gcc.target/loongarch/frint.c new file mode 100644 index 00000000000..3ee6a8f973a --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/frint.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-mdouble-float" } */ +/* { dg-final { scan-assembler "frint\\.s" } } */ +/* { dg-final { scan-assembler "frint\\.d" } } */ + +double +my_rint (double a) +{ + return __builtin_rint (a); +} + +float +my_rintf (float a) +{ + return __builtin_rintf (a); +}