aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Tests/Cpu/CpuTestSimdIns.cs
diff options
context:
space:
mode:
authorLDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>2018-11-18 03:41:16 +0100
committergdkchan <gab.dark.100@gmail.com>2018-11-18 00:41:16 -0200
commite603b7afbcdff0fc732304872f5a65d410c601f9 (patch)
treed1949402bc6c6edd5a3d6e2ea40d9033a3d2f654 /Ryujinx.Tests/Cpu/CpuTestSimdIns.cs
parentb7613dd4b8a535d028ae180ee3a4b574abe4e3e0 (diff)
Add Sse Opt. for S/Umax_V, S/Umin_V, S/Uaddw_V, S/Usubw_V, Fabs_S/V, Fneg_S/V Inst.; for Fcvtl_V, Fcvtn_V Inst.; and for Fcmp_S Inst.. Add/Improve other Sse Opt.. Add Tests. (#496)
* Update CpuTest.cs * Update CpuTestSimd.cs * Update CpuTestSimdReg.cs * Update InstEmitSimdCmp.cs * Update SoftFloat.cs * Update InstEmitAluHelper.cs * Update InstEmitSimdArithmetic.cs * Update InstEmitSimdHelper.cs * Update VectorHelper.cs * Update InstEmitSimdCvt.cs * Update InstEmitSimdArithmetic.cs * Update CpuTestSimd.cs * Update InstEmitSimdArithmetic.cs * Update OpCodeTable.cs * Update InstEmitSimdArithmetic.cs * Update InstEmitSimdCmp.cs * Update InstEmitSimdCvt.cs * Update CpuTestSimd.cs * Update CpuTestSimdReg.cs * Create CpuTestSimdFcond.cs * Update OpCodeTable.cs * Update InstEmitSimdMove.cs * Update CpuTestSimdIns.cs * Create CpuTestSimdExt.cs * Nit. * Update PackageReference.
Diffstat (limited to 'Ryujinx.Tests/Cpu/CpuTestSimdIns.cs')
-rw-r--r--Ryujinx.Tests/Cpu/CpuTestSimdIns.cs198
1 files changed, 198 insertions, 0 deletions
diff --git a/Ryujinx.Tests/Cpu/CpuTestSimdIns.cs b/Ryujinx.Tests/Cpu/CpuTestSimdIns.cs
index f4d6ed8e..4ca54a2b 100644
--- a/Ryujinx.Tests/Cpu/CpuTestSimdIns.cs
+++ b/Ryujinx.Tests/Cpu/CpuTestSimdIns.cs
@@ -18,6 +18,24 @@ namespace Ryujinx.Tests.Cpu
0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul };
}
+ private static ulong[] _2S_()
+ {
+ return new ulong[] { 0x0000000000000000ul, 0x7FFFFFFF7FFFFFFFul,
+ 0x8000000080000000ul, 0xFFFFFFFFFFFFFFFFul };
+ }
+
+ private static ulong[] _4H_()
+ {
+ return new ulong[] { 0x0000000000000000ul, 0x7FFF7FFF7FFF7FFFul,
+ 0x8000800080008000ul, 0xFFFFFFFFFFFFFFFFul };
+ }
+
+ private static ulong[] _8B_()
+ {
+ return new ulong[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
+ 0x8080808080808080ul, 0xFFFFFFFFFFFFFFFFul };
+ }
+
private static ulong[] _8B4H_()
{
return new ulong[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
@@ -89,6 +107,186 @@ namespace Ryujinx.Tests.Cpu
CompareAgainstUnicorn();
}
+ [Test, Pairwise, Description("DUP B0, V1.B[<index>]")]
+ public void Dup_S_B([ValueSource("_8B_")] [Random(RndCnt)] ulong a,
+ [Range(0u, 15u)] uint index)
+ {
+ const int size = 0;
+
+ uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
+
+ uint opcode = 0x5E000420; // RESERVED
+ opcode |= (imm5 << 16);
+
+ ulong z = TestContext.CurrentContext.Random.NextULong();
+ Vector128<float> v0 = MakeVectorE0E1(z, z);
+ Vector128<float> v1 = MakeVectorE0E1(a, a);
+
+ SingleOpcode(opcode, v0: v0, v1: v1);
+
+ CompareAgainstUnicorn();
+ }
+
+ [Test, Pairwise, Description("DUP H0, V1.H[<index>]")]
+ public void Dup_S_H([ValueSource("_4H_")] [Random(RndCnt)] ulong a,
+ [Range(0u, 7u)] uint index)
+ {
+ const int size = 1;
+
+ uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
+
+ uint opcode = 0x5E000420; // RESERVED
+ opcode |= (imm5 << 16);
+
+ ulong z = TestContext.CurrentContext.Random.NextULong();
+ Vector128<float> v0 = MakeVectorE0E1(z, z);
+ Vector128<float> v1 = MakeVectorE0E1(a, a);
+
+ SingleOpcode(opcode, v0: v0, v1: v1);
+
+ CompareAgainstUnicorn();
+ }
+
+ [Test, Pairwise, Description("DUP S0, V1.S[<index>]")]
+ public void Dup_S_S([ValueSource("_2S_")] [Random(RndCnt)] ulong a,
+ [Range(0u, 3u)] uint index)
+ {
+ const int size = 2;
+
+ uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
+
+ uint opcode = 0x5E000420; // RESERVED
+ opcode |= (imm5 << 16);
+
+ ulong z = TestContext.CurrentContext.Random.NextULong();
+ Vector128<float> v0 = MakeVectorE0E1(z, z);
+ Vector128<float> v1 = MakeVectorE0E1(a, a);
+
+ SingleOpcode(opcode, v0: v0, v1: v1);
+
+ CompareAgainstUnicorn();
+ }
+
+ [Test, Pairwise, Description("DUP D0, V1.D[<index>]")]
+ public void Dup_S_D([ValueSource("_1D_")] [Random(RndCnt)] ulong a,
+ [Range(0u, 1u)] uint index)
+ {
+ const int size = 3;
+
+ uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
+
+ uint opcode = 0x5E000420; // RESERVED
+ opcode |= (imm5 << 16);
+
+ ulong z = TestContext.CurrentContext.Random.NextULong();
+ Vector128<float> v0 = MakeVectorE0E1(z, z);
+ Vector128<float> v1 = MakeVectorE0E1(a, a);
+
+ SingleOpcode(opcode, v0: v0, v1: v1);
+
+ CompareAgainstUnicorn();
+ }
+
+ [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.B[<index>]")]
+ public void Dup_V_8B_16B([Values(0u)] uint rd,
+ [Values(1u, 0u)] uint rn,
+ [ValueSource("_8B_")] [Random(RndCnt)] ulong z,
+ [ValueSource("_8B_")] [Random(RndCnt)] ulong a,
+ [Range(0u, 15u)] uint index,
+ [Values(0b0u, 0b1u)] uint q) // <8B, 16B>
+ {
+ const int size = 0;
+
+ uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
+
+ uint opcode = 0x0E000400; // RESERVED
+ opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
+ opcode |= (imm5 << 16);
+ opcode |= ((q & 1) << 30);
+
+ Vector128<float> v0 = MakeVectorE0E1(z, z);
+ Vector128<float> v1 = MakeVectorE0E1(a, a);
+
+ SingleOpcode(opcode, v0: v0, v1: v1);
+
+ CompareAgainstUnicorn();
+ }
+
+ [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.H[<index>]")]
+ public void Dup_V_4H_8H([Values(0u)] uint rd,
+ [Values(1u, 0u)] uint rn,
+ [ValueSource("_4H_")] [Random(RndCnt)] ulong z,
+ [ValueSource("_4H_")] [Random(RndCnt)] ulong a,
+ [Range(0u, 7u)] uint index,
+ [Values(0b0u, 0b1u)] uint q) // <4H, 8H>
+ {
+ const int size = 1;
+
+ uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
+
+ uint opcode = 0x0E000400; // RESERVED
+ opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
+ opcode |= (imm5 << 16);
+ opcode |= ((q & 1) << 30);
+
+ Vector128<float> v0 = MakeVectorE0E1(z, z);
+ Vector128<float> v1 = MakeVectorE0E1(a, a);
+
+ SingleOpcode(opcode, v0: v0, v1: v1);
+
+ CompareAgainstUnicorn();
+ }
+
+ [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.S[<index>]")]
+ public void Dup_V_2S_4S([Values(0u)] uint rd,
+ [Values(1u, 0u)] uint rn,
+ [ValueSource("_2S_")] [Random(RndCnt)] ulong z,
+ [ValueSource("_2S_")] [Random(RndCnt)] ulong a,
+ [Range(0u, 3u)] uint index,
+ [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
+ {
+ const int size = 2;
+
+ uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
+
+ uint opcode = 0x0E000400; // RESERVED
+ opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
+ opcode |= (imm5 << 16);
+ opcode |= ((q & 1) << 30);
+
+ Vector128<float> v0 = MakeVectorE0E1(z, z);
+ Vector128<float> v1 = MakeVectorE0E1(a, a);
+
+ SingleOpcode(opcode, v0: v0, v1: v1);
+
+ CompareAgainstUnicorn();
+ }
+
+ [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.D[<index>]")]
+ public void Dup_V_2D([Values(0u)] uint rd,
+ [Values(1u, 0u)] uint rn,
+ [ValueSource("_1D_")] [Random(RndCnt)] ulong z,
+ [ValueSource("_1D_")] [Random(RndCnt)] ulong a,
+ [Range(0u, 1u)] uint index,
+ [Values(0b1u)] uint q) // <2D>
+ {
+ const int size = 3;
+
+ uint imm5 = (index << (size + 1) | 1u << size) & 0x1Fu;
+
+ uint opcode = 0x0E000400; // RESERVED
+ opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
+ opcode |= (imm5 << 16);
+ opcode |= ((q & 1) << 30);
+
+ Vector128<float> v0 = MakeVectorE0E1(z, z);
+ Vector128<float> v1 = MakeVectorE0E1(a, a);
+
+ SingleOpcode(opcode, v0: v0, v1: v1);
+
+ CompareAgainstUnicorn();
+ }
+
[Test, Pairwise, Description("SMOV <Wd>, <Vn>.<Ts>[<index>]")]
public void Smov_S_W([Values(0u, 31u)] uint rd,
[Values(1u)] uint rn,