Example #1
0
        public static void Rev64(AILEmitterCtx Context)
        {
            AOpCodeAlu Op = (AOpCodeAlu)Context.CurrOp;

            Context.EmitLdintzr(Op.Rn);

            ASoftFallback.EmitCall(Context, nameof(ASoftFallback.ReverseBytes64));

            Context.EmitStintzr(Op.Rd);
        }
Example #2
0
        public static void Clz(AILEmitterCtx Context)
        {
            AOpCodeAlu Op = (AOpCodeAlu)Context.CurrOp;

            Context.EmitLdintzr(Op.Rn);

            Context.EmitLdc_I4(Op.RegisterSize == ARegisterSize.Int32 ? 32 : 64);

            ASoftFallback.EmitCall(Context, nameof(ASoftFallback.CountLeadingZeros));

            Context.EmitStintzr(Op.Rd);
        }
Example #3
0
        private static void EmitFallback32_64(AILEmitterCtx Context, string Name32, string Name64)
        {
            AOpCodeAlu Op = (AOpCodeAlu)Context.CurrOp;

            Context.EmitLdintzr(Op.Rn);

            if (Op.RegisterSize == ARegisterSize.Int32)
            {
                ASoftFallback.EmitCall(Context, Name32);
            }
            else
            {
                ASoftFallback.EmitCall(Context, Name64);
            }

            Context.EmitStintzr(Op.Rd);
        }
Example #4
0
        public static void Cls(AILEmitterCtx Context)
        {
            AOpCodeAlu Op = (AOpCodeAlu)Context.CurrOp;

            Context.EmitLdintzr(Op.Rn);

            if (Op.RegisterSize == ARegisterSize.Int32)
            {
                ASoftFallback.EmitCall(Context, nameof(ASoftFallback.CountLeadingSigns32));
            }
            else
            {
                ASoftFallback.EmitCall(Context, nameof(ASoftFallback.CountLeadingSigns64));
            }

            Context.EmitStintzr(Op.Rd);
        }
Example #5
0
        public static void Clz(AILEmitterCtx Context)
        {
            AOpCodeAlu Op = (AOpCodeAlu)Context.CurrOp;

            Context.EmitLdintzr(Op.Rn);

            if (Lzcnt.IsSupported)
            {
                Type TValue = Op.RegisterSize == ARegisterSize.Int32 ? typeof(uint) : typeof(ulong);

                Context.EmitCall(typeof(Lzcnt).GetMethod(nameof(Lzcnt.LeadingZeroCount), new Type[] { TValue }));
            }
            else
            {
                Context.EmitLdc_I4(Op.RegisterSize == ARegisterSize.Int32 ? 32 : 64);

                ASoftFallback.EmitCall(Context, nameof(ASoftFallback.CountLeadingZeros));
            }

            Context.EmitStintzr(Op.Rd);
        }