CpuTestSimdLogical32.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #define SimdLogical32
  2. using ARMeilleure.State;
  3. using NUnit.Framework;
  4. using System;
  5. namespace Ryujinx.Tests.Cpu
  6. {
  7. [Category("SimdLogical32")]
  8. public sealed class CpuTestSimdLogical32 : CpuTest32
  9. {
  10. #if SimdLogical32
  11. #region "ValueSource (Opcodes)"
  12. private static uint[] _Vbif_Vbit_Vbsl_Vand_()
  13. {
  14. return new uint[]
  15. {
  16. 0xf3300110u, // VBIF D0, D0, D0
  17. 0xf3200110u, // VBIT D0, D0, D0
  18. 0xf3100110u, // VBSL D0, D0, D0
  19. 0xf2000110u // VAND D0, D0, D0
  20. };
  21. }
  22. #endregion
  23. private const int RndCnt = 2;
  24. [Test, Pairwise]
  25. public void Vbif_Vbit_Vbsl_Vand([ValueSource("_Vbif_Vbit_Vbsl_Vand_")] uint opcode,
  26. [Range(0u, 4u)] uint rd,
  27. [Range(0u, 4u)] uint rn,
  28. [Range(0u, 4u)] uint rm,
  29. [Random(RndCnt)] ulong z,
  30. [Random(RndCnt)] ulong a,
  31. [Random(RndCnt)] ulong b,
  32. [Values] bool q)
  33. {
  34. if (q)
  35. {
  36. opcode |= 1 << 6;
  37. rm <<= 1;
  38. rn <<= 1;
  39. rd <<= 1;
  40. }
  41. opcode |= ((rm & 0xf) << 0) | ((rm & 0x10) << 1);
  42. opcode |= ((rd & 0xf) << 12) | ((rd & 0x10) << 18);
  43. opcode |= ((rn & 0xf) << 16) | ((rn & 0x10) << 3);
  44. V128 v0 = MakeVectorE0E1(z, z);
  45. V128 v1 = MakeVectorE0E1(a, z);
  46. V128 v2 = MakeVectorE0E1(b, z);
  47. SingleOpcode(opcode, v0: v0, v1: v1, v2: v2);
  48. CompareAgainstUnicorn();
  49. }
  50. #endif
  51. }
  52. }