OpCode32SimdShImm.cs 1.3 KB

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