private static void EmitHighNarrow(AILEmitterCtx Context, Action Emit, bool Round)
        {
            AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;

            int Elems = 8 >> Op.Size;
            int ESize = 8 << Op.Size;

            int Part = Op.RegisterSize == ARegisterSize.SIMD128 ? Elems : 0;

            for (int Index = 0; Index < Elems; Index++)
            {
                EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size + 1);
                EmitVectorExtractZx(Context, Op.Rm, Index, Op.Size + 1);

                Emit();

                if (Round)
                {
                    Context.EmitLdc_I8(1L << (ESize - 1));

                    Context.Emit(OpCodes.Add);
                }

                Context.EmitLsr(ESize);

                EmitVectorInsert(Context, Op.Rd, Part + Index, Op.Size);
            }

            if (Part == 0)
            {
                EmitVectorZeroUpper(Context, Op.Rd);
            }
        }
        public static void EmitDataLoadOper2(AILEmitterCtx Context)
        {
            switch (Context.CurrOp)
            {
            case IAOpCodeAluImm Op:
                Context.EmitLdc_I(Op.Imm);
                break;

            case IAOpCodeAluRs Op:
                Context.EmitLdintzr(Op.Rm);

                switch (Op.ShiftType)
                {
                case AShiftType.Lsl: Context.EmitLsl(Op.Shift); break;

                case AShiftType.Lsr: Context.EmitLsr(Op.Shift); break;

                case AShiftType.Asr: Context.EmitAsr(Op.Shift); break;

                case AShiftType.Ror: Context.EmitRor(Op.Shift); break;
                }
                break;

            case IAOpCodeAluRx Op:
                Context.EmitLdintzr(Op.Rm);
                Context.EmitCast(Op.IntType);
                Context.EmitLsl(Op.Shift);
                break;
            }
        }
示例#3
0
        private static void EmitBfiz(AILEmitterCtx Context, bool Signed)
        {
            AOpCodeBfm Op = (AOpCodeBfm)Context.CurrOp;

            int Width = Op.Pos + 1;

            Context.EmitLdintzr(Op.Rn);

            Context.EmitLsl(Op.GetBitsCount() - Width);

            if (Signed)
            {
                Context.EmitAsr(Op.Shift - Width);
            }
            else
            {
                Context.EmitLsr(Op.Shift - Width);
            }

            Context.EmitStintzr(Op.Rd);
        }