Skip to content

Commit 67a391b

Browse files
committed
Fix the RV64 and LA64 builds
1 parent 30dc925 commit 67a391b

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

src/libraries/System.Private.CoreLib/src/System/Math.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,15 +1195,12 @@ public static double MinMagnitude(double x, double y)
11951195
/// <para>On ARM64 hardware this may use the <c>FRECPE</c> instruction which performs a single Newton-Raphson iteration.</para>
11961196
/// <para>On hardware without specialized support, this may just return <c>1.0 / d</c>.</para>
11971197
/// </remarks>
1198-
[Intrinsic]
1199-
public static double ReciprocalEstimate(double d)
1200-
{
12011198
#if MONO
1202-
return 1.0 / d;
1199+
public static double ReciprocalEstimate(double d) => 1.0 / d;
12031200
#else
1204-
return ReciprocalEstimate(d);
1201+
[Intrinsic]
1202+
public static double ReciprocalEstimate(double d) => ReciprocalEstimate(d);
12051203
#endif
1206-
}
12071204

12081205
/// <summary>Returns an estimate of the reciprocal square root of a specified number.</summary>
12091206
/// <param name="d">The number whose reciprocal square root is to be estimated.</param>
@@ -1212,15 +1209,12 @@ public static double ReciprocalEstimate(double d)
12121209
/// <para>On ARM64 hardware this may use the <c>FRSQRTE</c> instruction which performs a single Newton-Raphson iteration.</para>
12131210
/// <para>On hardware without specialized support, this may just return <c>1.0 / Sqrt(d)</c>.</para>
12141211
/// </remarks>
1215-
[Intrinsic]
1216-
public static double ReciprocalSqrtEstimate(double d)
1217-
{
1218-
#if MONO
1219-
return 1.0 / Sqrt(d);
1212+
#if MONO || TARGET_RISCV64 || TARGET_LOONGARCH64
1213+
public static double ReciprocalSqrtEstimate(double d) => 1.0 / Sqrt(d);
12201214
#else
1221-
return ReciprocalSqrtEstimate(d);
1215+
[Intrinsic]
1216+
public static double ReciprocalSqrtEstimate(double d) => ReciprocalSqrtEstimate(d);
12221217
#endif
1223-
}
12241218

12251219
[MethodImpl(MethodImplOptions.AggressiveInlining)]
12261220
public static decimal Round(decimal d)

src/libraries/System.Private.CoreLib/src/System/MathF.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,12 @@ public static float MinMagnitude(float x, float y)
313313
/// <para>On ARM64 hardware this may use the <c>FRECPE</c> instruction which performs a single Newton-Raphson iteration.</para>
314314
/// <para>On hardware without specialized support, this may just return <c>1.0 / x</c>.</para>
315315
/// </remarks>
316-
[Intrinsic]
317-
public static float ReciprocalEstimate(float x)
318-
{
319316
#if MONO
320-
return 1.0f / x;
317+
public static float ReciprocalEstimate(float x) => 1.0f / x;
321318
#else
322-
return ReciprocalEstimate(x);
319+
[Intrinsic]
320+
public static float ReciprocalEstimate(float x) => ReciprocalEstimate(x);
323321
#endif
324-
}
325322

326323
/// <summary>Returns an estimate of the reciprocal square root of a specified number.</summary>
327324
/// <param name="x">The number whose reciprocal square root is to be estimated.</param>
@@ -331,15 +328,12 @@ public static float ReciprocalEstimate(float x)
331328
/// <para>On ARM64 hardware this may use the <c>FRSQRTE</c> instruction which performs a single Newton-Raphson iteration.</para>
332329
/// <para>On hardware without specialized support, this may just return <c>1.0 / Sqrt(x)</c>.</para>
333330
/// </remarks>
334-
[Intrinsic]
335-
public static float ReciprocalSqrtEstimate(float x)
336-
{
337-
#if MONO
338-
return 1.0f / Sqrt(x);
331+
#if MONO || TARGET_RISCV64 || TARGET_LOONGARCH64
332+
public static float ReciprocalSqrtEstimate(float x) => 1.0f / Sqrt(x);
339333
#else
340-
return ReciprocalSqrtEstimate(x);
334+
[Intrinsic]
335+
public static float ReciprocalSqrtEstimate(float x) => ReciprocalSqrtEstimate(x);
341336
#endif
342-
}
343337

344338
[Intrinsic]
345339
public static float Round(float x)

0 commit comments

Comments
 (0)