Convert a few more CPU tests to xUnit

This commit is contained in:
TSR Berry 2023-07-09 00:07:00 +02:00
parent 7acf80b93d
commit 620bfcb0f9
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2
3 changed files with 200 additions and 161 deletions

View file

@ -1,5 +1,6 @@
// #define Bf32 #define Bf32
using System;
using Xunit; using Xunit;
namespace Ryujinx.Tests.Cpu namespace Ryujinx.Tests.Cpu
@ -10,33 +11,48 @@ namespace Ryujinx.Tests.Cpu
#if Bf32 #if Bf32
private const int RndCnt = 2; private const int RndCnt = 2;
[Test, Pairwise, Description("BFC <Rd>, #<lsb>, #<width>")] private static readonly uint[] _testData_rd =
public void Bfc([Values(0u, 0xdu)] uint rd, {
[Values(0x00000000u, 0x7FFFFFFFu, 0u, 0xdu,
0x80000000u, 0xFFFFFFFFu)] uint wd, };
[Values(0u, 15u, 16u, 31u)] uint lsb, private static readonly uint[] _testData_wd =
[Values(0u, 15u, 16u, 31u)] uint msb) {
0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu,
};
private static readonly uint[] _testData_lsb =
{
0u, 15u, 16u, 31u,
};
public static readonly MatrixTheoryData<uint, uint, uint, uint> TestData_Bfc = new(_testData_rd, _testData_wd, _testData_lsb, _testData_lsb);
[Theory(DisplayName = "BFC <Rd>, #<lsb>, #<width>")]
[MemberData(nameof(TestData_Bfc))]
public void Bfc(uint rd, uint wd, uint lsb, uint msb)
{ {
msb = Math.Max(lsb, msb); // Don't test unpredictable for now. msb = Math.Max(lsb, msb); // Don't test unpredictable for now.
uint opcode = 0xe7c0001fu; // BFC R0, #0, #1 uint opcode = 0xe7c0001fu; // BFC R0, #0, #1
opcode |= ((rd & 0xf) << 12); opcode |= ((rd & 0xf) << 12);
opcode |= ((msb & 31) << 16) | ((lsb & 31) << 7); opcode |= ((msb & 31) << 16) | ((lsb & 31) << 7);
uint sp = TestContext.CurrentContext.Random.NextUInt(); uint sp = Random.Shared.NextUInt();
SingleOpcode(opcode, r0: wd, sp: sp); SingleOpcode(opcode, r0: wd, sp: sp);
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise, Description("BFI <Rd>, <Rn>, #<lsb>, #<width>")] private static readonly uint[] _testData_rn =
public void Bfi([Values(0u, 0xdu)] uint rd, {
[Values(1u, 0xdu)] uint rn, 1u, 0xdu,
[Random(RndCnt)] uint wd, };
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wn, public static readonly MatrixTheoryData<uint, uint, uint, uint, uint, uint> TestData_Bfi = new(_testData_rd, _testData_rn, Random.Shared.NextUIntEnumerable(RndCnt), _testData_wd, _testData_lsb, _testData_lsb);
[Values(0u, 15u, 16u, 31u)] uint lsb,
[Values(0u, 15u, 16u, 31u)] uint msb) [Theory(DisplayName = "BFI <Rd>, <Rn>, #<lsb>, #<width>")]
[MemberData(nameof(TestData_Bfi))]
public void Bfi(uint rd, uint rn, uint wd, uint wn, uint lsb, uint msb)
{ {
msb = Math.Max(lsb, msb); // Don't test unpredictable for now. msb = Math.Max(lsb, msb); // Don't test unpredictable for now.
uint opcode = 0xe7c00010u; // BFI R0, R0, #0, #1 uint opcode = 0xe7c00010u; // BFI R0, R0, #0, #1
@ -44,21 +60,16 @@ namespace Ryujinx.Tests.Cpu
opcode |= ((rn & 0xf) << 0); opcode |= ((rn & 0xf) << 0);
opcode |= ((msb & 31) << 16) | ((lsb & 31) << 7); opcode |= ((msb & 31) << 16) | ((lsb & 31) << 7);
uint sp = TestContext.CurrentContext.Random.NextUInt(); uint sp = Random.Shared.NextUInt();
SingleOpcode(opcode, r0: wd, r1: wn, sp: sp); SingleOpcode(opcode, r0: wd, r1: wn, sp: sp);
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise, Description("UBFX <Rd>, <Rn>, #<lsb>, #<width>")] [Theory(DisplayName = "UBFX <Rd>, <Rn>, #<lsb>, #<width>")]
public void Ubfx([Values(0u, 0xdu)] uint rd, [MemberData(nameof(TestData_Bfi))]
[Values(1u, 0xdu)] uint rn, public void Ubfx(uint rd, uint rn, uint wd, uint wn, uint lsb, uint widthm1)
[Random(RndCnt)] uint wd,
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wn,
[Values(0u, 15u, 16u, 31u)] uint lsb,
[Values(0u, 15u, 16u, 31u)] uint widthm1)
{ {
if (lsb + widthm1 > 31) if (lsb + widthm1 > 31)
{ {
@ -69,21 +80,16 @@ namespace Ryujinx.Tests.Cpu
opcode |= ((rn & 0xf) << 0); opcode |= ((rn & 0xf) << 0);
opcode |= ((widthm1 & 31) << 16) | ((lsb & 31) << 7); opcode |= ((widthm1 & 31) << 16) | ((lsb & 31) << 7);
uint sp = TestContext.CurrentContext.Random.NextUInt(); uint sp = Random.Shared.NextUInt();
SingleOpcode(opcode, r0: wd, r1: wn, sp: sp); SingleOpcode(opcode, r0: wd, r1: wn, sp: sp);
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise, Description("SBFX <Rd>, <Rn>, #<lsb>, #<width>")] [Theory(DisplayName = "SBFX <Rd>, <Rn>, #<lsb>, #<width>")]
public void Sbfx([Values(0u, 0xdu)] uint rd, [MemberData(nameof(TestData_Bfi))]
[Values(1u, 0xdu)] uint rn, public void Sbfx(uint rd, uint rn, uint wd, uint wn, uint lsb, uint widthm1)
[Random(RndCnt)] uint wd,
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wn,
[Values(0u, 15u, 16u, 31u)] uint lsb,
[Values(0u, 15u, 16u, 31u)] uint widthm1)
{ {
if (lsb + widthm1 > 31) if (lsb + widthm1 > 31)
{ {
@ -94,7 +100,7 @@ namespace Ryujinx.Tests.Cpu
opcode |= ((rn & 0xf) << 0); opcode |= ((rn & 0xf) << 0);
opcode |= ((widthm1 & 31) << 16) | ((lsb & 31) << 7); opcode |= ((widthm1 & 31) << 16) | ((lsb & 31) << 7);
uint sp = TestContext.CurrentContext.Random.NextUInt(); uint sp = Random.Shared.NextUInt();
SingleOpcode(opcode, r0: wd, r1: wn, sp: sp); SingleOpcode(opcode, r0: wd, r1: wn, sp: sp);

View file

@ -1,5 +1,6 @@
// #define Mul32 #define Mul32
using System;
using Xunit; using Xunit;
namespace Ryujinx.Tests.Cpu namespace Ryujinx.Tests.Cpu
@ -51,82 +52,82 @@ namespace Ryujinx.Tests.Cpu
} }
#endregion #endregion
[Test, Pairwise, Description("SMLA<x><y> <Rd>, <Rn>, <Rm>, <Ra>")] private static readonly uint[] _testData_rn =
public void Smla___32bit([ValueSource(nameof(_Smlabb_Smlabt_Smlatb_Smlatt_))] uint opcode, {
[Values(0u, 0xdu)] uint rn, 0u, 0xdu,
[Values(1u, 0xdu)] uint rm, };
[Values(2u, 0xdu)] uint ra, private static readonly uint[] _testData_rm =
[Values(3u, 0xdu)] uint rd, {
[Values(0x00000000u, 0x7FFFFFFFu, 1u, 0xdu,
0x80000000u, 0xFFFFFFFFu)] uint wn, };
[Values(0x00000000u, 0x7FFFFFFFu, private static readonly uint[] _testData_ra =
0x80000000u, 0xFFFFFFFFu)] uint wm, {
[Values(0x00000000u, 0x7FFFFFFFu, 2u, 0xdu,
0x80000000u, 0xFFFFFFFFu)] uint wa) };
private static readonly uint[] _testData_rd =
{
3u, 0xdu,
};
private static readonly uint[] _testData_wn =
{
0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu,
};
public static readonly MatrixTheoryData<uint, uint, uint, uint, uint, uint, uint, uint> TestData_Smla = new(_Smlabb_Smlabt_Smlatb_Smlatt_(), _testData_rn, _testData_rm, _testData_ra, _testData_rd, _testData_wn, _testData_wn, _testData_wn);
[Theory(DisplayName = "SMLA<x><y> <Rd>, <Rn>, <Rm>, <Ra>")]
[MemberData(nameof(TestData_Smla))]
public void Smla___32bit(uint opcode, uint rn, uint rm, uint ra, uint rd, uint wn, uint wm, uint wa)
{ {
opcode |= ((rn & 15) << 0) | ((rm & 15) << 8) | ((ra & 15) << 12) | ((rd & 15) << 16); opcode |= ((rn & 15) << 0) | ((rm & 15) << 8) | ((ra & 15) << 12) | ((rd & 15) << 16);
uint w31 = TestContext.CurrentContext.Random.NextUInt(); uint w31 = Random.Shared.NextUInt();
SingleOpcode(opcode, r0: wn, r1: wm, r2: wa, sp: w31); SingleOpcode(opcode, r0: wn, r1: wm, r2: wa, sp: w31);
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise, Description("SMLAW<x> <Rd>, <Rn>, <Rm>, <Ra>")] public static readonly MatrixTheoryData<uint, uint, uint, uint, uint, uint, uint, uint> TestData_Smlaw = new(_Smlawb_Smlawt_(), _testData_rn, _testData_rm, _testData_ra, _testData_rd, _testData_wn, _testData_wn, _testData_wn);
public void Smlaw__32bit([ValueSource(nameof(_Smlawb_Smlawt_))] uint opcode,
[Values(0u, 0xdu)] uint rn, [Theory(DisplayName = "SMLAW<x> <Rd>, <Rn>, <Rm>, <Ra>")]
[Values(1u, 0xdu)] uint rm, [MemberData(nameof(TestData_Smlaw))]
[Values(2u, 0xdu)] uint ra, public void Smlaw__32bit(uint opcode, uint rn, uint rm, uint ra, uint rd, uint wn, uint wm, uint wa)
[Values(3u, 0xdu)] uint rd,
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wn,
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wm,
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wa)
{ {
opcode |= ((rn & 15) << 0) | ((rm & 15) << 8) | ((ra & 15) << 12) | ((rd & 15) << 16); opcode |= ((rn & 15) << 0) | ((rm & 15) << 8) | ((ra & 15) << 12) | ((rd & 15) << 16);
uint w31 = TestContext.CurrentContext.Random.NextUInt(); uint w31 = Random.Shared.NextUInt();
SingleOpcode(opcode, r0: wn, r1: wm, r2: wa, sp: w31); SingleOpcode(opcode, r0: wn, r1: wm, r2: wa, sp: w31);
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise, Description("SMUL<x><y> <Rd>, <Rn>, <Rm>")] public static readonly MatrixTheoryData<uint, uint, uint, uint, uint, uint> TestData_Smul = new(_Smulbb_Smulbt_Smultb_Smultt_(), _testData_rn, _testData_rm, _testData_rd, _testData_wn, _testData_wn);
public void Smul___32bit([ValueSource(nameof(_Smulbb_Smulbt_Smultb_Smultt_))] uint opcode,
[Values(0u, 0xdu)] uint rn, [Theory(DisplayName = "SMUL<x><y> <Rd>, <Rn>, <Rm>")]
[Values(1u, 0xdu)] uint rm, [MemberData(nameof(TestData_Smul))]
[Values(2u, 0xdu)] uint rd, public void Smul___32bit(uint opcode, uint rn, uint rm, uint rd, uint wn, uint wm)
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wn,
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wm)
{ {
opcode |= ((rn & 15) << 0) | ((rm & 15) << 8) | ((rd & 15) << 16); opcode |= ((rn & 15) << 0) | ((rm & 15) << 8) | ((rd & 15) << 16);
uint w31 = TestContext.CurrentContext.Random.NextUInt(); uint w31 = Random.Shared.NextUInt();
SingleOpcode(opcode, r0: wn, r1: wm, sp: w31); SingleOpcode(opcode, r0: wn, r1: wm, sp: w31);
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise, Description("SMULW<x> <Rd>, <Rn>, <Rm>")] public static readonly MatrixTheoryData<uint, uint, uint, uint, uint, uint> TestData_Smulw = new(_Smulwb_Smulwt_(), _testData_rn, _testData_rm, _testData_rd, _testData_wn, _testData_wn);
public void Smulw__32bit([ValueSource(nameof(_Smulwb_Smulwt_))] uint opcode,
[Values(0u, 0xdu)] uint rn, [Theory(DisplayName = "SMULW<x> <Rd>, <Rn>, <Rm>")]
[Values(1u, 0xdu)] uint rm, [MemberData(nameof(TestData_Smulw))]
[Values(2u, 0xdu)] uint rd, public void Smulw__32bit(uint opcode, uint rn, uint rm, uint rd, uint wn, uint wm)
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wn,
[Values(0x00000000u, 0x7FFFFFFFu,
0x80000000u, 0xFFFFFFFFu)] uint wm)
{ {
opcode |= ((rn & 15) << 0) | ((rm & 15) << 8) | ((rd & 15) << 16); opcode |= ((rn & 15) << 0) | ((rm & 15) << 8) | ((rd & 15) << 16);
uint w31 = TestContext.CurrentContext.Random.NextUInt(); uint w31 = Random.Shared.NextUInt();
SingleOpcode(opcode, r0: wn, r1: wm, sp: w31); SingleOpcode(opcode, r0: wn, r1: wm, sp: w31);

View file

@ -1,5 +1,8 @@
// #define SimdTbl #define SimdTbl
using ARMeilleure.State;
using System;
using System.Collections.Generic;
using Xunit; using Xunit;
namespace Ryujinx.Tests.Cpu namespace Ryujinx.Tests.Cpu
@ -21,10 +24,10 @@ namespace Ryujinx.Tests.Cpu
for (int cnt = 1; cnt <= 8; cnt++) for (int cnt = 1; cnt <= 8; cnt++)
{ {
ulong idxInRng = TestContext.CurrentContext.Random.NextByte(IdxInRngMin, idxInRngMax); ulong idxInRng = Random.Shared.NextByte(IdxInRngMin, idxInRngMax);
ulong idxOutRng = TestContext.CurrentContext.Random.NextByte(idxOutRngMin, IdxOutRngMax); ulong idxOutRng = Random.Shared.NextByte(idxOutRngMin, IdxOutRngMax);
ulong idx = TestContext.CurrentContext.Random.NextBool() ? idxInRng : idxOutRng; ulong idx = Random.Shared.NextBool() ? idxInRng : idxOutRng;
idxs = (idxs << 8) | idx; idxs = (idxs << 8) | idx;
} }
@ -135,15 +138,28 @@ namespace Ryujinx.Tests.Cpu
private const int RndCntIdxs = 2; private const int RndCntIdxs = 2;
[Test, Pairwise] private static readonly uint[] _testData_rd =
public void SingleRegisterTable_V_8B_16B([ValueSource(nameof(_SingleRegisterTable_V_8B_16B_))] uint opcodes, {
[Values(0u)] uint rd, 0u,
[Values(1u)] uint rn, };
[Values(2u)] uint rm, private static readonly uint[] _testData_rn =
[ValueSource(nameof(_8B_))] ulong z, {
[ValueSource(nameof(_8B_))] ulong table0, 1u,
[ValueSource(nameof(_GenIdxsForTbl1_))] ulong indexes, };
[Values(0b0u, 0b1u)] uint q) // <8B, 16B> private static readonly uint[] _testData_rm =
{
2u,
};
private static readonly uint[] _testData_q =
{
0b0u, 0b1u, // <8B, 16B>
};
public static readonly MatrixTheoryData<uint, uint, uint, uint, ulong, ulong, ulong, uint> TestData = new(_SingleRegisterTable_V_8B_16B_(), _testData_rd, _testData_rn, _testData_rm, _8B_(), _8B_(), _GenIdxsForTbl1_(), _testData_q);
[Theory]
[MemberData(nameof(TestData))]
public void SingleRegisterTable_V_8B_16B(uint opcodes, uint rd, uint rn, uint rm, ulong z, ulong table0, ulong indexes, uint q)
{ {
opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0); opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0);
opcodes |= ((q & 1) << 30); opcodes |= ((q & 1) << 30);
@ -157,16 +173,17 @@ namespace Ryujinx.Tests.Cpu
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise] private static readonly uint[] _testData_Two_rm =
public void TwoRegisterTable_V_8B_16B([ValueSource(nameof(_TwoRegisterTable_V_8B_16B_))] uint opcodes, {
[Values(0u)] uint rd, 3u,
[Values(1u)] uint rn, };
[Values(3u)] uint rm,
[ValueSource(nameof(_8B_))] ulong z, public static readonly MatrixTheoryData<uint, uint, uint, uint, ulong, ulong, ulong, ulong, uint> TestData_Two =
[ValueSource(nameof(_8B_))] ulong table0, new(_TwoRegisterTable_V_8B_16B_(), _testData_rd, _testData_rn, _testData_Two_rm, _8B_(), _8B_(), _8B_(), _GenIdxsForTbl2_(), _testData_q);
[ValueSource(nameof(_8B_))] ulong table1,
[ValueSource(nameof(_GenIdxsForTbl2_))] ulong indexes, [Theory]
[Values(0b0u, 0b1u)] uint q) // <8B, 16B> [MemberData(nameof(TestData_Two))]
public void TwoRegisterTable_V_8B_16B(uint opcodes, uint rd, uint rn, uint rm, ulong z, ulong table0, ulong table1, ulong indexes, uint q)
{ {
opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0); opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0);
opcodes |= ((q & 1) << 30); opcodes |= ((q & 1) << 30);
@ -181,16 +198,25 @@ namespace Ryujinx.Tests.Cpu
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise] private static readonly uint[] _testData_ModTwo_rd =
public void Mod_TwoRegisterTable_V_8B_16B([ValueSource(nameof(_TwoRegisterTable_V_8B_16B_))] uint opcodes, {
[Values(30u, 1u)] uint rd, 30u, 1u,
[Values(31u)] uint rn, };
[Values(1u, 30u)] uint rm, private static readonly uint[] _testData_ModTwo_rn =
[ValueSource(nameof(_8B_))] ulong z, {
[ValueSource(nameof(_8B_))] ulong table0, 31u,
[ValueSource(nameof(_8B_))] ulong table1, };
[ValueSource(nameof(_GenIdxsForTbl2_))] ulong indexes, private static readonly uint[] _testData_ModTwo_rm =
[Values(0b0u, 0b1u)] uint q) // <8B, 16B> {
1u, 30u,
};
public static readonly MatrixTheoryData<uint, uint, uint, uint, ulong, ulong, ulong, ulong, uint> TestData_ModTwo =
new(_TwoRegisterTable_V_8B_16B_(), _testData_ModTwo_rd, _testData_ModTwo_rn, _testData_ModTwo_rm, _8B_(), _8B_(), _8B_(), _GenIdxsForTbl2_(), _testData_q);
[Theory]
[MemberData(nameof(TestData_ModTwo))]
public void Mod_TwoRegisterTable_V_8B_16B(uint opcodes, uint rd, uint rn, uint rm, ulong z, ulong table0, ulong table1, ulong indexes, uint q)
{ {
opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0); opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0);
opcodes |= ((q & 1) << 30); opcodes |= ((q & 1) << 30);
@ -205,17 +231,17 @@ namespace Ryujinx.Tests.Cpu
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise] private static readonly uint[] _testData_Three_rm =
public void ThreeRegisterTable_V_8B_16B([ValueSource(nameof(_ThreeRegisterTable_V_8B_16B_))] uint opcodes, {
[Values(0u)] uint rd, 4u,
[Values(1u)] uint rn, };
[Values(4u)] uint rm,
[ValueSource(nameof(_8B_))] ulong z, public static readonly MatrixTheoryData<uint, uint, uint, uint, ulong, ulong, ulong, ulong, ulong, uint> TestData_Three =
[ValueSource(nameof(_8B_))] ulong table0, new(_TwoRegisterTable_V_8B_16B_(), _testData_rd, _testData_rn, _testData_Three_rm, _8B_(), _8B_(), _8B_(), _8B_(), _GenIdxsForTbl3_(), _testData_q);
[ValueSource(nameof(_8B_))] ulong table1,
[ValueSource(nameof(_8B_))] ulong table2, [Theory]
[ValueSource(nameof(_GenIdxsForTbl3_))] ulong indexes, [MemberData(nameof(TestData_Three))]
[Values(0b0u, 0b1u)] uint q) // <8B, 16B> public void ThreeRegisterTable_V_8B_16B(uint opcodes, uint rd, uint rn, uint rm, ulong z, ulong table0, ulong table1, ulong table2, ulong indexes, uint q)
{ {
opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0); opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0);
opcodes |= ((q & 1) << 30); opcodes |= ((q & 1) << 30);
@ -231,17 +257,21 @@ namespace Ryujinx.Tests.Cpu
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise] private static readonly uint[] _testData_ModThree_rd =
public void Mod_ThreeRegisterTable_V_8B_16B([ValueSource(nameof(_ThreeRegisterTable_V_8B_16B_))] uint opcodes, {
[Values(30u, 2u)] uint rd, 30u, 2u,
[Values(31u)] uint rn, };
[Values(2u, 30u)] uint rm, private static readonly uint[] _testData_ModThree_rm =
[ValueSource(nameof(_8B_))] ulong z, {
[ValueSource(nameof(_8B_))] ulong table0, 2u, 30u,
[ValueSource(nameof(_8B_))] ulong table1, };
[ValueSource(nameof(_8B_))] ulong table2,
[ValueSource(nameof(_GenIdxsForTbl3_))] ulong indexes, public static readonly MatrixTheoryData<uint, uint, uint, uint, ulong, ulong, ulong, ulong, ulong, uint> TestData_ModThree =
[Values(0b0u, 0b1u)] uint q) // <8B, 16B> new(_ThreeRegisterTable_V_8B_16B_(), _testData_ModThree_rd, _testData_ModTwo_rn, _testData_ModThree_rm, _8B_(), _8B_(), _8B_(), _8B_(), _GenIdxsForTbl3_(), _testData_q);
[Theory]
[MemberData(nameof(TestData_ModThree))]
public void Mod_ThreeRegisterTable_V_8B_16B(uint opcodes, uint rd, uint rn, uint rm, ulong z, ulong table0, ulong table1, ulong table2, ulong indexes, uint q)
{ {
opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0); opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0);
opcodes |= ((q & 1) << 30); opcodes |= ((q & 1) << 30);
@ -257,18 +287,17 @@ namespace Ryujinx.Tests.Cpu
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise] private static readonly uint[] _testData_Four_rm =
public void FourRegisterTable_V_8B_16B([ValueSource(nameof(_FourRegisterTable_V_8B_16B_))] uint opcodes, {
[Values(0u)] uint rd, 5u,
[Values(1u)] uint rn, };
[Values(5u)] uint rm,
[ValueSource(nameof(_8B_))] ulong z, public static readonly MatrixTheoryData<uint, uint, uint, uint, ulong, ulong, ulong, ulong, ulong, ulong, uint> TestData_Four =
[ValueSource(nameof(_8B_))] ulong table0, new(_FourRegisterTable_V_8B_16B_(), _testData_rd, _testData_rn, _testData_Four_rm, _8B_(), _8B_(), _8B_(), _8B_(), _8B_(), _GenIdxsForTbl4_(), _testData_q);
[ValueSource(nameof(_8B_))] ulong table1,
[ValueSource(nameof(_8B_))] ulong table2, [Theory]
[ValueSource(nameof(_8B_))] ulong table3, [MemberData(nameof(TestData_Four))]
[ValueSource(nameof(_GenIdxsForTbl4_))] ulong indexes, public void FourRegisterTable_V_8B_16B(uint opcodes, uint rd, uint rn, uint rm, ulong z, ulong table0, ulong table1, ulong table2, ulong table3, ulong indexes, uint q)
[Values(0b0u, 0b1u)] uint q) // <8B, 16B>
{ {
opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0); opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0);
opcodes |= ((q & 1) << 30); opcodes |= ((q & 1) << 30);
@ -285,18 +314,21 @@ namespace Ryujinx.Tests.Cpu
CompareAgainstUnicorn(); CompareAgainstUnicorn();
} }
[Test, Pairwise] private static readonly uint[] _testData_ModFour_rd =
public void Mod_FourRegisterTable_V_8B_16B([ValueSource(nameof(_FourRegisterTable_V_8B_16B_))] uint opcodes, {
[Values(30u, 3u)] uint rd, 30u, 3u,
[Values(31u)] uint rn, };
[Values(3u, 30u)] uint rm, private static readonly uint[] _testData_ModFour_rm =
[ValueSource(nameof(_8B_))] ulong z, {
[ValueSource(nameof(_8B_))] ulong table0, 3u, 30u,
[ValueSource(nameof(_8B_))] ulong table1, };
[ValueSource(nameof(_8B_))] ulong table2,
[ValueSource(nameof(_8B_))] ulong table3, public static readonly MatrixTheoryData<uint, uint, uint, uint, ulong, ulong, ulong, ulong, ulong, ulong, uint> TestData_ModFour =
[ValueSource(nameof(_GenIdxsForTbl4_))] ulong indexes, new(_FourRegisterTable_V_8B_16B_(), _testData_ModFour_rd, _testData_ModTwo_rn, _testData_ModFour_rm, _8B_(), _8B_(), _8B_(), _8B_(), _8B_(), _GenIdxsForTbl4_(), _testData_q);
[Values(0b0u, 0b1u)] uint q) // <8B, 16B>
[Theory]
[MemberData(nameof(TestData_ModFour))]
public void Mod_FourRegisterTable_V_8B_16B(uint opcodes, uint rd, uint rn, uint rm, ulong z, ulong table0, ulong table1, ulong table2, ulong table3, ulong indexes, uint q)
{ {
opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0); opcodes |= ((rm & 31) << 16) | ((rn & 31) << 5) | ((rd & 31) << 0);
opcodes |= ((q & 1) << 30); opcodes |= ((q & 1) << 30);