Use more accurate ReciprocalSqrt when available
Utilizes the AVX512 variant of `ReciprocalSqrt`([vrsqrt14ps](https://www.felixcloutier.com/x86/vrsqrt14ps)) that is accurate up to 14 bits of precision(rather than 12) when the host supports it.
This commit is contained in:
@@ -114,6 +114,11 @@ internal static class Intrinsics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vector256<float> ReciprocalSqrt(Vector256<float> data)
|
||||
{
|
||||
// Accurate to 14 bits
|
||||
if (Avx512F.VL.IsSupported)
|
||||
return Avx512F.VL.ReciprocalSqrt14(data);
|
||||
|
||||
// Accurate to 12 bits
|
||||
if (Avx.IsSupported)
|
||||
return Avx.ReciprocalSqrt(data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user