OpCode32SimdDupElem.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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);
  7. public OpCode32SimdDupElem(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
  8. {
  9. var opc = (opCode >> 16) & 0xf;
  10. if ((opc & 0b1) == 1)
  11. {
  12. Size = 0;
  13. Index = (opc >> 1) & 0x7;
  14. }
  15. else if ((opc & 0b11) == 0b10)
  16. {
  17. Size = 1;
  18. Index = (opc >> 2) & 0x3;
  19. }
  20. else if ((opc & 0b111) == 0b100)
  21. {
  22. Size = 2;
  23. Index = (opc >> 3) & 0x1;
  24. }
  25. else
  26. {
  27. Instruction = InstDescriptor.Undefined;
  28. }
  29. Vd = ((opCode >> 18) & 0x10) | ((opCode >> 12) & 0xf);
  30. Vm = ((opCode >> 1) & 0x10) | ((opCode >> 0) & 0xf);
  31. if (DecoderHelper.VectorArgumentsInvalid(Q, Vd))
  32. {
  33. Instruction = InstDescriptor.Undefined;
  34. }
  35. }
  36. }
  37. }