OpCode32SimdImm44.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCode32SimdImm44 : OpCode32, IOpCode32SimdImm
  4. {
  5. public int Vd { get; }
  6. public long Immediate { get; }
  7. public int Size { get; }
  8. public int Elems { get; }
  9. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdImm44(inst, address, opCode, false);
  10. public static OpCode CreateT32(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdImm44(inst, address, opCode, true);
  11. public OpCode32SimdImm44(InstDescriptor inst, ulong address, int opCode, bool isThumb) : base(inst, address, opCode)
  12. {
  13. IsThumb = isThumb;
  14. Size = (opCode >> 8) & 0x3;
  15. bool single = Size != 3;
  16. if (single)
  17. {
  18. Vd = ((opCode >> 22) & 0x1) | ((opCode >> 11) & 0x1e);
  19. }
  20. else
  21. {
  22. Vd = ((opCode >> 18) & 0x10) | ((opCode >> 12) & 0xf);
  23. }
  24. long imm;
  25. imm = ((uint)opCode >> 0) & 0xf;
  26. imm |= ((uint)opCode >> 12) & 0xf0;
  27. Immediate = (Size == 3) ? (long)DecoderHelper.Imm8ToFP64Table[(int)imm] : DecoderHelper.Imm8ToFP32Table[(int)imm];
  28. RegisterSize = (!single) ? RegisterSize.Int64 : RegisterSize.Int32;
  29. Elems = 1;
  30. }
  31. }
  32. }