OpCode32SimdDupElem.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCode32SimdDupElem : OpCode32Simd
  4. {
  5. public int Index { get; }
  6. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdDupElem(inst, address, opCode, false);
  7. public new static OpCode CreateT32(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdDupElem(inst, address, opCode, true);
  8. public OpCode32SimdDupElem(InstDescriptor inst, ulong address, int opCode, bool isThumb) : base(inst, address, opCode, isThumb)
  9. {
  10. var opc = (opCode >> 16) & 0xf;
  11. if ((opc & 0b1) == 1)
  12. {
  13. Size = 0;
  14. Index = (opc >> 1) & 0x7;
  15. }
  16. else if ((opc & 0b11) == 0b10)
  17. {
  18. Size = 1;
  19. Index = (opc >> 2) & 0x3;
  20. }
  21. else if ((opc & 0b111) == 0b100)
  22. {
  23. Size = 2;
  24. Index = (opc >> 3) & 0x1;
  25. }
  26. else
  27. {
  28. Instruction = InstDescriptor.Undefined;
  29. }
  30. Vd = ((opCode >> 18) & 0x10) | ((opCode >> 12) & 0xf);
  31. Vm = ((opCode >> 1) & 0x10) | ((opCode >> 0) & 0xf);
  32. if (DecoderHelper.VectorArgumentsInvalid(Q, Vd))
  33. {
  34. Instruction = InstDescriptor.Undefined;
  35. }
  36. }
  37. }
  38. }