From patchwork Wed Jan 24 09:19:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiahao Xu X-Patchwork-Id: 191440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp869343dyi; Wed, 24 Jan 2024 01:20:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfeTsBIbi6SEXen6g2S0CGvXEusy/+Gt5KBHZnJ8uGw3dpebJvk9SXRBSU+uf5/mWdXVb4 X-Received: by 2002:a05:6214:c8b:b0:683:6621:c006 with SMTP id r11-20020a0562140c8b00b006836621c006mr2674043qvr.81.1706088045312; Wed, 24 Jan 2024 01:20:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706088045; cv=pass; d=google.com; s=arc-20160816; b=pQT7UaEJmgyWDGPq/z22nmJo0iM5q+T6nzf8UFLFLJAhRwXyEJGMY7ubb0qXPI7wd4 ISqr6xhnfR1aD9l9Z++NPOUwLFV15NQDM823J5ZS6KF0mvgxhx2Hvn9om59/cjsI2ATN LWhAjbVsIjy8vrAb50VdTaC7U8uM66AfKROqikh06VfHwcbBvn/HiY0efVjukugfw4S5 UZ5hQc+4433O667+yhjjxupkRPeqXnfijbiBx1WzA1E66VdwjAlkJIwP0KYuzkZQGQgI i0EzuncQpMynFaIpf4EyrL52VSneL4+eXSfmwkm2w+Uct/tWKozeKPwmvr0FIeLqXtkN wGvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=xjt5v2ljNL/GyQ3NzeMV6eDCpA75TVDusTnjkcyy12k=; fh=w+xsGLuzpTj56E0bzPMCc39RWHkBXt2f2AGs+4pGimo=; b=Ex7VSQktQOF98g4LAPP5VL/l2hzOo+SC6kFQMyhT2mumkle3gwbXoNZ1TS1ZuVlxGK e1uYnTeg4b6D38vwHBmXfA5nHl/1BZC0MdPsexcq5LSuKBROr309dW2MxRo4o20/7le9 2Wjhr/05WZ7h2guDVzx77nFbqD47xMd+n17XW+CuvucGazlQvFkDX3G2oMmVCMha76EQ ehyMfP9aUBWwKLXsS8sWgMkEZ9m/RBC/Z/9cvhqjQDoPbIHPAhquLQTaquE6FBR4pO/I eCv0Dom2pmc867NGsvoZZgtF9Z6wQVXi1P40QbG1L4vt+cZMd8WKS8+X+oJYCuzTdXnn zsJQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w4-20020a0c8e44000000b006868b932e4bsi7145671qvb.591.2024.01.24.01.20.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 01:20:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E6B3638582A3 for ; Wed, 24 Jan 2024 09:20:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 11AE43858CDB for ; Wed, 24 Jan 2024 09:19:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 11AE43858CDB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 11AE43858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706087981; cv=none; b=v9ls90WSGi9gYtk7p9En2+kNgzkT0ISGUvXgp01b6EYOKsqXD40Y3jKBuHnMy/3jxeLvTK+FiuyQja5yguFp44X2GrWb4a/TcCT42/AZ1ZOKmXplv/DM3r2ktawglhggzlIeEpdxOTqrX3QbaC6nYjwO9yNgLzm5TbF4rUsepHE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706087981; c=relaxed/simple; bh=71hv/Vouc4ipU4RT7GFFwJ3vycjQVO8/U1Iq1PpE5eo=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=b/bcqzq1KKg2Ra/Sg7tG2NtJsQ/2oILJjg/mdVJ2lwwZzmQRNAy9uDz8YuCiL3vBHodybf4Bvv1DUKNCKbr4XvzJbRewQhgIg75wFZHe4AEGbPbMiiqBOhlR/vi1dA2vCtNGEaVOsl+hmOJoAFXk+mLvQgXetFjuLhrgrkF1cy0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSZQ1-00027h-Uc for gcc-patches@gcc.gnu.org; Wed, 24 Jan 2024 04:19:39 -0500 Received: from loongson.cn (unknown [10.10.130.252]) by gateway (Coremail) with SMTP id _____8DxWPAn1rBlxqoEAA--.18593S3; Wed, 24 Jan 2024 17:19:35 +0800 (CST) Received: from slurm-master.loongson.cn (unknown [10.10.130.252]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Bx7c4m1rBlxY8WAA--.34225S4; Wed, 24 Jan 2024 17:19:34 +0800 (CST) From: Jiahao Xu To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, chenglulu@loongson.cn, xuchenghua@loongson.cn, Jiahao Xu Subject: [PATCH] LoongArch: Fix incorrect return type for frecipe/frsqrte intrinsic functions Date: Wed, 24 Jan 2024 17:19:32 +0800 Message-Id: <20240124091932.38877-1-xujiahao@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Bx7c4m1rBlxY8WAA--.34225S4 X-CM-SenderInfo: 50xmxthkdrqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxWr4fZr1fAFykKFW5WFyDArc_yoW5ur47pa y8Cw1jqr48XF97uFyDCry3Wwn09FZruw1a9Fy3G39YkF1rt3s2qF1rtrsrAFn8G3yfAFyS vrZIya4Y9F4UA3gCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j83kZUUUUU= Received-SPF: pass client-ip=114.242.206.163; envelope-from=xujiahao@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, SPF_FAIL, SPF_HELO_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788962978254324733 X-GMAIL-MSGID: 1788962978254324733 gcc/ChangeLog: * config/loongarch/larchintrin.h (__frecipe_s): Update function return type. (__frecipe_d): Ditto. (__frsqrte_s): Ditto. (__frsqrte_d): Ditto. gcc/testsuite/ChangeLog: * gcc.target/loongarch/larch-frecipe-intrinsic.c: New test. diff --git a/gcc/config/loongarch/larchintrin.h b/gcc/config/loongarch/larchintrin.h index 7692415e04d..ff2c9f460ac 100644 --- a/gcc/config/loongarch/larchintrin.h +++ b/gcc/config/loongarch/larchintrin.h @@ -336,38 +336,38 @@ __iocsrwr_d (unsigned long int _1, unsigned int _2) #ifdef __loongarch_frecipe /* Assembly instruction format: fd, fj. */ /* Data types in instruction templates: SF, SF. */ -extern __inline void +extern __inline float __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) __frecipe_s (float _1) { - __builtin_loongarch_frecipe_s ((float) _1); + return (float) __builtin_loongarch_frecipe_s ((float) _1); } /* Assembly instruction format: fd, fj. */ /* Data types in instruction templates: DF, DF. */ -extern __inline void +extern __inline double __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) __frecipe_d (double _1) { - __builtin_loongarch_frecipe_d ((double) _1); + return (double) __builtin_loongarch_frecipe_d ((double) _1); } /* Assembly instruction format: fd, fj. */ /* Data types in instruction templates: SF, SF. */ -extern __inline void +extern __inline float __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) __frsqrte_s (float _1) { - __builtin_loongarch_frsqrte_s ((float) _1); + return (float) __builtin_loongarch_frsqrte_s ((float) _1); } /* Assembly instruction format: fd, fj. */ /* Data types in instruction templates: DF, DF. */ -extern __inline void +extern __inline double __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) __frsqrte_d (double _1) { - __builtin_loongarch_frsqrte_d ((double) _1); + return (double) __builtin_loongarch_frsqrte_d ((double) _1); } #endif diff --git a/gcc/testsuite/gcc.target/loongarch/larch-frecipe-intrinsic.c b/gcc/testsuite/gcc.target/loongarch/larch-frecipe-intrinsic.c new file mode 100644 index 00000000000..6ce2bde0acf --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/larch-frecipe-intrinsic.c @@ -0,0 +1,30 @@ +/* Test intrinsics for frecipe.{s/d} and frsqrte.{s/d} instructions */ +/* { dg-do compile } */ +/* { dg-options "-mfrecipe -O2" } */ +/* { dg-final { scan-assembler-times "test_frecipe_s:.*frecipe\\.s.*test_frecipe_s" 1 } } */ +/* { dg-final { scan-assembler-times "test_frecipe_d:.*frecipe\\.d.*test_frecipe_d" 1 } } */ +/* { dg-final { scan-assembler-times "test_frsqrte_s:.*frsqrte\\.s.*test_frsqrte_s" 1 } } */ +/* { dg-final { scan-assembler-times "test_frsqrte_d:.*frsqrte\\.d.*test_frsqrte_d" 1 } } */ + +#include + +float +test_frecipe_s (float _1) +{ + return __frecipe_s (_1); +} +double +test_frecipe_d (double _1) +{ + return __frecipe_d (_1); +} +float +test_frsqrte_s (float _1) +{ + return __frsqrte_s (_1); +} +double +test_frsqrte_d (double _1) +{ + return __frsqrte_d (_1); +}