From 67a391b18389a23b42e941c83a2e792c419ba77c Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 10 May 2024 14:29:20 -0700 Subject: [PATCH] Fix the RV64 and LA64 builds --- .../System.Private.CoreLib/src/System/Math.cs | 20 +++++++------------ .../src/System/MathF.cs | 20 +++++++------------ 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Math.cs b/src/libraries/System.Private.CoreLib/src/System/Math.cs index 5b26cd7098158..51a7fbfc0256c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Math.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Math.cs @@ -1195,15 +1195,12 @@ public static double MinMagnitude(double x, double y) /// On ARM64 hardware this may use the FRECPE instruction which performs a single Newton-Raphson iteration. /// On hardware without specialized support, this may just return 1.0 / d. /// - [Intrinsic] - public static double ReciprocalEstimate(double d) - { #if MONO - return 1.0 / d; + public static double ReciprocalEstimate(double d) => 1.0 / d; #else - return ReciprocalEstimate(d); + [Intrinsic] + public static double ReciprocalEstimate(double d) => ReciprocalEstimate(d); #endif - } /// Returns an estimate of the reciprocal square root of a specified number. /// The number whose reciprocal square root is to be estimated. @@ -1212,15 +1209,12 @@ public static double ReciprocalEstimate(double d) /// On ARM64 hardware this may use the FRSQRTE instruction which performs a single Newton-Raphson iteration. /// On hardware without specialized support, this may just return 1.0 / Sqrt(d). /// - [Intrinsic] - public static double ReciprocalSqrtEstimate(double d) - { -#if MONO - return 1.0 / Sqrt(d); +#if MONO || TARGET_RISCV64 || TARGET_LOONGARCH64 + public static double ReciprocalSqrtEstimate(double d) => 1.0 / Sqrt(d); #else - return ReciprocalSqrtEstimate(d); + [Intrinsic] + public static double ReciprocalSqrtEstimate(double d) => ReciprocalSqrtEstimate(d); #endif - } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static decimal Round(decimal d) diff --git a/src/libraries/System.Private.CoreLib/src/System/MathF.cs b/src/libraries/System.Private.CoreLib/src/System/MathF.cs index 7ca477044d2cf..f43c1d70446a3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/MathF.cs +++ b/src/libraries/System.Private.CoreLib/src/System/MathF.cs @@ -313,15 +313,12 @@ public static float MinMagnitude(float x, float y) /// On ARM64 hardware this may use the FRECPE instruction which performs a single Newton-Raphson iteration. /// On hardware without specialized support, this may just return 1.0 / x. /// - [Intrinsic] - public static float ReciprocalEstimate(float x) - { #if MONO - return 1.0f / x; + public static float ReciprocalEstimate(float x) => 1.0f / x; #else - return ReciprocalEstimate(x); + [Intrinsic] + public static float ReciprocalEstimate(float x) => ReciprocalEstimate(x); #endif - } /// Returns an estimate of the reciprocal square root of a specified number. /// The number whose reciprocal square root is to be estimated. @@ -331,15 +328,12 @@ public static float ReciprocalEstimate(float x) /// On ARM64 hardware this may use the FRSQRTE instruction which performs a single Newton-Raphson iteration. /// On hardware without specialized support, this may just return 1.0 / Sqrt(x). /// - [Intrinsic] - public static float ReciprocalSqrtEstimate(float x) - { -#if MONO - return 1.0f / Sqrt(x); +#if MONO || TARGET_RISCV64 || TARGET_LOONGARCH64 + public static float ReciprocalSqrtEstimate(float x) => 1.0f / Sqrt(x); #else - return ReciprocalSqrtEstimate(x); + [Intrinsic] + public static float ReciprocalSqrtEstimate(float x) => ReciprocalSqrtEstimate(x); #endif - } [Intrinsic] public static float Round(float x)