From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 5BC6B3858C5F for ; Fri, 2 Feb 2024 02:15:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5BC6B3858C5F 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 5BC6B3858C5F 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=1706840143; cv=none; b=jkFUv3VwriicygsHgM4PmkpT6ObEYYTkYVxflnGKmMiHO/2KxQ0edx5plAJ8Zxo4akHBH0AZzECNR32mGgT3CntVx1aRrF7FaZQ5hVPr4cj+kpYV2NgVBJFyod6Ks8KKZ5sFOQjjC6YRWUUlWgTu3xp3GWdLL/sT4kECayKcy+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706840143; c=relaxed/simple; bh=9u78m3Nbvja0/LLm1BJDQvRHNyEzwO3DjkkZGOmFGSQ=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=wgRoMSrVx94AXCrQhRcwtTLUZxcmILnpQn/uWd5882e2FBiuys3UukdBaTuZYVqNzvYUqjswc0mRHN6oJ6Q4LTQzGDvdixNqj67Eh40e/8ujKagIKSbq2enA0TGrPhW0UBROo4K30x1v6S45QWyKHDOo+ORVEowUkrVgrsHsQRQ= 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 1rVj5e-0001F1-1W for gcc-patches@gcc.gnu.org; Thu, 01 Feb 2024 21:15:40 -0500 Received: from loongson.cn (unknown [10.20.4.107]) by gateway (Coremail) with SMTP id _____8AxOOhAULxlc_cJAA--.9259S3; Fri, 02 Feb 2024 10:15:29 +0800 (CST) Received: from [10.20.4.107] (unknown [10.20.4.107]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cxf88_ULxlCcUsAA--.39910S3; Fri, 02 Feb 2024 10:15:28 +0800 (CST) Subject: Re: [pushed][PATCH] LoongArch: Fix incorrect return type for frecipe/frsqrte intrinsic functions To: Jiahao Xu , gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, xuchenghua@loongson.cn References: <20240124091932.38877-1-xujiahao@loongson.cn> From: chenglulu Message-ID: <9453f73c-19f3-762f-cf3d-ddc56a05a82a@loongson.cn> Date: Fri, 2 Feb 2024 10:15:27 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20240124091932.38877-1-xujiahao@loongson.cn> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8Cxf88_ULxlCcUsAA--.39910S3 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj93XoWxCFW7uF1xCryktFyxCr47Jrc_yoW5tFyUpF W8C3Wjyr48XF97WFykury3Wrn09rZruw1a9Fy3G3sYkF1rtas2qF4rtrsrAFn5Gws7AF1I vrsay34Y9F4UA3gCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUvFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6r4j6r4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc 02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAF wI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxk0xIA0c2IEe2xFo4 CEbIxvr21l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG 67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMI IYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E 14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JV WxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxU7pnQ UUUUU Received-SPF: pass client-ip=114.242.206.163; envelope-from=chenglulu@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9,MIME_CHARSET_FARAWAY=2.45,NICE_REPLY_A=-2.112,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=-11.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_SHORT,MIME_CHARSET_FARAWAY,NICE_REPLY_A,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 List-Id: Pushed to r14-8723. ÔÚ 2024/1/24 ÏÂÎç5:19, Jiahao Xu дµÀ: > 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); > +}