OpCode32SimdMovGpElem.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCode32SimdMovGpElem : OpCode32, IOpCode32Simd
  4. {
  5. public int Size { get; }
  6. public int Vd { get; }
  7. public int Rt { get; }
  8. public int Op { get; }
  9. public bool U { get; }
  10. public int Index { get; }
  11. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdMovGpElem(inst, address, opCode);
  12. public OpCode32SimdMovGpElem(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
  13. {
  14. Op = (opCode >> 20) & 0x1;
  15. U = ((opCode >> 23) & 1) != 0;
  16. var opc = (((opCode >> 23) & 1) << 4) | (((opCode >> 21) & 0x3) << 2) | ((opCode >> 5) & 0x3);
  17. if ((opc & 0b01000) == 0b01000)
  18. {
  19. Size = 0;
  20. Index = opc & 0x7;
  21. }
  22. else if ((opc & 0b01001) == 0b00001)
  23. {
  24. Size = 1;
  25. Index = (opc >> 1) & 0x3;
  26. }
  27. else if ((opc & 0b11011) == 0)
  28. {
  29. Size = 2;
  30. Index = (opc >> 2) & 0x1;
  31. }
  32. else
  33. {
  34. Instruction = InstDescriptor.Undefined;
  35. return;
  36. }
  37. Vd = ((opCode >> 3) & 0x10) | ((opCode >> 16) & 0xf);
  38. Rt = (opCode >> 12) & 0xf;
  39. }
  40. }
  41. }