2018-09-08 17:23:07 +00:00
|
|
|
#define CcmpReg
|
2018-04-18 20:22:45 +00:00
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace Ryujinx.Tests.Cpu
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
[Category("CcmpReg")]
|
2018-04-18 20:22:45 +00:00
|
|
|
public sealed class CpuTestCcmpReg : CpuTest
|
|
|
|
{
|
|
|
|
#if CcmpReg
|
2018-09-08 17:23:07 +00:00
|
|
|
private const int RndCnt = 2;
|
|
|
|
private const int RndCntNzcv = 2;
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-09-08 17:23:07 +00:00
|
|
|
[Test, Pairwise, Description("CCMN <Xn>, <Xm>, #<nzcv>, <cond>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Ccmn_64bit([Values(1u, 31u)] uint rn,
|
|
|
|
[Values(2u, 31u)] uint rm,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
|
2018-11-01 04:22:09 +00:00
|
|
|
0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul)] [Random(RndCnt)] ulong xn,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
|
2018-11-01 04:22:09 +00:00
|
|
|
0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul)] [Random(RndCnt)] ulong xm,
|
2018-09-08 17:23:07 +00:00
|
|
|
[Random(0u, 15u, RndCntNzcv)] uint nzcv,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0b0000u, 0b0001u, 0b0010u, 0b0011u, // <EQ, NE, CS/HS, CC/LO,
|
|
|
|
0b0100u, 0b0101u, 0b0110u, 0b0111u, // MI, PL, VS, VC,
|
|
|
|
0b1000u, 0b1001u, 0b1010u, 0b1011u, // HI, LS, GE, LT,
|
|
|
|
0b1100u, 0b1101u, 0b1110u, 0b1111u)] uint cond) // GT, LE, AL, NV>
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0xBA400000; // CCMN X0, X0, #0, EQ
|
|
|
|
opcode |= ((rm & 31) << 16) | ((rn & 31) << 5);
|
|
|
|
opcode |= ((cond & 15) << 12) | ((nzcv & 15) << 0);
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
ulong x31 = TestContext.CurrentContext.Random.NextULong();
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x1: xn, x2: xm, x31: x31);
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-09-01 14:24:05 +00:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 20:22:45 +00:00
|
|
|
}
|
|
|
|
|
2018-09-08 17:23:07 +00:00
|
|
|
[Test, Pairwise, Description("CCMN <Wn>, <Wm>, #<nzcv>, <cond>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Ccmn_32bit([Values(1u, 31u)] uint rn,
|
|
|
|
[Values(2u, 31u)] uint rm,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0x00000000u, 0x7FFFFFFFu,
|
2018-11-01 04:22:09 +00:00
|
|
|
0x80000000u, 0xFFFFFFFFu)] [Random(RndCnt)] uint wn,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0x00000000u, 0x7FFFFFFFu,
|
2018-11-01 04:22:09 +00:00
|
|
|
0x80000000u, 0xFFFFFFFFu)] [Random(RndCnt)] uint wm,
|
2018-09-08 17:23:07 +00:00
|
|
|
[Random(0u, 15u, RndCntNzcv)] uint nzcv,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0b0000u, 0b0001u, 0b0010u, 0b0011u, // <EQ, NE, CS/HS, CC/LO,
|
|
|
|
0b0100u, 0b0101u, 0b0110u, 0b0111u, // MI, PL, VS, VC,
|
|
|
|
0b1000u, 0b1001u, 0b1010u, 0b1011u, // HI, LS, GE, LT,
|
|
|
|
0b1100u, 0b1101u, 0b1110u, 0b1111u)] uint cond) // GT, LE, AL, NV>
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x3A400000; // CCMN W0, W0, #0, EQ
|
|
|
|
opcode |= ((rm & 31) << 16) | ((rn & 31) << 5);
|
|
|
|
opcode |= ((cond & 15) << 12) | ((nzcv & 15) << 0);
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
uint w31 = TestContext.CurrentContext.Random.NextUInt();
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x1: wn, x2: wm, x31: w31);
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-09-01 14:24:05 +00:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 20:22:45 +00:00
|
|
|
}
|
|
|
|
|
2018-09-08 17:23:07 +00:00
|
|
|
[Test, Pairwise, Description("CCMP <Xn>, <Xm>, #<nzcv>, <cond>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Ccmp_64bit([Values(1u, 31u)] uint rn,
|
|
|
|
[Values(2u, 31u)] uint rm,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
|
2018-11-01 04:22:09 +00:00
|
|
|
0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul)] [Random(RndCnt)] ulong xn,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
|
2018-11-01 04:22:09 +00:00
|
|
|
0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul)] [Random(RndCnt)] ulong xm,
|
2018-09-08 17:23:07 +00:00
|
|
|
[Random(0u, 15u, RndCntNzcv)] uint nzcv,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0b0000u, 0b0001u, 0b0010u, 0b0011u, // <EQ, NE, CS/HS, CC/LO,
|
|
|
|
0b0100u, 0b0101u, 0b0110u, 0b0111u, // MI, PL, VS, VC,
|
|
|
|
0b1000u, 0b1001u, 0b1010u, 0b1011u, // HI, LS, GE, LT,
|
|
|
|
0b1100u, 0b1101u, 0b1110u, 0b1111u)] uint cond) // GT, LE, AL, NV>
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0xFA400000; // CCMP X0, X0, #0, EQ
|
|
|
|
opcode |= ((rm & 31) << 16) | ((rn & 31) << 5);
|
|
|
|
opcode |= ((cond & 15) << 12) | ((nzcv & 15) << 0);
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
ulong x31 = TestContext.CurrentContext.Random.NextULong();
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x1: xn, x2: xm, x31: x31);
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-09-01 14:24:05 +00:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 20:22:45 +00:00
|
|
|
}
|
|
|
|
|
2018-09-08 17:23:07 +00:00
|
|
|
[Test, Pairwise, Description("CCMP <Wn>, <Wm>, #<nzcv>, <cond>")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Ccmp_32bit([Values(1u, 31u)] uint rn,
|
|
|
|
[Values(2u, 31u)] uint rm,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0x00000000u, 0x7FFFFFFFu,
|
2018-11-01 04:22:09 +00:00
|
|
|
0x80000000u, 0xFFFFFFFFu)] [Random(RndCnt)] uint wn,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0x00000000u, 0x7FFFFFFFu,
|
2018-11-01 04:22:09 +00:00
|
|
|
0x80000000u, 0xFFFFFFFFu)] [Random(RndCnt)] uint wm,
|
2018-09-08 17:23:07 +00:00
|
|
|
[Random(0u, 15u, RndCntNzcv)] uint nzcv,
|
2018-04-18 20:22:45 +00:00
|
|
|
[Values(0b0000u, 0b0001u, 0b0010u, 0b0011u, // <EQ, NE, CS/HS, CC/LO,
|
|
|
|
0b0100u, 0b0101u, 0b0110u, 0b0111u, // MI, PL, VS, VC,
|
|
|
|
0b1000u, 0b1001u, 0b1010u, 0b1011u, // HI, LS, GE, LT,
|
|
|
|
0b1100u, 0b1101u, 0b1110u, 0b1111u)] uint cond) // GT, LE, AL, NV>
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x7A400000; // CCMP W0, W0, #0, EQ
|
|
|
|
opcode |= ((rm & 31) << 16) | ((rn & 31) << 5);
|
|
|
|
opcode |= ((cond & 15) << 12) | ((nzcv & 15) << 0);
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
uint w31 = TestContext.CurrentContext.Random.NextUInt();
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x1: wn, x2: wm, x31: w31);
|
2018-04-18 20:22:45 +00:00
|
|
|
|
2018-09-01 14:24:05 +00:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 20:22:45 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|