OpCode32SimdS.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCode32SimdS : OpCode32, IOpCode32Simd
  4. {
  5. public int Vd { get; protected set; }
  6. public int Vm { get; protected set; }
  7. public int Opc { get; protected set; } // "with_zero" (Opc<1>) [Vcmp, Vcmpe].
  8. public int Opc2 { get; } // opc2 or RM (opc2<1:0>) [Vcvt, Vrint].
  9. public int Size { get; protected set; }
  10. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdS(inst, address, opCode, false);
  11. public static OpCode CreateT32(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdS(inst, address, opCode, true);
  12. public OpCode32SimdS(InstDescriptor inst, ulong address, int opCode, bool isThumb) : base(inst, address, opCode)
  13. {
  14. IsThumb = isThumb;
  15. Opc = (opCode >> 15) & 0x3;
  16. Opc2 = (opCode >> 16) & 0x7;
  17. Size = (opCode >> 8) & 0x3;
  18. bool single = Size != 3;
  19. RegisterSize = single ? RegisterSize.Int32 : RegisterSize.Int64;
  20. if (single)
  21. {
  22. Vm = ((opCode >> 5) & 0x1) | ((opCode << 1) & 0x1e);
  23. Vd = ((opCode >> 22) & 0x1) | ((opCode >> 11) & 0x1e);
  24. }
  25. else
  26. {
  27. Vm = ((opCode >> 1) & 0x10) | ((opCode >> 0) & 0xf);
  28. Vd = ((opCode >> 18) & 0x10) | ((opCode >> 12) & 0xf);
  29. }
  30. }
  31. }
  32. }