OpCode32SimdShImm.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCode32SimdShImm : OpCode32Simd
  4. {
  5. public int Shift { get; private set; }
  6. public OpCode32SimdShImm(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
  7. {
  8. int imm6 = (opCode >> 16) & 0x3f;
  9. int limm6 = ((opCode >> 1) & 0x40) | imm6;
  10. if ((limm6 & 0x40) == 0b1000000)
  11. {
  12. Size = 3;
  13. Shift = imm6;
  14. }
  15. else if ((limm6 & 0x60) == 0b0100000)
  16. {
  17. Size = 2;
  18. Shift = imm6 - 32;
  19. }
  20. else if ((limm6 & 0x70) == 0b0010000)
  21. {
  22. Size = 1;
  23. Shift = imm6 - 16;
  24. }
  25. else if ((limm6 & 0x78) == 0b0001000)
  26. {
  27. Size = 0;
  28. Shift = imm6 - 8;
  29. }
  30. else
  31. {
  32. Instruction = InstDescriptor.Undefined;
  33. }
  34. if (GetType() == typeof(OpCode32SimdShImm) && DecoderHelper.VectorArgumentsInvalid(Q, Vd, Vm))
  35. {
  36. Instruction = InstDescriptor.Undefined;
  37. }
  38. }
  39. }
  40. }