aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Decoders/OpCode32SimdMovGpDouble.cs
blob: dc89b719bc74a14f43cdfef524fd93fd011e28ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace ARMeilleure.Decoders
{
    class OpCode32SimdMovGpDouble : OpCode32, IOpCode32Simd
    {
        public int Size => 3;

        public int Vm { get; }
        public int Rt { get; }
        public int Rt2 { get; }
        public int Op { get; }

        public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCode32SimdMovGpDouble(inst, address, opCode);

        public OpCode32SimdMovGpDouble(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
        {
            // Which one is used is instruction dependant.
            Op = (opCode >> 20) & 0x1;

            Rt = (opCode >> 12) & 0xf;
            Rt2 = (opCode >> 16) & 0xf;

            bool single = (opCode & (1 << 8)) == 0;
            if (single)
            {
                Vm = ((opCode >> 5) & 0x1) | ((opCode << 1) & 0x1e);
            }
            else
            {
                Vm = ((opCode >> 1) & 0x10) | ((opCode >> 0) & 0xf);
            }
        }
    }
}