OpCode32SimdRegElem.cs 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCode32SimdRegElem : OpCode32SimdReg
  4. {
  5. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdRegElem(inst, address, opCode, false);
  6. public new static OpCode CreateT32(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdRegElem(inst, address, opCode, true);
  7. public OpCode32SimdRegElem(InstDescriptor inst, ulong address, int opCode, bool isThumb) : base(inst, address, opCode, isThumb)
  8. {
  9. Q = ((opCode >> (isThumb ? 28 : 24)) & 0x1) != 0;
  10. F = ((opCode >> 8) & 0x1) != 0;
  11. Size = (opCode >> 20) & 0x3;
  12. RegisterSize = Q ? RegisterSize.Simd128 : RegisterSize.Simd64;
  13. if (Size == 1)
  14. {
  15. Vm = ((opCode >> 3) & 0x1) | ((opCode >> 4) & 0x2) | ((opCode << 2) & 0x1c);
  16. }
  17. else /* if (Size == 2) */
  18. {
  19. Vm = ((opCode >> 5) & 0x1) | ((opCode << 1) & 0x1e);
  20. }
  21. if (GetType() == typeof(OpCode32SimdRegElem) && DecoderHelper.VectorArgumentsInvalid(Q, Vd, Vn) || Size == 0 || (Size == 1 && F))
  22. {
  23. Instruction = InstDescriptor.Undefined;
  24. }
  25. }
  26. }
  27. }