From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 728923858404 for ; Fri, 9 Sep 2022 08:10:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 728923858404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,302,1654588800"; d="scan'208";a="82592649" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 09 Sep 2022 00:10:13 -0800 IronPort-SDR: LN9QYFVkGcKJweu5lcEWG04FY2/LtZn5gxxkfAwz+/zdc+K5GyDEvOKJusDWZBcAi66gxPV+0+ JJAxFW8gy+T1mLPLIbVmWpFl5OvSojvxqDExL4AfqRgjDWSmHau071LjKUsX4RXCncTXdNd9HZ Z/60s4ZdnwsXU1C8PQ8bJ1bMsFrQCt74PES50quC5Wpw6fnDEVJzBnD/PplzrsVZ6Py2i8rYS2 jG//DbZgcjAsrsKS0Vx7qafZXomApRwp6GCHUo03wZwPZhWVKycmJns9qvU0x5YpwrcXYZVqJh 38o= Message-ID: Date: Fri, 9 Sep 2022 09:10:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] amdgcn: Add support for additional natively supported floating-point operations To: Kwok Cheung Yeung , gcc-patches References: Content-Language: en-GB From: Andrew Stubbs In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_PASS,SPF_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: On 08/09/2022 21:38, Kwok Cheung Yeung wrote: > Hello > > This patch adds support for some additional floating-point operations, > in scalar and vector modes, which are natively supported by the AMD GCN > instruction set, but haven't been implemented in GCC yet. With the > exception of frexp, these implement standard RTL names, and should be > utilised automatically by GCC. > > The instructions for the transcendental functions are documented to have > limited numerical precision, so they are only used if > unsafe_math_optimizations are enabled for now. > > The sin and cos instructions for some reason are scaled by 2*PI radians > (i.e. 1.0 == 2*PI radians/360 degrees), so their inputs need to be > scaled by 1/(2*PI) first. I've implemented this as an expander to two > instructions - one to do the pre-scaling, one to do the sin/cos. > 1/(2*PI) is a builtin constant for GCN, but the syntax to use it in the > LLVM assembler was wrong - now fixed. > > I have also added some extra GCN-specific builtins to access the vector > versions of some of these operations (to implement vectorized versions > of library math routines) and to access the frexp operations. > > Okay for trunk? LGTM. I'm assuming you've checked the maths. :) Andrew