aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Decoders/OpCode32SimdShImmLong.cs
blob: 3ca55ed6fe6465b19010b22343c37654e9e58a07 (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
34
35
36
37
38
39
40
41
42
namespace ARMeilleure.Decoders
{
    class OpCode32SimdShImmLong : OpCode32Simd
    {
        public int Shift { get; }

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

        public OpCode32SimdShImmLong(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
        {
            Q = false;
            RegisterSize = RegisterSize.Simd64;

            int imm6 = (opCode >> 16) & 0x3f;

            if ((imm6 & 0x20) == 0b100000)
            {
                Size = 2;
                Shift = imm6 - 32;
            }
            else if ((imm6 & 0x30) == 0b010000)
            {
                Size = 1;
                Shift = imm6 - 16;
            }
            else if ((imm6 & 0x38) == 0b001000)
            {
                Size = 0;
                Shift = imm6 - 8;
            }
            else
            {
                Instruction = InstDescriptor.Undefined;
            }

            if (GetType() == typeof(OpCode32SimdShImmLong) && DecoderHelper.VectorArgumentsInvalid(true, Vd))
            {
                Instruction = InstDescriptor.Undefined;
            }
        }
    }
}