示例#1
0
        public AOpCodeSimdImm(AInst Inst, long Position, int OpCode) : base(Inst, Position, OpCode)
        {
            Rd = OpCode & 0x1f;

            int CMode = (OpCode >> 12) & 0xf;
            int Op    = (OpCode >> 29) & 0x1;

            int ModeLow  = CMode & 1;
            int ModeHigh = CMode >> 1;

            long Imm;

            Imm  = ((uint)OpCode >> 5) & 0x1f;
            Imm |= ((uint)OpCode >> 11) & 0xe0;

            if (ModeHigh == 0b111)
            {
                Size = ModeLow != 0 ? Op : 3;

                switch (Op | (ModeLow << 1))
                {
                case 0:
                    //64-bits Immediate.
                    //Transform abcd efgh into abcd efgh abcd efgh ...
                    Imm = (long)((ulong)Imm * 0x0101010101010101);
                    break;

                case 1:
                    //64-bits Immediate.
                    //Transform abcd efgh into aaaa aaaa bbbb bbbb ...
                    Imm = (Imm & 0xf0) >> 4 | (Imm & 0x0f) << 4;
                    Imm = (Imm & 0xcc) >> 2 | (Imm & 0x33) << 2;
                    Imm = (Imm & 0xaa) >> 1 | (Imm & 0x55) << 1;

                    Imm = (long)((ulong)Imm * 0x8040201008040201);
                    Imm = (long)((ulong)Imm & 0x8080808080808080);

                    Imm |= Imm >> 4;
                    Imm |= Imm >> 2;
                    Imm |= Imm >> 1;
                    break;

                case 2:
                case 3:
                    //Floating point Immediate.
                    Imm = ADecoderHelper.DecodeImm8Float(Imm, Size);
                    break;
                }
            }
            else if ((ModeHigh & 0b110) == 0b100)
            {
                //16-bits shifted Immediate.
                Size = 1; Imm <<= (ModeHigh & 1) << 3;
            }
示例#2
0
        public AOpCodeSimdFmov(AInst Inst, long Position, int OpCode) : base(Inst, Position, OpCode)
        {
            int Imm5 = (OpCode >> 5) & 0x1f;
            int Type = (OpCode >> 22) & 0x3;

            if (Imm5 != 0b00000 || Type > 1)
            {
                Emitter = AInstEmit.Und;

                return;
            }

            Size = Type;

            long Imm;

            Rd  = (OpCode >> 0) & 0x1f;
            Imm = (OpCode >> 13) & 0xff;

            this.Imm = ADecoderHelper.DecodeImm8Float(Imm, Type);
        }