Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b2d559e
Change the ReciprocalEstimate and ReciprocalSqrtEstimate APIs to be m…
tannergooding May 10, 2024
30dc925
Apply formatting patch
tannergooding May 10, 2024
67a391b
Fix the RV64 and LA64 builds
tannergooding May 10, 2024
42a1dd5
Mark the ReciprocalEstimate and ReciprocalSqrtEstimate methods as Agg…
tannergooding May 11, 2024
f177bd2
Mark other usages of ReciprocalEstimate and ReciprocalSqrtEstimate in…
tannergooding May 11, 2024
62933bc
Mark several non-deterministic APIs as BypassReadyToRun and skip intr…
tannergooding May 11, 2024
afdcb1b
Cleanup based on PR recommendations to rely on the runtime rather tha…
tannergooding May 11, 2024
91d105c
Adding a regression test ensuring direct and indirect invocation of n…
tannergooding May 11, 2024
ed406bf
Add a note about non-deterministic intrinsic expansion to the botr
tannergooding May 11, 2024
1b16a09
Apply formatting patch
tannergooding May 11, 2024
1000066
Merge branch 'main' into fix-101731
tannergooding May 12, 2024
0312112
Ensure vector tests are correctly validating against the scalar imple…
tannergooding May 12, 2024
461c4b5
Fix the JIT/SIMD/VectorConvert test and workaround a 32-bit test issue
tannergooding May 12, 2024
9983d9d
Skip a test on Mono due to a known/tracked issue
tannergooding May 12, 2024
5bddfc1
Ensure that lowering on Arm64 doesn't make an assumption about cast s…
tannergooding May 12, 2024
1e0879f
Ensure the tier0opts local is used
tannergooding May 13, 2024
f63c575
Ensure impEstimateIntrinsic bails out for APIs that need to be implem…
tannergooding May 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ensure vector tests are correctly validating against the scalar imple…
…mentation
  • Loading branch information
tannergooding committed May 12, 2024
commit 0312112562a8342742fdfe3a3d0180e21c131702
Original file line number Diff line number Diff line change
Expand Up @@ -3164,7 +3164,7 @@ public void ConvertSingleToInt32()
Vector<int> targetVec = Vector.ConvertToInt32(sourceVec);
for (int i = 0; i < Vector<int>.Count; i++)
{
Assert.Equal(unchecked((int)source[i]), targetVec[i]);
Assert.Equal(float.ConvertToInteger<int>(source[i]), targetVec[i]);
}
}

Expand All @@ -3176,7 +3176,7 @@ public void ConvertSingleToUInt32()
Vector<uint> targetVec = Vector.ConvertToUInt32(sourceVec);
for (int i = 0; i < Vector<uint>.Count; i++)
{
Assert.Equal(unchecked((uint)source[i]), targetVec[i]);
Assert.Equal(float.ConvertToInteger<uint>(source[i]), targetVec[i]);
}
}

Expand All @@ -3188,7 +3188,7 @@ public void ConvertDoubleToInt64()
Vector<long> targetVec = Vector.ConvertToInt64(sourceVec);
for (int i = 0; i < Vector<long>.Count; i++)
{
Assert.Equal(unchecked((long)source[i]), targetVec[i]);
Assert.Equal(double.ConvertToInteger<long>(source[i]), targetVec[i]);
}
}

Expand All @@ -3200,7 +3200,7 @@ public void ConvertDoubleToUInt64()
Vector<ulong> targetVec = Vector.ConvertToUInt64(sourceVec);
for (int i = 0; i < Vector<ulong>.Count; i++)
{
Assert.Equal(unchecked((ulong)source[i]), targetVec[i]);
Assert.Equal(double.ConvertToInteger<ulong>(source[i]), targetVec[i]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4878,103 +4878,72 @@ public void Log2SingleTest(float value, float expectedResult, float variance)
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32Test()
{
Assert.Equal(Vector128.Create(int.MinValue), Vector128.ConvertToInt32(Vector128.Create(float.MinValue)));
Assert.Equal(Vector128.Create(2), Vector128.ConvertToInt32(Vector128.Create(2.6f)));
Assert.Equal(Vector128.Create(int.MaxValue), Vector128.ConvertToInt32(Vector128.Create(float.MaxValue)));
Assert.Equal(Vector128.Create(float.ConvertToInteger<int>(float.MinValue)), Vector128.ConvertToInt32(Vector128.Create(float.MinValue)));
Assert.Equal(Vector128.Create(float.ConvertToInteger<int>(2.6f)), Vector128.ConvertToInt32(Vector128.Create(2.6f)));
Assert.Equal(Vector128.Create(float.ConvertToInteger<int>(float.MaxValue)), Vector128.ConvertToInt32(Vector128.Create(float.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Sse2.IsSupported)
{
Assert.Equal(Vector128.Create(int.MinValue), Vector128.ConvertToInt32Native(Vector128.Create(float.MaxValue)));
}
else
{
Assert.Equal(Vector128.Create(int.MaxValue), Vector128.ConvertToInt32Native(Vector128.Create(float.MaxValue)));
}
Assert.Equal(Vector128.Create(int.MinValue), Vector128.ConvertToInt32Native(Vector128.Create(float.MinValue)));
Assert.Equal(Vector128.Create(2), Vector128.ConvertToInt32Native(Vector128.Create(2.6f)));
Assert.Equal(Vector128.Create(float.ConvertToIntegerNative<int>(float.MinValue)), Vector128.ConvertToInt32Native(Vector128.Create(float.MinValue)));
Assert.Equal(Vector128.Create(float.ConvertToIntegerNative<int>(2.6f)), Vector128.ConvertToInt32Native(Vector128.Create(2.6f)));
Assert.Equal(Vector128.Create(float.ConvertToIntegerNative<int>(float.MaxValue)), Vector128.ConvertToInt32Native(Vector128.Create(float.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64Test()
{
Assert.Equal(Vector128.Create(long.MinValue), Vector128.ConvertToInt64(Vector128.Create(double.MinValue)));
Assert.Equal(Vector128.Create(2L), Vector128.ConvertToInt64(Vector128.Create(2.6)));
Assert.Equal(Vector128.Create(long.MaxValue), Vector128.ConvertToInt64(Vector128.Create(double.MaxValue)));
Assert.Equal(Vector128.Create(double.ConvertToInteger<long>(double.MinValue)), Vector128.ConvertToInt64(Vector128.Create(double.MinValue)));
Assert.Equal(Vector128.Create(double.ConvertToInteger<long>(2.6)), Vector128.ConvertToInt64(Vector128.Create(2.6)));
Assert.Equal(Vector128.Create(double.ConvertToInteger<long>(double.MaxValue)), Vector128.ConvertToInt64(Vector128.Create(double.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
{
Assert.Equal(Vector128.Create(long.MinValue), Vector128.ConvertToInt64Native(Vector128.Create(double.MaxValue)));
}
else
{
Assert.Equal(Vector128.Create(long.MaxValue), Vector128.ConvertToInt64Native(Vector128.Create(double.MaxValue)));
}

Assert.Equal(Vector128.Create(long.MinValue), Vector128.ConvertToInt64Native(Vector128.Create(double.MinValue)));
Assert.Equal(Vector128.Create(2L), Vector128.ConvertToInt64Native(Vector128.Create(2.6)));
Assert.Equal(Vector128.Create(double.ConvertToIntegerNative<long>(double.MinValue)), Vector128.ConvertToInt64Native(Vector128.Create(double.MinValue)));
Assert.Equal(Vector128.Create(double.ConvertToIntegerNative<long>(2.6)), Vector128.ConvertToInt64Native(Vector128.Create(2.6)));
Assert.Equal(Vector128.Create(double.ConvertToIntegerNative<long>(double.MaxValue)), Vector128.ConvertToInt64Native(Vector128.Create(double.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32Test()
{
Assert.Equal(Vector128.Create(uint.MinValue), Vector128.ConvertToUInt32(Vector128.Create(float.MinValue)));
Assert.Equal(Vector128.Create(2u), Vector128.ConvertToUInt32(Vector128.Create(2.6f)));
Assert.Equal(Vector128.Create(uint.MaxValue), Vector128.ConvertToUInt32(Vector128.Create(float.MaxValue)));
Assert.Equal(Vector128.Create(float.ConvertToInteger<uint>(float.MinValue)), Vector128.ConvertToUInt32(Vector128.Create(float.MinValue)));
Assert.Equal(Vector128.Create(float.ConvertToInteger<uint>(2.6f)), Vector128.ConvertToUInt32(Vector128.Create(2.6f)));
Assert.Equal(Vector128.Create(float.ConvertToInteger<uint>(float.MaxValue)), Vector128.ConvertToUInt32(Vector128.Create(float.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512F.VL.IsSupported)
{
Assert.Equal(Vector128.Create(uint.MaxValue), Vector128.ConvertToUInt32Native(Vector128.Create(float.MinValue)));
}
else
{
Assert.Equal(Vector128.Create(uint.MinValue), Vector128.ConvertToUInt32Native(Vector128.Create(float.MinValue)));
}

Assert.Equal(Vector128.Create(2u), Vector128.ConvertToUInt32Native(Vector128.Create(2.6f)));
Assert.Equal(Vector128.Create(uint.MaxValue), Vector128.ConvertToUInt32Native(Vector128.Create(float.MaxValue)));
Assert.Equal(Vector128.Create(float.ConvertToIntegerNative<uint>(float.MinValue)), Vector128.ConvertToUInt32Native(Vector128.Create(float.MinValue)));
Assert.Equal(Vector128.Create(float.ConvertToIntegerNative<uint>(2.6f)), Vector128.ConvertToUInt32Native(Vector128.Create(2.6f)));
Assert.Equal(Vector128.Create(float.ConvertToIntegerNative<uint>(float.MaxValue)), Vector128.ConvertToUInt32Native(Vector128.Create(float.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64Test()
{
Assert.Equal(Vector128.Create(ulong.MinValue), Vector128.ConvertToUInt64(Vector128.Create(double.MinValue)));
Assert.Equal(Vector128.Create(2UL), Vector128.ConvertToUInt64(Vector128.Create(2.6)));
Assert.Equal(Vector128.Create(ulong.MaxValue), Vector128.ConvertToUInt64(Vector128.Create(double.MaxValue)));
Assert.Equal(Vector128.Create(double.ConvertToInteger<ulong>(double.MinValue)), Vector128.ConvertToUInt64(Vector128.Create(double.MinValue)));
Assert.Equal(Vector128.Create(double.ConvertToInteger<ulong>(2.6)), Vector128.ConvertToUInt64(Vector128.Create(2.6)));
Assert.Equal(Vector128.Create(double.ConvertToInteger<ulong>(double.MaxValue)), Vector128.ConvertToUInt64(Vector128.Create(double.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
{
Assert.Equal(Vector128.Create(ulong.MaxValue), Vector128.ConvertToUInt64Native(Vector128.Create(double.MinValue)));
}
else
{
Assert.Equal(Vector128.Create(ulong.MinValue), Vector128.ConvertToUInt64Native(Vector128.Create(double.MinValue)));
}

Assert.Equal(Vector128.Create(2UL), Vector128.ConvertToUInt64Native(Vector128.Create(2.6)));
Assert.Equal(Vector128.Create(ulong.MaxValue), Vector128.ConvertToUInt64Native(Vector128.Create(double.MaxValue)));
Assert.Equal(Vector128.Create(double.ConvertToIntegerNative<ulong>(double.MinValue)), Vector128.ConvertToUInt64Native(Vector128.Create(double.MinValue)));
Assert.Equal(Vector128.Create(double.ConvertToIntegerNative<ulong>(2.6)), Vector128.ConvertToUInt64Native(Vector128.Create(2.6)));
Assert.Equal(Vector128.Create(double.ConvertToIntegerNative<ulong>(double.MaxValue)), Vector128.ConvertToUInt64Native(Vector128.Create(double.MaxValue)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5893,103 +5893,72 @@ public void Log2SingleTest(float value, float expectedResult, float variance)
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32Test()
{
Assert.Equal(Vector256.Create(int.MinValue), Vector256.ConvertToInt32(Vector256.Create(float.MinValue)));
Assert.Equal(Vector256.Create(2), Vector256.ConvertToInt32(Vector256.Create(2.6f)));
Assert.Equal(Vector256.Create(int.MaxValue), Vector256.ConvertToInt32(Vector256.Create(float.MaxValue)));
Assert.Equal(Vector256.Create(float.ConvertToInteger<int>(float.MinValue)), Vector256.ConvertToInt32(Vector256.Create(float.MinValue)));
Assert.Equal(Vector256.Create(float.ConvertToInteger<int>(2.6f)), Vector256.ConvertToInt32(Vector256.Create(2.6f)));
Assert.Equal(Vector256.Create(float.ConvertToInteger<int>(float.MaxValue)), Vector256.ConvertToInt32(Vector256.Create(float.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Sse2.IsSupported)
{
Assert.Equal(Vector256.Create(int.MinValue), Vector256.ConvertToInt32Native(Vector256.Create(float.MaxValue)));
}
else
{
Assert.Equal(Vector256.Create(int.MaxValue), Vector256.ConvertToInt32Native(Vector256.Create(float.MaxValue)));
}
Assert.Equal(Vector256.Create(int.MinValue), Vector256.ConvertToInt32Native(Vector256.Create(float.MinValue)));
Assert.Equal(Vector256.Create(2), Vector256.ConvertToInt32Native(Vector256.Create(2.6f)));
Assert.Equal(Vector256.Create(float.ConvertToIntegerNative<int>(float.MinValue)), Vector256.ConvertToInt32Native(Vector256.Create(float.MinValue)));
Assert.Equal(Vector256.Create(float.ConvertToIntegerNative<int>(2.6f)), Vector256.ConvertToInt32Native(Vector256.Create(2.6f)));
Assert.Equal(Vector256.Create(float.ConvertToIntegerNative<int>(float.MaxValue)), Vector256.ConvertToInt32Native(Vector256.Create(float.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64Test()
{
Assert.Equal(Vector256.Create(long.MinValue), Vector256.ConvertToInt64(Vector256.Create(double.MinValue)));
Assert.Equal(Vector256.Create(2L), Vector256.ConvertToInt64(Vector256.Create(2.6)));
Assert.Equal(Vector256.Create(long.MaxValue), Vector256.ConvertToInt64(Vector256.Create(double.MaxValue)));
Assert.Equal(Vector256.Create(double.ConvertToInteger<long>(double.MinValue)), Vector256.ConvertToInt64(Vector256.Create(double.MinValue)));
Assert.Equal(Vector256.Create(double.ConvertToInteger<long>(2.6)), Vector256.ConvertToInt64(Vector256.Create(2.6)));
Assert.Equal(Vector256.Create(double.ConvertToInteger<long>(double.MaxValue)), Vector256.ConvertToInt64(Vector256.Create(double.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
{
Assert.Equal(Vector256.Create(long.MinValue), Vector256.ConvertToInt64Native(Vector256.Create(double.MaxValue)));
}
else
{
Assert.Equal(Vector256.Create(long.MaxValue), Vector256.ConvertToInt64Native(Vector256.Create(double.MaxValue)));
}

Assert.Equal(Vector256.Create(long.MinValue), Vector256.ConvertToInt64Native(Vector256.Create(double.MinValue)));
Assert.Equal(Vector256.Create(2L), Vector256.ConvertToInt64Native(Vector256.Create(2.6)));
Assert.Equal(Vector256.Create(double.ConvertToIntegerNative<long>(double.MinValue)), Vector256.ConvertToInt64Native(Vector256.Create(double.MinValue)));
Assert.Equal(Vector256.Create(double.ConvertToIntegerNative<long>(2.6)), Vector256.ConvertToInt64Native(Vector256.Create(2.6)));
Assert.Equal(Vector256.Create(double.ConvertToIntegerNative<long>(double.MaxValue)), Vector256.ConvertToInt64Native(Vector256.Create(double.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32Test()
{
Assert.Equal(Vector256.Create(uint.MinValue), Vector256.ConvertToUInt32(Vector256.Create(float.MinValue)));
Assert.Equal(Vector256.Create(2u), Vector256.ConvertToUInt32(Vector256.Create(2.6f)));
Assert.Equal(Vector256.Create(uint.MaxValue), Vector256.ConvertToUInt32(Vector256.Create(float.MaxValue)));
Assert.Equal(Vector256.Create(float.ConvertToInteger<uint>(float.MinValue)), Vector256.ConvertToUInt32(Vector256.Create(float.MinValue)));
Assert.Equal(Vector256.Create(float.ConvertToInteger<uint>(2.6f)), Vector256.ConvertToUInt32(Vector256.Create(2.6f)));
Assert.Equal(Vector256.Create(float.ConvertToInteger<uint>(float.MaxValue)), Vector256.ConvertToUInt32(Vector256.Create(float.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512F.VL.IsSupported)
{
Assert.Equal(Vector256.Create(uint.MaxValue), Vector256.ConvertToUInt32Native(Vector256.Create(float.MinValue)));
}
else
{
Assert.Equal(Vector256.Create(uint.MinValue), Vector256.ConvertToUInt32Native(Vector256.Create(float.MinValue)));
}

Assert.Equal(Vector256.Create(2u), Vector256.ConvertToUInt32Native(Vector256.Create(2.6f)));
Assert.Equal(Vector256.Create(uint.MaxValue), Vector256.ConvertToUInt32Native(Vector256.Create(float.MaxValue)));
Assert.Equal(Vector256.Create(float.ConvertToIntegerNative<uint>(float.MinValue)), Vector256.ConvertToUInt32Native(Vector256.Create(float.MinValue)));
Assert.Equal(Vector256.Create(float.ConvertToIntegerNative<uint>(2.6f)), Vector256.ConvertToUInt32Native(Vector256.Create(2.6f)));
Assert.Equal(Vector256.Create(float.ConvertToIntegerNative<uint>(float.MaxValue)), Vector256.ConvertToUInt32Native(Vector256.Create(float.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64Test()
{
Assert.Equal(Vector256.Create(ulong.MinValue), Vector256.ConvertToUInt64(Vector256.Create(double.MinValue)));
Assert.Equal(Vector256.Create(2UL), Vector256.ConvertToUInt64(Vector256.Create(2.6)));
Assert.Equal(Vector256.Create(ulong.MaxValue), Vector256.ConvertToUInt64(Vector256.Create(double.MaxValue)));
Assert.Equal(Vector256.Create(double.ConvertToInteger<ulong>(double.MinValue)), Vector256.ConvertToUInt64(Vector256.Create(double.MinValue)));
Assert.Equal(Vector256.Create(double.ConvertToInteger<ulong>(2.6)), Vector256.ConvertToUInt64(Vector256.Create(2.6)));
Assert.Equal(Vector256.Create(double.ConvertToInteger<ulong>(double.MaxValue)), Vector256.ConvertToUInt64(Vector256.Create(double.MaxValue)));
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
{
Assert.Equal(Vector256.Create(ulong.MaxValue), Vector256.ConvertToUInt64Native(Vector256.Create(double.MinValue)));
}
else
{
Assert.Equal(Vector256.Create(ulong.MinValue), Vector256.ConvertToUInt64Native(Vector256.Create(double.MinValue)));
}

Assert.Equal(Vector256.Create(2UL), Vector256.ConvertToUInt64Native(Vector256.Create(2.6)));
Assert.Equal(Vector256.Create(ulong.MaxValue), Vector256.ConvertToUInt64Native(Vector256.Create(double.MaxValue)));
Assert.Equal(Vector256.Create(double.ConvertToIntegerNative<ulong>(double.MinValue)), Vector256.ConvertToUInt64Native(Vector256.Create(double.MinValue)));
Assert.Equal(Vector256.Create(double.ConvertToIntegerNative<ulong>(2.6)), Vector256.ConvertToUInt64Native(Vector256.Create(2.6)));
Assert.Equal(Vector256.Create(double.ConvertToIntegerNative<ulong>(double.MaxValue)), Vector256.ConvertToUInt64Native(Vector256.Create(double.MaxValue)));
}
}
}
Loading