Skip to content

Commit

Permalink
Fixing some tests for x86 and skipping some tests on Mono
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Apr 13, 2024
1 parent bf890e4 commit 5e02846
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4875,6 +4875,7 @@ public void Log2SingleTest(float value, float expectedResult, float variance)
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32Test()
{
Assert.Equal(Vector128.Create(int.MinValue), Vector128.ConvertToInt32(Vector128.Create(float.MinValue)));
Expand All @@ -4883,6 +4884,7 @@ public void ConvertToInt32Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Sse2.IsSupported)
Expand All @@ -4898,6 +4900,7 @@ public void ConvertToInt32NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64Test()
{
Assert.Equal(Vector128.Create(long.MinValue), Vector128.ConvertToInt64(Vector128.Create(double.MinValue)));
Expand All @@ -4906,6 +4909,7 @@ public void ConvertToInt64Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
Expand All @@ -4922,6 +4926,7 @@ public void ConvertToInt64NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32Test()
{
Assert.Equal(Vector128.Create(uint.MinValue), Vector128.ConvertToUInt32(Vector128.Create(float.MinValue)));
Expand All @@ -4930,6 +4935,7 @@ public void ConvertToUInt32Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512F.VL.IsSupported)
Expand All @@ -4946,6 +4952,7 @@ public void ConvertToUInt32NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64Test()
{
Assert.Equal(Vector128.Create(ulong.MinValue), Vector128.ConvertToUInt64(Vector128.Create(double.MinValue)));
Expand All @@ -4954,6 +4961,7 @@ public void ConvertToUInt64Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5890,6 +5890,7 @@ public void Log2SingleTest(float value, float expectedResult, float variance)
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32Test()
{
Assert.Equal(Vector256.Create(int.MinValue), Vector256.ConvertToInt32(Vector256.Create(float.MinValue)));
Expand All @@ -5898,6 +5899,7 @@ public void ConvertToInt32Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Sse2.IsSupported)
Expand All @@ -5913,6 +5915,7 @@ public void ConvertToInt32NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64Test()
{
Assert.Equal(Vector256.Create(long.MinValue), Vector256.ConvertToInt64(Vector256.Create(double.MinValue)));
Expand All @@ -5921,6 +5924,7 @@ public void ConvertToInt64Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
Expand All @@ -5937,6 +5941,7 @@ public void ConvertToInt64NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32Test()
{
Assert.Equal(Vector256.Create(uint.MinValue), Vector256.ConvertToUInt32(Vector256.Create(float.MinValue)));
Expand All @@ -5945,6 +5950,7 @@ public void ConvertToUInt32Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512F.VL.IsSupported)
Expand All @@ -5961,6 +5967,7 @@ public void ConvertToUInt32NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64Test()
{
Assert.Equal(Vector256.Create(ulong.MinValue), Vector256.ConvertToUInt64(Vector256.Create(double.MinValue)));
Expand All @@ -5969,6 +5976,7 @@ public void ConvertToUInt64Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5323,6 +5323,7 @@ public void Log2SingleTest(float value, float expectedResult, float variance)
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32Test()
{
Assert.Equal(Vector512.Create(int.MinValue), Vector512.ConvertToInt32(Vector512.Create(float.MinValue)));
Expand All @@ -5331,6 +5332,7 @@ public void ConvertToInt32Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Sse2.IsSupported)
Expand All @@ -5346,6 +5348,7 @@ public void ConvertToInt32NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64Test()
{
Assert.Equal(Vector512.Create(long.MinValue), Vector512.ConvertToInt64(Vector512.Create(double.MinValue)));
Expand All @@ -5354,6 +5357,7 @@ public void ConvertToInt64Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
Expand All @@ -5370,6 +5374,7 @@ public void ConvertToInt64NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32Test()
{
Assert.Equal(Vector512.Create(uint.MinValue), Vector512.ConvertToUInt32(Vector512.Create(float.MinValue)));
Expand All @@ -5378,6 +5383,7 @@ public void ConvertToUInt32Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512F.VL.IsSupported)
Expand All @@ -5394,6 +5400,7 @@ public void ConvertToUInt32NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64Test()
{
Assert.Equal(Vector512.Create(ulong.MinValue), Vector512.ConvertToUInt64(Vector512.Create(double.MinValue)));
Expand All @@ -5402,6 +5409,7 @@ public void ConvertToUInt64Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64NativeTest()
{
if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4290,6 +4290,7 @@ public void Log2SingleTest(float value, float expectedResult, float variance)
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32Test()
{
Assert.Equal(Vector64.Create(int.MinValue), Vector64.ConvertToInt32(Vector64.Create(float.MinValue)));
Expand All @@ -4298,6 +4299,7 @@ public void ConvertToInt32Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt32NativeTest()
{
Assert.Equal(Vector64.Create(int.MinValue), Vector64.ConvertToInt32Native(Vector64.Create(float.MinValue)));
Expand All @@ -4306,6 +4308,7 @@ public void ConvertToInt32NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64Test()
{
Assert.Equal(Vector64.Create(long.MinValue), Vector64.ConvertToInt64(Vector64.Create(double.MinValue)));
Expand All @@ -4314,6 +4317,7 @@ public void ConvertToInt64Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToInt64NativeTest()
{
Assert.Equal(Vector64.Create(long.MinValue), Vector64.ConvertToInt64Native(Vector64.Create(double.MinValue)));
Expand All @@ -4322,6 +4326,7 @@ public void ConvertToInt64NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32Test()
{
Assert.Equal(Vector64.Create(uint.MinValue), Vector64.ConvertToUInt32(Vector64.Create(float.MinValue)));
Expand All @@ -4330,6 +4335,7 @@ public void ConvertToUInt32Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt32NativeTest()
{
Assert.Equal(Vector64.Create(uint.MinValue), Vector64.ConvertToUInt32Native(Vector64.Create(float.MinValue)));
Expand All @@ -4338,6 +4344,7 @@ public void ConvertToUInt32NativeTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64Test()
{
Assert.Equal(Vector64.Create(ulong.MinValue), Vector64.ConvertToUInt64(Vector64.Create(double.MinValue)));
Expand All @@ -4346,6 +4353,7 @@ public void ConvertToUInt64Test()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public void ConvertToUInt64NativeTest()
{
Assert.Equal(Vector64.Create(ulong.MinValue), Vector64.ConvertToUInt64Native(Vector64.Create(double.MinValue)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ public static void op_InequalityTest()
//

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public static void ConvertToIntegerTest()
{
// Signed Values
Expand Down Expand Up @@ -408,39 +409,17 @@ public static void ConvertToIntegerTest()
}

[Fact]
[SkipOnMono("https://github.com/dotnet/runtime/issues/100368")]
public static void ConvertToIntegerNativeTest()
{
// Signed Values

if (Sse2.IsSupported)
{
// On Xarch:
// * Conversion to int is natively supported and returns 0x8000_0000
// * Conversion to long is natively supported on 64-bit and returns 0x8000_0000_0000_0000

Assert.Equal(0, FloatingPointHelper<double>.ConvertToIntegerNative<short>(double.MinValue));
Assert.Equal(int.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<int>(double.MinValue));
Assert.Equal(nint.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<nint>(double.MinValue));
Assert.Equal(0, FloatingPointHelper<double>.ConvertToIntegerNative<sbyte>(double.MinValue));

if (Environment.Is64BitProcess)
{
Assert.Equal(long.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<long>(double.MinValue));
}
else
{
Assert.Equal(0, FloatingPointHelper<double>.ConvertToIntegerNative<long>(double.MinValue));
}
}
else
{
Assert.Equal(short.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<short>(double.MinValue));
Assert.Equal(int.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<int>(double.MinValue));
Assert.Equal(long.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<long>(double.MinValue));
Assert.Equal(nint.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<nint>(double.MinValue));
Assert.Equal(sbyte.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<sbyte>(double.MinValue));
}
Assert.Equal(0, FloatingPointHelper<double>.ConvertToIntegerNative<short>(double.MinValue));
Assert.Equal(int.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<int>(double.MinValue));
Assert.Equal(long.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<long>(double.MinValue));
Assert.Equal(Int128.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<Int128>(double.MinValue));
Assert.Equal(nint.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<nint>(double.MinValue));
Assert.Equal(0, FloatingPointHelper<double>.ConvertToIntegerNative<sbyte>(double.MinValue));

Assert.Equal(2, FloatingPointHelper<double>.ConvertToIntegerNative<short>(2.6));
Assert.Equal(2, FloatingPointHelper<double>.ConvertToIntegerNative<int>(2.6));
Expand All @@ -456,19 +435,26 @@ public static void ConvertToIntegerNativeTest()
// * Conversion to long is natively supported on 64-bit and returns 0x8000_0000_0000_0000

Assert.Equal(0, FloatingPointHelper<double>.ConvertToIntegerNative<short>(double.MaxValue));
Assert.Equal(0, FloatingPointHelper<double>.ConvertToIntegerNative<sbyte>(double.MaxValue));

Assert.Equal(int.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<int>(double.MaxValue));
Assert.Equal(long.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<long>(double.MaxValue));
Assert.Equal(nint.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<nint>(double.MaxValue));
Assert.Equal(0, FloatingPointHelper<double>.ConvertToIntegerNative<sbyte>(double.MaxValue));

if (Environment.Is64BitProcess)
{
Assert.Equal(long.MinValue, FloatingPointHelper<double>.ConvertToIntegerNative<long>(double.MaxValue));
}
else
{
Assert.Equal(long.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<long>(double.MaxValue));
}
}
else
{
Assert.Equal(short.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<short>(double.MaxValue));
Assert.Equal(-1, FloatingPointHelper<double>.ConvertToIntegerNative<short>(double.MaxValue));
Assert.Equal(int.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<int>(double.MaxValue));
Assert.Equal(long.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<long>(double.MaxValue));
Assert.Equal(nint.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<nint>(double.MaxValue));
Assert.Equal(sbyte.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<sbyte>(double.MaxValue));
Assert.Equal(-1, FloatingPointHelper<double>.ConvertToIntegerNative<sbyte>(double.MaxValue));
}
Assert.Equal(Int128.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<Int128>(double.MaxValue));

Expand Down Expand Up @@ -529,12 +515,12 @@ public static void ConvertToIntegerNativeTest()
else
{
Assert.Equal(byte.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<byte>(double.MaxValue));
Assert.Equal(nuint.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<nuint>(double.MaxValue));
Assert.Equal(ushort.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<ushort>(double.MaxValue));
}
Assert.Equal(uint.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<uint>(double.MaxValue));
Assert.Equal(ulong.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<ulong>(double.MaxValue));
Assert.Equal(UInt128.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<UInt128>(double.MaxValue));
Assert.Equal(nuint.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<ulong>(double.MaxValue));
Assert.Equal(nuint.MaxValue, FloatingPointHelper<double>.ConvertToIntegerNative<nuint>(double.MaxValue));
}

[Fact]
Expand Down Expand Up @@ -1236,7 +1222,7 @@ public static void CreateCheckedFromDecimalTest()
AssertBitwiseEqual(-0.0, NumberBaseHelper<double>.CreateChecked<decimal>(-0.0m));
AssertBitwiseEqual(+0.0, NumberBaseHelper<double>.CreateChecked<decimal>(+0.0m));
AssertBitwiseEqual(+1.0, NumberBaseHelper<double>.CreateChecked<decimal>(+1.0m));
AssertBitwiseEqual(+79228162514264337593543950335.0, NumberBaseHelper<double>.CreateChecked<decimal>(decimal.MaxValue));
AssertBitwiseEqual(+79228162514264337593543950335.0, NumberBaseHelper<double>.CreateChecked<decimal>(decimal.MaxValue));
}

[Fact]
Expand Down
Loading

0 comments on commit 5e02846

Please sign in to comment.