aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Tests/Cpu/CpuTestSimd.cs
diff options
context:
space:
mode:
authorLDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>2019-04-12 18:14:16 +0200
committergdkchan <gab.dark.100@gmail.com>2019-04-12 13:14:16 -0300
commit233fc95e1e656f3932f57005d24b76fb750e7704 (patch)
tree7808c3bdff500a1a809cacd7e50296d06846cff5 /Ryujinx.Tests/Cpu/CpuTestSimd.cs
parentaf65ed3930294f687c6100280b650b36f888427d (diff)
Sse optimized the Vector & Scalar fp-to-integer conversion instructions (unsigned); improved the related Tests. (#656)
* Update InstEmitSimdCvt.cs * Update CpuTestSimdCvt.cs * Update CpuTestSimd.cs * Update CpuTestSimdShImm.cs * Update InstEmitSimdCvt.cs
Diffstat (limited to 'Ryujinx.Tests/Cpu/CpuTestSimd.cs')
-rw-r--r--Ryujinx.Tests/Cpu/CpuTestSimd.cs95
1 files changed, 68 insertions, 27 deletions
diff --git a/Ryujinx.Tests/Cpu/CpuTestSimd.cs b/Ryujinx.Tests/Cpu/CpuTestSimd.cs
index e409d8dd..fd395da8 100644
--- a/Ryujinx.Tests/Cpu/CpuTestSimd.cs
+++ b/Ryujinx.Tests/Cpu/CpuTestSimd.cs
@@ -2,6 +2,7 @@
using NUnit.Framework;
+using System;
using System.Collections.Generic;
using System.Runtime.Intrinsics;
@@ -172,15 +173,20 @@ namespace Ryujinx.Tests.Cpu
}
}
- private static IEnumerable<ulong> _1S_F_Cvt_()
+ private static IEnumerable<ulong> _1S_F_W_()
{
// int
- yield return 0x00000000CF000001; // -2.1474839E9f (-2147483904)
- yield return 0x00000000CF000000; // -2.14748365E9f (-2147483648)
- yield return 0x00000000CEFFFFFF; // -2.14748352E9f (-2147483520)
- yield return 0x000000004F000001; // 2.1474839E9f (2147483904)
- yield return 0x000000004F000000; // 2.14748365E9f (2147483648)
- yield return 0x000000004EFFFFFF; // 2.14748352E9f (2147483520)
+ yield return 0x00000000CF000001ul; // -2.1474839E9f (-2147483904)
+ yield return 0x00000000CF000000ul; // -2.14748365E9f (-2147483648)
+ yield return 0x00000000CEFFFFFFul; // -2.14748352E9f (-2147483520)
+ yield return 0x000000004F000001ul; // 2.1474839E9f (2147483904)
+ yield return 0x000000004F000000ul; // 2.14748365E9f (2147483648)
+ yield return 0x000000004EFFFFFFul; // 2.14748352E9f (2147483520)
+
+ // uint
+ yield return 0x000000004F800001ul; // 4.2949678E9f (4294967808)
+ yield return 0x000000004F800000ul; // 4.2949673E9f (4294967296)
+ yield return 0x000000004F7FFFFFul; // 4.29496704E9f (4294967040)
yield return 0x00000000FF7FFFFFul; // -Max Normal (float.MinValue)
yield return 0x0000000080800000ul; // -Min Normal
@@ -214,11 +220,20 @@ namespace Ryujinx.Tests.Cpu
for (int cnt = 1; cnt <= RndCnt; cnt++)
{
ulong grbg = TestContext.CurrentContext.Random.NextUInt();
- ulong rnd1 = GenNormalS();
- ulong rnd2 = GenSubnormalS();
+
+ ulong rnd1 = (uint)BitConverter.SingleToInt32Bits(
+ (float)((int)TestContext.CurrentContext.Random.NextUInt()));
+ ulong rnd2 = (uint)BitConverter.SingleToInt32Bits(
+ (float)((uint)TestContext.CurrentContext.Random.NextUInt()));
+
+ ulong rnd3 = GenNormalS();
+ ulong rnd4 = GenSubnormalS();
yield return (grbg << 32) | rnd1;
yield return (grbg << 32) | rnd2;
+
+ yield return (grbg << 32) | rnd3;
+ yield return (grbg << 32) | rnd4;
}
}
@@ -263,15 +278,20 @@ namespace Ryujinx.Tests.Cpu
}
}
- private static IEnumerable<ulong> _2S_F_Cvt_()
+ private static IEnumerable<ulong> _2S_F_W_()
{
// int
- yield return 0xCF000001CF000001; // -2.1474839E9f (-2147483904)
- yield return 0xCF000000CF000000; // -2.14748365E9f (-2147483648)
- yield return 0xCEFFFFFFCEFFFFFF; // -2.14748352E9f (-2147483520)
- yield return 0x4F0000014F000001; // 2.1474839E9f (2147483904)
- yield return 0x4F0000004F000000; // 2.14748365E9f (2147483648)
- yield return 0x4EFFFFFF4EFFFFFF; // 2.14748352E9f (2147483520)
+ yield return 0xCF000001CF000001ul; // -2.1474839E9f (-2147483904)
+ yield return 0xCF000000CF000000ul; // -2.14748365E9f (-2147483648)
+ yield return 0xCEFFFFFFCEFFFFFFul; // -2.14748352E9f (-2147483520)
+ yield return 0x4F0000014F000001ul; // 2.1474839E9f (2147483904)
+ yield return 0x4F0000004F000000ul; // 2.14748365E9f (2147483648)
+ yield return 0x4EFFFFFF4EFFFFFFul; // 2.14748352E9f (2147483520)
+
+ // uint
+ yield return 0x4F8000014F800001ul; // 4.2949678E9f (4294967808)
+ yield return 0x4F8000004F800000ul; // 4.2949673E9f (4294967296)
+ yield return 0x4F7FFFFF4F7FFFFFul; // 4.29496704E9f (4294967040)
yield return 0xFF7FFFFFFF7FFFFFul; // -Max Normal (float.MinValue)
yield return 0x8080000080800000ul; // -Min Normal
@@ -304,11 +324,19 @@ namespace Ryujinx.Tests.Cpu
for (int cnt = 1; cnt <= RndCnt; cnt++)
{
- ulong rnd1 = GenNormalS();
- ulong rnd2 = GenSubnormalS();
+ ulong rnd1 = (uint)BitConverter.SingleToInt32Bits(
+ (float)((int)TestContext.CurrentContext.Random.NextUInt()));
+ ulong rnd2 = (uint)BitConverter.SingleToInt32Bits(
+ (float)((uint)TestContext.CurrentContext.Random.NextUInt()));
+
+ ulong rnd3 = GenNormalS();
+ ulong rnd4 = GenSubnormalS();
yield return (rnd1 << 32) | rnd1;
yield return (rnd2 << 32) | rnd2;
+
+ yield return (rnd3 << 32) | rnd3;
+ yield return (rnd4 << 32) | rnd4;
}
}
@@ -353,7 +381,7 @@ namespace Ryujinx.Tests.Cpu
}
}
- private static IEnumerable<ulong> _1D_F_Cvt_()
+ private static IEnumerable<ulong> _1D_F_X_()
{
// long
yield return 0xC3E0000000000001ul; // -9.2233720368547780E18d (-9223372036854778000)
@@ -363,6 +391,11 @@ namespace Ryujinx.Tests.Cpu
yield return 0x43E0000000000000ul; // 9.2233720368547760E18d (9223372036854776000)
yield return 0x43DFFFFFFFFFFFFFul; // 9.2233720368547750E18d (9223372036854775000)
+ // ulong
+ yield return 0x43F0000000000001ul; // 1.8446744073709556e19d (18446744073709556000)
+ yield return 0x43F0000000000000ul; // 1.8446744073709552E19d (18446744073709552000)
+ yield return 0x43EFFFFFFFFFFFFFul; // 1.8446744073709550e19d (18446744073709550000)
+
yield return 0xFFEFFFFFFFFFFFFFul; // -Max Normal (double.MinValue)
yield return 0x8010000000000000ul; // -Min Normal
yield return 0x800FFFFFFFFFFFFFul; // -Max Subnormal
@@ -394,11 +427,19 @@ namespace Ryujinx.Tests.Cpu
for (int cnt = 1; cnt <= RndCnt; cnt++)
{
- ulong rnd1 = GenNormalD();
- ulong rnd2 = GenSubnormalD();
+ ulong rnd1 = (ulong)BitConverter.DoubleToInt64Bits(
+ (double)((long)TestContext.CurrentContext.Random.NextULong()));
+ ulong rnd2 = (ulong)BitConverter.DoubleToInt64Bits(
+ (double)((ulong)TestContext.CurrentContext.Random.NextULong()));
+
+ ulong rnd3 = GenNormalD();
+ ulong rnd4 = GenSubnormalD();
yield return rnd1;
yield return rnd2;
+
+ yield return rnd3;
+ yield return rnd4;
}
}
#endregion
@@ -1467,7 +1508,7 @@ namespace Ryujinx.Tests.Cpu
[Test, Pairwise] [Explicit]
public void F_Cvt_NZ_SU_S_S([ValueSource("_F_Cvt_NZ_SU_S_S_")] uint opcodes,
- [ValueSource("_1S_F_Cvt_")] ulong a)
+ [ValueSource("_1S_F_W_")] ulong a)
{
ulong z = TestContext.CurrentContext.Random.NextULong();
Vector128<float> v0 = MakeVectorE0E1(z, z);
@@ -1480,7 +1521,7 @@ namespace Ryujinx.Tests.Cpu
[Test, Pairwise] [Explicit]
public void F_Cvt_NZ_SU_S_D([ValueSource("_F_Cvt_NZ_SU_S_D_")] uint opcodes,
- [ValueSource("_1D_F_Cvt_")] ulong a)
+ [ValueSource("_1D_F_X_")] ulong a)
{
ulong z = TestContext.CurrentContext.Random.NextULong();
Vector128<float> v0 = MakeVectorE1(z);
@@ -1495,8 +1536,8 @@ namespace Ryujinx.Tests.Cpu
public void F_Cvt_NZ_SU_V_2S_4S([ValueSource("_F_Cvt_NZ_SU_V_2S_4S_")] uint opcodes,
[Values(0u)] uint rd,
[Values(1u, 0u)] uint rn,
- [ValueSource("_2S_F_Cvt_")] ulong z,
- [ValueSource("_2S_F_Cvt_")] ulong a,
+ [ValueSource("_2S_F_W_")] ulong z,
+ [ValueSource("_2S_F_W_")] ulong a,
[Values(0b0u, 0b1u)] uint q) // <2S, 4S>
{
opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
@@ -1514,8 +1555,8 @@ namespace Ryujinx.Tests.Cpu
public void F_Cvt_NZ_SU_V_2D([ValueSource("_F_Cvt_NZ_SU_V_2D_")] uint opcodes,
[Values(0u)] uint rd,
[Values(1u, 0u)] uint rn,
- [ValueSource("_1D_F_Cvt_")] ulong z,
- [ValueSource("_1D_F_Cvt_")] ulong a)
+ [ValueSource("_1D_F_X_")] ulong z,
+ [ValueSource("_1D_F_X_")] ulong a)
{
opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);