Re: [PATCH] amdgcn: Add support for additional natively supported floating-point operations

2022-09-09 Thread Joseph Myers
On Thu, 8 Sep 2022, Kwok Cheung Yeung wrote: > 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 C2x has sinpi and

Re: GCN: Add -mlow-precision-sqrt for double-precision sqrt [PR105246] (was: Re: [PATCH] amdgcn: Add support for additional natively supported floating-point operations)

2022-09-09 Thread Andrew Stubbs
On 09/09/2022 13:20, Tobias Burnus wrote: However, the pre-existing 'sqrt' problem still is real. It also applies to reverse sqrt ("v_rsq"), but that's for whatever reason not used for GCN. This patch now adds a commandline flag - off by default - to choose whether this behavior is wanted. I

RE: [PATCH] amdgcn: Add support for additional natively supported floating-point operations

2022-09-09 Thread Stubbs, Andrew
> -Original Message- > I agree - for example powerpc has -mrecip= to control which instructions > to use (float/double rsqrt or inverse) and -mrecip-precision to > specify whether further iteration is done or not. > > x86 has similar but does always perform newton raphson iteration, >

GCN: Add -mlow-precision-sqrt for double-precision sqrt [PR105246] (was: Re: [PATCH] amdgcn: Add support for additional natively supported floating-point operations)

2022-09-09 Thread Tobias Burnus
On 09.09.22 12:16, Richard Biener wrote: On Fri, 9 Sep 2022, Tobias Burnus wrote: -funsafe-math-optimizations implies -fno-signed-zeros, -fno-trapping-math, -fassociative-math, and -freciprocal-math. All of them reduce precision and my violate IEEE or ISO/language standards. However, I think

Re: [PATCH] amdgcn: Add support for additional natively supported floating-point operations

2022-09-09 Thread Richard Biener via Gcc-patches
On Fri, 9 Sep 2022, Tobias Burnus wrote: > On 09.09.22 10:10, Andrew Stubbs wrote: > On 08.09.22 22:38, Kwok Cheung Yeung wrote: > The instructions for the transcendental functions are documented to have > limited numerical precision, so they are only used if > unsafe_math_optimizations are

Re: [PATCH] amdgcn: Add support for additional natively supported floating-point operations

2022-09-09 Thread Tobias Burnus
On 09.09.22 10:10, Andrew Stubbs wrote: On 08.09.22 22:38, Kwok Cheung Yeung wrote: 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. -funsafe-math-optimizations implies

Re: [PATCH] amdgcn: Add support for additional natively supported floating-point operations

2022-09-09 Thread Andrew Stubbs
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

[PATCH] amdgcn: Add support for additional natively supported floating-point operations

2022-09-08 Thread Kwok Cheung Yeung
2001 From: Kwok Cheung Yeung Date: Thu, 8 Sep 2022 17:37:26 + Subject: [PATCH] amdgcn: Add support for additional natively supported floating-point operations This adds support for the following natively supported floating-point operations, in scalar and vectorized modes: floor, ceil, exp2