2018-09-08 18:23:07 +01:00
|
|
|
#define Mov
|
2018-04-18 21:22:45 +01:00
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace Ryujinx.Tests.Cpu
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
[Category("Mov")]
|
2018-04-18 21:22:45 +01:00
|
|
|
public sealed class CpuTestMov : CpuTest
|
|
|
|
{
|
|
|
|
#if Mov
|
2019-06-12 13:03:31 +01:00
|
|
|
private const int RndCnt = 2;
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("MOVK <Xd>, #<imm>{, LSL #<shift>}")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Movk_64bit([Values(0u, 31u)] uint rd,
|
2019-06-12 13:03:31 +01:00
|
|
|
[Random(RndCnt)] ulong xd,
|
2023-02-09 01:24:32 +00:00
|
|
|
[Values(0u, 65535u)] uint imm,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0u, 16u, 32u, 48u)] uint shift)
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0xF2800000; // MOVK X0, #0, LSL #0
|
|
|
|
opcode |= ((rd & 31) << 0);
|
|
|
|
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
ulong x31 = TestContext.CurrentContext.Random.NextULong();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x0: xd, x31: x31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("MOVK <Wd>, #<imm>{, LSL #<shift>}")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Movk_32bit([Values(0u, 31u)] uint rd,
|
2019-06-12 13:03:31 +01:00
|
|
|
[Random(RndCnt)] uint wd,
|
2023-02-09 01:24:32 +00:00
|
|
|
[Values(0u, 65535u)] uint imm,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0u, 16u)] uint shift)
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x72800000; // MOVK W0, #0, LSL #0
|
|
|
|
opcode |= ((rd & 31) << 0);
|
|
|
|
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
uint w31 = TestContext.CurrentContext.Random.NextUInt();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x0: wd, x31: w31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("MOVN <Xd>, #<imm>{, LSL #<shift>}")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Movn_64bit([Values(0u, 31u)] uint rd,
|
2023-02-09 01:24:32 +00:00
|
|
|
[Values(0u, 65535u)] uint imm,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0u, 16u, 32u, 48u)] uint shift)
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x92800000; // MOVN X0, #0, LSL #0
|
|
|
|
opcode |= ((rd & 31) << 0);
|
|
|
|
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
ulong x31 = TestContext.CurrentContext.Random.NextULong();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x31: x31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("MOVN <Wd>, #<imm>{, LSL #<shift>}")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Movn_32bit([Values(0u, 31u)] uint rd,
|
2023-02-09 01:24:32 +00:00
|
|
|
[Values(0u, 65535u)] uint imm,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0u, 16u)] uint shift)
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x12800000; // MOVN W0, #0, LSL #0
|
|
|
|
opcode |= ((rd & 31) << 0);
|
|
|
|
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
uint w31 = TestContext.CurrentContext.Random.NextUInt();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x31: w31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("MOVZ <Xd>, #<imm>{, LSL #<shift>}")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Movz_64bit([Values(0u, 31u)] uint rd,
|
2023-02-09 01:24:32 +00:00
|
|
|
[Values(0u, 65535u)] uint imm,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0u, 16u, 32u, 48u)] uint shift)
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0xD2800000; // MOVZ X0, #0, LSL #0
|
|
|
|
opcode |= ((rd & 31) << 0);
|
|
|
|
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
ulong x31 = TestContext.CurrentContext.Random.NextULong();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x31: x31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
|
2018-09-08 18:23:07 +01:00
|
|
|
[Test, Pairwise, Description("MOVZ <Wd>, #<imm>{, LSL #<shift>}")]
|
2018-11-01 04:22:09 +00:00
|
|
|
public void Movz_32bit([Values(0u, 31u)] uint rd,
|
2023-02-09 01:24:32 +00:00
|
|
|
[Values(0u, 65535u)] uint imm,
|
2018-04-18 21:22:45 +01:00
|
|
|
[Values(0u, 16u)] uint shift)
|
|
|
|
{
|
2018-11-01 04:22:09 +00:00
|
|
|
uint opcode = 0x52800000; // MOVZ W0, #0, LSL #0
|
|
|
|
opcode |= ((rd & 31) << 0);
|
|
|
|
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
uint w31 = TestContext.CurrentContext.Random.NextUInt();
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-11-01 04:22:09 +00:00
|
|
|
SingleOpcode(opcode, x31: w31);
|
2018-04-18 21:22:45 +01:00
|
|
|
|
2018-09-01 15:24:05 +01:00
|
|
|
CompareAgainstUnicorn();
|
2018-04-18 21:22:45 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2023-02-09 01:24:32 +00:00
|
|
|
}
|