OpCode32SimdImm.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCode32SimdImm : OpCode32SimdBase, IOpCode32SimdImm
  4. {
  5. public bool Q { get; }
  6. public long Immediate { get; }
  7. public int Elems => GetBytesCount() >> Size;
  8. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdImm(inst, address, opCode, false);
  9. public static OpCode CreateT32(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdImm(inst, address, opCode, true);
  10. public OpCode32SimdImm(InstDescriptor inst, ulong address, int opCode, bool isThumb) : base(inst, address, opCode, isThumb)
  11. {
  12. Vd = (opCode >> 12) & 0xf;
  13. Vd |= (opCode >> 18) & 0x10;
  14. Q = ((opCode >> 6) & 0x1) > 0;
  15. int cMode = (opCode >> 8) & 0xf;
  16. int op = (opCode >> 5) & 0x1;
  17. long imm;
  18. imm = ((uint)opCode >> 0) & 0xf;
  19. imm |= ((uint)opCode >> 12) & 0x70;
  20. imm |= ((uint)opCode >> (isThumb ? 21 : 17)) & 0x80;
  21. (Immediate, Size) = OpCodeSimdHelper.GetSimdImmediateAndSize(cMode, op, imm);
  22. RegisterSize = Q ? RegisterSize.Simd128 : RegisterSize.Simd64;
  23. if (DecoderHelper.VectorArgumentsInvalid(Q, Vd))
  24. {
  25. Instruction = InstDescriptor.Undefined;
  26. }
  27. }
  28. }
  29. }