1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#define Mov
using NUnit.Framework;
namespace Ryujinx.Tests.Cpu
{
[Category("Mov")]
public sealed class CpuTestMov : CpuTest
{
#if Mov
private const int RndCnt = 2;
[Test, Pairwise, Description("MOVK <Xd>, #<imm>{, LSL #<shift>}")]
public void Movk_64bit([Values(0u, 31u)] uint rd,
[Random(RndCnt)] ulong xd,
[Values(0u, 65535u)] uint imm,
[Values(0u, 16u, 32u, 48u)] uint shift)
{
uint opcode = 0xF2800000; // MOVK X0, #0, LSL #0
opcode |= ((rd & 31) << 0);
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
ulong x31 = TestContext.CurrentContext.Random.NextULong();
SingleOpcode(opcode, x0: xd, x31: x31);
CompareAgainstUnicorn();
}
[Test, Pairwise, Description("MOVK <Wd>, #<imm>{, LSL #<shift>}")]
public void Movk_32bit([Values(0u, 31u)] uint rd,
[Random(RndCnt)] uint wd,
[Values(0u, 65535u)] uint imm,
[Values(0u, 16u)] uint shift)
{
uint opcode = 0x72800000; // MOVK W0, #0, LSL #0
opcode |= ((rd & 31) << 0);
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
uint w31 = TestContext.CurrentContext.Random.NextUInt();
SingleOpcode(opcode, x0: wd, x31: w31);
CompareAgainstUnicorn();
}
[Test, Pairwise, Description("MOVN <Xd>, #<imm>{, LSL #<shift>}")]
public void Movn_64bit([Values(0u, 31u)] uint rd,
[Values(0u, 65535u)] uint imm,
[Values(0u, 16u, 32u, 48u)] uint shift)
{
uint opcode = 0x92800000; // MOVN X0, #0, LSL #0
opcode |= ((rd & 31) << 0);
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
ulong x31 = TestContext.CurrentContext.Random.NextULong();
SingleOpcode(opcode, x31: x31);
CompareAgainstUnicorn();
}
[Test, Pairwise, Description("MOVN <Wd>, #<imm>{, LSL #<shift>}")]
public void Movn_32bit([Values(0u, 31u)] uint rd,
[Values(0u, 65535u)] uint imm,
[Values(0u, 16u)] uint shift)
{
uint opcode = 0x12800000; // MOVN W0, #0, LSL #0
opcode |= ((rd & 31) << 0);
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
uint w31 = TestContext.CurrentContext.Random.NextUInt();
SingleOpcode(opcode, x31: w31);
CompareAgainstUnicorn();
}
[Test, Pairwise, Description("MOVZ <Xd>, #<imm>{, LSL #<shift>}")]
public void Movz_64bit([Values(0u, 31u)] uint rd,
[Values(0u, 65535u)] uint imm,
[Values(0u, 16u, 32u, 48u)] uint shift)
{
uint opcode = 0xD2800000; // MOVZ X0, #0, LSL #0
opcode |= ((rd & 31) << 0);
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
ulong x31 = TestContext.CurrentContext.Random.NextULong();
SingleOpcode(opcode, x31: x31);
CompareAgainstUnicorn();
}
[Test, Pairwise, Description("MOVZ <Wd>, #<imm>{, LSL #<shift>}")]
public void Movz_32bit([Values(0u, 31u)] uint rd,
[Values(0u, 65535u)] uint imm,
[Values(0u, 16u)] uint shift)
{
uint opcode = 0x52800000; // MOVZ W0, #0, LSL #0
opcode |= ((rd & 31) << 0);
opcode |= (((shift / 16) & 3) << 21) | ((imm & 65535) << 5);
uint w31 = TestContext.CurrentContext.Random.NextUInt();
SingleOpcode(opcode, x31: w31);
CompareAgainstUnicorn();
}
#endif
}
}
|