/ src / Ryujinx.Tests / Cpu / CpuTestSimdIns.cs
CpuTestSimdIns.cs
  1  #define SimdIns
  2  
  3  using ARMeilleure.State;
  4  using NUnit.Framework;
  5  
  6  namespace Ryujinx.Tests.Cpu
  7  {
  8      [Category("SimdIns")]
  9      public sealed class CpuTestSimdIns : CpuTest
 10      {
 11  #if SimdIns
 12  
 13          #region "ValueSource"
 14          private static ulong[] _1D_()
 15          {
 16              return new[] {
 17                  0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
 18                  0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul,
 19              };
 20          }
 21  
 22          private static ulong[] _2S_()
 23          {
 24              return new[] {
 25                  0x0000000000000000ul, 0x7FFFFFFF7FFFFFFFul,
 26                  0x8000000080000000ul, 0xFFFFFFFFFFFFFFFFul,
 27              };
 28          }
 29  
 30          private static ulong[] _4H_()
 31          {
 32              return new[] {
 33                  0x0000000000000000ul, 0x7FFF7FFF7FFF7FFFul,
 34                  0x8000800080008000ul, 0xFFFFFFFFFFFFFFFFul,
 35              };
 36          }
 37  
 38          private static ulong[] _8B_()
 39          {
 40              return new[] {
 41                  0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
 42                  0x8080808080808080ul, 0xFFFFFFFFFFFFFFFFul,
 43              };
 44          }
 45  
 46          private static ulong[] _8B4H_()
 47          {
 48              return new[] {
 49                  0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
 50                  0x8080808080808080ul, 0x7FFF7FFF7FFF7FFFul,
 51                  0x8000800080008000ul, 0xFFFFFFFFFFFFFFFFul,
 52              };
 53          }
 54  
 55          private static ulong[] _8B4H2S_()
 56          {
 57              return new[] {
 58                  0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
 59                  0x8080808080808080ul, 0x7FFF7FFF7FFF7FFFul,
 60                  0x8000800080008000ul, 0x7FFFFFFF7FFFFFFFul,
 61                  0x8000000080000000ul, 0xFFFFFFFFFFFFFFFFul,
 62              };
 63          }
 64  
 65          private static uint[] _W_()
 66          {
 67              return new[] {
 68                  0x00000000u, 0x0000007Fu,
 69                  0x00000080u, 0x000000FFu,
 70                  0x00007FFFu, 0x00008000u,
 71                  0x0000FFFFu, 0x7FFFFFFFu,
 72                  0x80000000u, 0xFFFFFFFFu,
 73              };
 74          }
 75  
 76          private static ulong[] _X_()
 77          {
 78              return new[] {
 79                  0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
 80                  0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul,
 81              };
 82          }
 83          #endregion
 84  
 85          [Test, Pairwise, Description("DUP <Vd>.<T>, W<n>")]
 86          public void Dup_Gp_W([Values(0u)] uint rd,
 87                               [Values(1u, 31u)] uint rn,
 88                               [ValueSource(nameof(_W_))] uint wn,
 89                               [Values(0, 1, 2)] int size,  // Q0: <8B,  4H, 2S>
 90                               [Values(0b0u, 0b1u)] uint q) // Q1: <16B, 8H, 4S>
 91          {
 92              uint imm5 = (1u << size) & 0x1Fu;
 93  
 94              uint opcode = 0x0E000C00; // RESERVED
 95              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
 96              opcode |= (imm5 << 16);
 97              opcode |= ((q & 1) << 30);
 98  
 99              uint w31 = TestContext.CurrentContext.Random.NextUInt();
100              ulong z = TestContext.CurrentContext.Random.NextULong();
101              V128 v0 = MakeVectorE0E1(z, z);
102  
103              SingleOpcode(opcode, x1: wn, x31: w31, v0: v0);
104  
105              CompareAgainstUnicorn();
106          }
107  
108          [Test, Pairwise, Description("DUP <Vd>.<T>, X<n>")]
109          public void Dup_Gp_X([Values(0u)] uint rd,
110                               [Values(1u, 31u)] uint rn,
111                               [ValueSource(nameof(_X_))] ulong xn)
112          {
113              uint opcode = 0x4E080C00; // DUP V0.2D, X0
114              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
115  
116              ulong x31 = TestContext.CurrentContext.Random.NextULong();
117              ulong z = TestContext.CurrentContext.Random.NextULong();
118              V128 v0 = MakeVectorE0E1(z, z);
119  
120              SingleOpcode(opcode, x1: xn, x31: x31, v0: v0);
121  
122              CompareAgainstUnicorn();
123          }
124  
125          [Test, Pairwise, Description("DUP B0, V1.B[<index>]")]
126          public void Dup_S_B([ValueSource(nameof(_8B_))] ulong a,
127                              [Values(0u, 15u)] uint index)
128          {
129              const int TestSize = 0;
130  
131              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
132  
133              uint opcode = 0x5E000420; // RESERVED
134              opcode |= (imm5 << 16);
135  
136              ulong z = TestContext.CurrentContext.Random.NextULong();
137              V128 v0 = MakeVectorE0E1(z, z);
138              V128 v1 = MakeVectorE0E1(a, a);
139  
140              SingleOpcode(opcode, v0: v0, v1: v1);
141  
142              CompareAgainstUnicorn();
143          }
144  
145          [Test, Pairwise, Description("DUP H0, V1.H[<index>]")]
146          public void Dup_S_H([ValueSource(nameof(_4H_))] ulong a,
147                              [Values(0u, 7u)] uint index)
148          {
149              const int TestSize = 1;
150  
151              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
152  
153              uint opcode = 0x5E000420; // RESERVED
154              opcode |= (imm5 << 16);
155  
156              ulong z = TestContext.CurrentContext.Random.NextULong();
157              V128 v0 = MakeVectorE0E1(z, z);
158              V128 v1 = MakeVectorE0E1(a, a);
159  
160              SingleOpcode(opcode, v0: v0, v1: v1);
161  
162              CompareAgainstUnicorn();
163          }
164  
165          [Test, Pairwise, Description("DUP S0, V1.S[<index>]")]
166          public void Dup_S_S([ValueSource(nameof(_2S_))] ulong a,
167                              [Values(0u, 1u, 2u, 3u)] uint index)
168          {
169              const int TestSize = 2;
170  
171              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
172  
173              uint opcode = 0x5E000420; // RESERVED
174              opcode |= (imm5 << 16);
175  
176              ulong z = TestContext.CurrentContext.Random.NextULong();
177              V128 v0 = MakeVectorE0E1(z, z);
178              V128 v1 = MakeVectorE0E1(a, a);
179  
180              SingleOpcode(opcode, v0: v0, v1: v1);
181  
182              CompareAgainstUnicorn();
183          }
184  
185          [Test, Pairwise, Description("DUP D0, V1.D[<index>]")]
186          public void Dup_S_D([ValueSource(nameof(_1D_))] ulong a,
187                              [Values(0u, 1u)] uint index)
188          {
189              const int TestSize = 3;
190  
191              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
192  
193              uint opcode = 0x5E000420; // RESERVED
194              opcode |= (imm5 << 16);
195  
196              ulong z = TestContext.CurrentContext.Random.NextULong();
197              V128 v0 = MakeVectorE0E1(z, z);
198              V128 v1 = MakeVectorE0E1(a, a);
199  
200              SingleOpcode(opcode, v0: v0, v1: v1);
201  
202              CompareAgainstUnicorn();
203          }
204  
205          [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.B[<index>]")]
206          public void Dup_V_8B_16B([Values(0u)] uint rd,
207                                   [Values(1u, 0u)] uint rn,
208                                   [ValueSource(nameof(_8B_))] ulong z,
209                                   [ValueSource(nameof(_8B_))] ulong a,
210                                   [Values(0u, 15u)] uint index,
211                                   [Values(0b0u, 0b1u)] uint q) // <8B, 16B>
212          {
213              const int TestSize = 0;
214  
215              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
216  
217              uint opcode = 0x0E000400; // RESERVED
218              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
219              opcode |= (imm5 << 16);
220              opcode |= ((q & 1) << 30);
221  
222              V128 v0 = MakeVectorE0E1(z, z);
223              V128 v1 = MakeVectorE0E1(a, a);
224  
225              SingleOpcode(opcode, v0: v0, v1: v1);
226  
227              CompareAgainstUnicorn();
228          }
229  
230          [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.H[<index>]")]
231          public void Dup_V_4H_8H([Values(0u)] uint rd,
232                                  [Values(1u, 0u)] uint rn,
233                                  [ValueSource(nameof(_4H_))] ulong z,
234                                  [ValueSource(nameof(_4H_))] ulong a,
235                                  [Values(0u, 7u)] uint index,
236                                  [Values(0b0u, 0b1u)] uint q) // <4H, 8H>
237          {
238              const int TestSize = 1;
239  
240              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
241  
242              uint opcode = 0x0E000400; // RESERVED
243              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
244              opcode |= (imm5 << 16);
245              opcode |= ((q & 1) << 30);
246  
247              V128 v0 = MakeVectorE0E1(z, z);
248              V128 v1 = MakeVectorE0E1(a, a);
249  
250              SingleOpcode(opcode, v0: v0, v1: v1);
251  
252              CompareAgainstUnicorn();
253          }
254  
255          [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.S[<index>]")]
256          public void Dup_V_2S_4S([Values(0u)] uint rd,
257                                  [Values(1u, 0u)] uint rn,
258                                  [ValueSource(nameof(_2S_))] ulong z,
259                                  [ValueSource(nameof(_2S_))] ulong a,
260                                  [Values(0u, 1u, 2u, 3u)] uint index,
261                                  [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
262          {
263              const int TestSize = 2;
264  
265              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
266  
267              uint opcode = 0x0E000400; // RESERVED
268              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
269              opcode |= (imm5 << 16);
270              opcode |= ((q & 1) << 30);
271  
272              V128 v0 = MakeVectorE0E1(z, z);
273              V128 v1 = MakeVectorE0E1(a, a);
274  
275              SingleOpcode(opcode, v0: v0, v1: v1);
276  
277              CompareAgainstUnicorn();
278          }
279  
280          [Test, Pairwise, Description("DUP <Vd>.<T>, <Vn>.D[<index>]")]
281          public void Dup_V_2D([Values(0u)] uint rd,
282                               [Values(1u, 0u)] uint rn,
283                               [ValueSource(nameof(_1D_))] ulong z,
284                               [ValueSource(nameof(_1D_))] ulong a,
285                               [Values(0u, 1u)] uint index,
286                               [Values(0b1u)] uint q) // <2D>
287          {
288              const int TestSize = 3;
289  
290              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
291  
292              uint opcode = 0x0E000400; // RESERVED
293              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
294              opcode |= (imm5 << 16);
295              opcode |= ((q & 1) << 30);
296  
297              V128 v0 = MakeVectorE0E1(z, z);
298              V128 v1 = MakeVectorE0E1(a, a);
299  
300              SingleOpcode(opcode, v0: v0, v1: v1);
301  
302              CompareAgainstUnicorn();
303          }
304  
305          [Test, Pairwise, Description("INS <Vd>.B[<index>], W<n>")]
306          public void Ins_Gp_WB([Values(0u)] uint rd,
307                                [Values(1u, 31u)] uint rn,
308                                [ValueSource(nameof(_8B_))] ulong z,
309                                [ValueSource(nameof(_W_))] uint wn,
310                                [Values(0u, 15u)] uint index)
311          {
312              const int TestSize = 0;
313  
314              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
315  
316              uint opcode = 0x4E001C00; // RESERVED
317              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
318              opcode |= (imm5 << 16);
319  
320              uint w31 = TestContext.CurrentContext.Random.NextUInt();
321              V128 v0 = MakeVectorE0E1(z, z);
322  
323              SingleOpcode(opcode, x1: wn, x31: w31, v0: v0);
324  
325              CompareAgainstUnicorn();
326          }
327  
328          [Test, Pairwise, Description("INS <Vd>.H[<index>], W<n>")]
329          public void Ins_Gp_WH([Values(0u)] uint rd,
330                                [Values(1u, 31u)] uint rn,
331                                [ValueSource(nameof(_4H_))] ulong z,
332                                [ValueSource(nameof(_W_))] uint wn,
333                                [Values(0u, 7u)] uint index)
334          {
335              const int TestSize = 1;
336  
337              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
338  
339              uint opcode = 0x4E001C00; // RESERVED
340              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
341              opcode |= (imm5 << 16);
342  
343              uint w31 = TestContext.CurrentContext.Random.NextUInt();
344              V128 v0 = MakeVectorE0E1(z, z);
345  
346              SingleOpcode(opcode, x1: wn, x31: w31, v0: v0);
347  
348              CompareAgainstUnicorn();
349          }
350  
351          [Test, Pairwise, Description("INS <Vd>.S[<index>], W<n>")]
352          public void Ins_Gp_WS([Values(0u)] uint rd,
353                                [Values(1u, 31u)] uint rn,
354                                [ValueSource(nameof(_2S_))] ulong z,
355                                [ValueSource(nameof(_W_))] uint wn,
356                                [Values(0u, 1u, 2u, 3u)] uint index)
357          {
358              const int TestSize = 2;
359  
360              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
361  
362              uint opcode = 0x4E001C00; // RESERVED
363              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
364              opcode |= (imm5 << 16);
365  
366              uint w31 = TestContext.CurrentContext.Random.NextUInt();
367              V128 v0 = MakeVectorE0E1(z, z);
368  
369              SingleOpcode(opcode, x1: wn, x31: w31, v0: v0);
370  
371              CompareAgainstUnicorn();
372          }
373  
374          [Test, Pairwise, Description("INS <Vd>.D[<index>], X<n>")]
375          public void Ins_Gp_XD([Values(0u)] uint rd,
376                                [Values(1u, 31u)] uint rn,
377                                [ValueSource(nameof(_1D_))] ulong z,
378                                [ValueSource(nameof(_X_))] ulong xn,
379                                [Values(0u, 1u)] uint index)
380          {
381              const int TestSize = 3;
382  
383              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
384  
385              uint opcode = 0x4E001C00; // RESERVED
386              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
387              opcode |= (imm5 << 16);
388  
389              ulong x31 = TestContext.CurrentContext.Random.NextULong();
390              V128 v0 = MakeVectorE0E1(z, z);
391  
392              SingleOpcode(opcode, x1: xn, x31: x31, v0: v0);
393  
394              CompareAgainstUnicorn();
395          }
396  
397          [Test, Pairwise, Description("INS <Vd>.B[<index1>], <Vn>.B[<index2>]")]
398          public void Ins_V_BB([Values(0u)] uint rd,
399                               [Values(1u, 0u)] uint rn,
400                               [ValueSource(nameof(_8B_))] ulong z,
401                               [ValueSource(nameof(_8B_))] ulong a,
402                               [Values(0u, 15u)] uint dstIndex,
403                               [Values(0u, 15u)] uint srcIndex)
404          {
405              const int TestSize = 0;
406  
407              uint imm5 = (dstIndex << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
408              uint imm4 = (srcIndex << TestSize) & 0xFu;
409  
410              uint opcode = 0x6E000400; // RESERVED
411              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
412              opcode |= (imm5 << 16);
413              opcode |= (imm4 << 11);
414  
415              V128 v0 = MakeVectorE0E1(z, z);
416              V128 v1 = MakeVectorE0E1(a, a);
417  
418              SingleOpcode(opcode, v0: v0, v1: v1);
419  
420              CompareAgainstUnicorn();
421          }
422  
423          [Test, Pairwise, Description("INS <Vd>.H[<index1>], <Vn>.H[<index2>]")]
424          public void Ins_V_HH([Values(0u)] uint rd,
425                               [Values(1u, 0u)] uint rn,
426                               [ValueSource(nameof(_4H_))] ulong z,
427                               [ValueSource(nameof(_4H_))] ulong a,
428                               [Values(0u, 7u)] uint dstIndex,
429                               [Values(0u, 7u)] uint srcIndex)
430          {
431              const int TestSize = 1;
432  
433              uint imm5 = (dstIndex << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
434              uint imm4 = (srcIndex << TestSize) & 0xFu;
435  
436              uint opcode = 0x6E000400; // RESERVED
437              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
438              opcode |= (imm5 << 16);
439              opcode |= (imm4 << 11);
440  
441              V128 v0 = MakeVectorE0E1(z, z);
442              V128 v1 = MakeVectorE0E1(a, a);
443  
444              SingleOpcode(opcode, v0: v0, v1: v1);
445  
446              CompareAgainstUnicorn();
447          }
448  
449          [Test, Pairwise, Description("INS <Vd>.S[<index1>], <Vn>.S[<index2>]")]
450          public void Ins_V_SS([Values(0u)] uint rd,
451                               [Values(1u, 0u)] uint rn,
452                               [ValueSource(nameof(_2S_))] ulong z,
453                               [ValueSource(nameof(_2S_))] ulong a,
454                               [Values(0u, 1u, 2u, 3u)] uint dstIndex,
455                               [Values(0u, 1u, 2u, 3u)] uint srcIndex)
456          {
457              const int TestSize = 2;
458  
459              uint imm5 = (dstIndex << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
460              uint imm4 = (srcIndex << TestSize) & 0xFu;
461  
462              uint opcode = 0x6E000400; // RESERVED
463              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
464              opcode |= (imm5 << 16);
465              opcode |= (imm4 << 11);
466  
467              V128 v0 = MakeVectorE0E1(z, z);
468              V128 v1 = MakeVectorE0E1(a, a);
469  
470              SingleOpcode(opcode, v0: v0, v1: v1);
471  
472              CompareAgainstUnicorn();
473          }
474  
475          [Test, Pairwise, Description("INS <Vd>.D[<index1>], <Vn>.D[<index2>]")]
476          public void Ins_V_DD([Values(0u)] uint rd,
477                               [Values(1u, 0u)] uint rn,
478                               [ValueSource(nameof(_1D_))] ulong z,
479                               [ValueSource(nameof(_1D_))] ulong a,
480                               [Values(0u, 1u)] uint dstIndex,
481                               [Values(0u, 1u)] uint srcIndex)
482          {
483              const int TestSize = 3;
484  
485              uint imm5 = (dstIndex << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
486              uint imm4 = (srcIndex << TestSize) & 0xFu;
487  
488              uint opcode = 0x6E000400; // RESERVED
489              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
490              opcode |= (imm5 << 16);
491              opcode |= (imm4 << 11);
492  
493              V128 v0 = MakeVectorE0E1(z, z);
494              V128 v1 = MakeVectorE0E1(a, a);
495  
496              SingleOpcode(opcode, v0: v0, v1: v1);
497  
498              CompareAgainstUnicorn();
499          }
500  
501          [Test, Pairwise, Description("SMOV <Wd>, <Vn>.B[<index>]")]
502          public void Smov_S_BW([Values(0u, 31u)] uint rd,
503                                [Values(1u)] uint rn,
504                                [ValueSource(nameof(_8B_))] ulong a,
505                                [Values(0u, 15u)] uint index)
506          {
507              const int TestSize = 0;
508  
509              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
510  
511              uint opcode = 0x0E002C00; // RESERVED
512              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
513              opcode |= (imm5 << 16);
514  
515              ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
516              uint w31 = TestContext.CurrentContext.Random.NextUInt();
517              V128 v1 = MakeVectorE0E1(a, a);
518  
519              SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
520  
521              CompareAgainstUnicorn();
522          }
523  
524          [Test, Pairwise, Description("SMOV <Wd>, <Vn>.H[<index>]")]
525          public void Smov_S_HW([Values(0u, 31u)] uint rd,
526                                [Values(1u)] uint rn,
527                                [ValueSource(nameof(_4H_))] ulong a,
528                                [Values(0u, 7u)] uint index)
529          {
530              const int TestSize = 1;
531  
532              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
533  
534              uint opcode = 0x0E002C00; // RESERVED
535              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
536              opcode |= (imm5 << 16);
537  
538              ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
539              uint w31 = TestContext.CurrentContext.Random.NextUInt();
540              V128 v1 = MakeVectorE0E1(a, a);
541  
542              SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
543  
544              CompareAgainstUnicorn();
545          }
546  
547          [Test, Pairwise, Description("SMOV <Xd>, <Vn>.B[<index>]")]
548          public void Smov_S_BX([Values(0u, 31u)] uint rd,
549                                [Values(1u)] uint rn,
550                                [ValueSource(nameof(_8B_))] ulong a,
551                                [Values(0u, 15u)] uint index)
552          {
553              const int TestSize = 0;
554  
555              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
556  
557              uint opcode = 0x4E002C00; // RESERVED
558              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
559              opcode |= (imm5 << 16);
560  
561              ulong x31 = TestContext.CurrentContext.Random.NextULong();
562              V128 v1 = MakeVectorE0E1(a, a);
563  
564              SingleOpcode(opcode, x31: x31, v1: v1);
565  
566              CompareAgainstUnicorn();
567          }
568  
569          [Test, Pairwise, Description("SMOV <Xd>, <Vn>.H[<index>]")]
570          public void Smov_S_HX([Values(0u, 31u)] uint rd,
571                                [Values(1u)] uint rn,
572                                [ValueSource(nameof(_4H_))] ulong a,
573                                [Values(0u, 7u)] uint index)
574          {
575              const int TestSize = 1;
576  
577              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
578  
579              uint opcode = 0x4E002C00; // RESERVED
580              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
581              opcode |= (imm5 << 16);
582  
583              ulong x31 = TestContext.CurrentContext.Random.NextULong();
584              V128 v1 = MakeVectorE0E1(a, a);
585  
586              SingleOpcode(opcode, x31: x31, v1: v1);
587  
588              CompareAgainstUnicorn();
589          }
590  
591          [Test, Pairwise, Description("SMOV <Xd>, <Vn>.S[<index>]")]
592          public void Smov_S_SX([Values(0u, 31u)] uint rd,
593                                [Values(1u)] uint rn,
594                                [ValueSource(nameof(_2S_))] ulong a,
595                                [Values(0u, 1u, 2u, 3u)] uint index)
596          {
597              const int TestSize = 2;
598  
599              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
600  
601              uint opcode = 0x4E002C00; // RESERVED
602              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
603              opcode |= (imm5 << 16);
604  
605              ulong x31 = TestContext.CurrentContext.Random.NextULong();
606              V128 v1 = MakeVectorE0E1(a, a);
607  
608              SingleOpcode(opcode, x31: x31, v1: v1);
609  
610              CompareAgainstUnicorn();
611          }
612  
613          [Test, Pairwise, Description("UMOV <Wd>, <Vn>.B[<index>]")]
614          public void Umov_S_BW([Values(0u, 31u)] uint rd,
615                                [Values(1u)] uint rn,
616                                [ValueSource(nameof(_8B_))] ulong a,
617                                [Values(0u, 15u)] uint index)
618          {
619              const int TestSize = 0;
620  
621              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
622  
623              uint opcode = 0x0E003C00; // RESERVED
624              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
625              opcode |= (imm5 << 16);
626  
627              ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
628              uint w31 = TestContext.CurrentContext.Random.NextUInt();
629              V128 v1 = MakeVectorE0E1(a, a);
630  
631              SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
632  
633              CompareAgainstUnicorn();
634          }
635  
636          [Test, Pairwise, Description("UMOV <Wd>, <Vn>.H[<index>]")]
637          public void Umov_S_HW([Values(0u, 31u)] uint rd,
638                                [Values(1u)] uint rn,
639                                [ValueSource(nameof(_4H_))] ulong a,
640                                [Values(0u, 7u)] uint index)
641          {
642              const int TestSize = 1;
643  
644              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
645  
646              uint opcode = 0x0E003C00; // RESERVED
647              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
648              opcode |= (imm5 << 16);
649  
650              ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
651              uint w31 = TestContext.CurrentContext.Random.NextUInt();
652              V128 v1 = MakeVectorE0E1(a, a);
653  
654              SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
655  
656              CompareAgainstUnicorn();
657          }
658  
659          [Test, Pairwise, Description("UMOV <Wd>, <Vn>.S[<index>]")]
660          public void Umov_S_SW([Values(0u, 31u)] uint rd,
661                                [Values(1u)] uint rn,
662                                [ValueSource(nameof(_2S_))] ulong a,
663                                [Values(0u, 1u, 2u, 3u)] uint index)
664          {
665              const int TestSize = 2;
666  
667              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
668  
669              uint opcode = 0x0E003C00; // RESERVED
670              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
671              opcode |= (imm5 << 16);
672  
673              ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
674              uint w31 = TestContext.CurrentContext.Random.NextUInt();
675              V128 v1 = MakeVectorE0E1(a, a);
676  
677              SingleOpcode(opcode, x0: x0, x31: w31, v1: v1);
678  
679              CompareAgainstUnicorn();
680          }
681  
682          [Test, Pairwise, Description("UMOV <Xd>, <Vn>.D[<index>]")]
683          public void Umov_S_DX([Values(0u, 31u)] uint rd,
684                                [Values(1u)] uint rn,
685                                [ValueSource(nameof(_1D_))] ulong a,
686                                [Values(0u, 1u)] uint index)
687          {
688              const int TestSize = 3;
689  
690              uint imm5 = (index << (TestSize + 1) | 1u << TestSize) & 0x1Fu;
691  
692              uint opcode = 0x4E003C00; // RESERVED
693              opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
694              opcode |= (imm5 << 16);
695  
696              ulong x31 = TestContext.CurrentContext.Random.NextULong();
697              V128 v1 = MakeVectorE0E1(a, a);
698  
699              SingleOpcode(opcode, x31: x31, v1: v1);
700  
701              CompareAgainstUnicorn();
702          }
703  #endif
704      }
705  }