private static void EmitMathOp3(AILEmitterCtx Context, string Name) { AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp; Context.EmitLdvecsf(Op.Rn); Context.EmitLdvecsf(Op.Rm); MethodInfo MthdInfo; if (Op.Size == 0) { MthdInfo = typeof(MathF).GetMethod(Name, new Type[] { typeof(float), typeof(float) }); } else if (Op.Size == 1) { MthdInfo = typeof(Math).GetMethod(Name, new Type[] { typeof(double), typeof(double) }); } else { throw new InvalidOperationException(); } Context.EmitCall(MthdInfo); Context.EmitStvecsf(Op.Rd); }
public static void Frintm_S(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvecsf(Op.Rn); MethodInfo MthdInfo; if (Op.Size == 0) { MthdInfo = typeof(MathF).GetMethod(nameof(MathF.Floor), new Type[] { typeof(float) }); } else if (Op.Size == 1) { MthdInfo = typeof(Math).GetMethod(nameof(Math.Floor), new Type[] { typeof(double) }); } else { throw new InvalidOperationException(); } Context.EmitCall(MthdInfo); Context.EmitStvecsf(Op.Rd); }
public static void Frinta_S(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvecsf(Op.Rn); Context.EmitLdc_I4((int)MidpointRounding.AwayFromZero); MethodInfo MthdInfo; if (Op.Size == 0) { Type[] Types = new Type[] { typeof(float), typeof(MidpointRounding) }; MthdInfo = typeof(MathF).GetMethod(nameof(MathF.Round), Types); } else if (Op.Size == 1) { Type[] Types = new Type[] { typeof(double), typeof(MidpointRounding) }; MthdInfo = typeof(Math).GetMethod(nameof(Math.Round), Types); } else { throw new InvalidOperationException(); } Context.EmitCall(MthdInfo); Context.EmitStvecsf(Op.Rd); }
public static void Fmov_S(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvecsf(Op.Rn); Context.EmitStvecsf(Op.Rd); }
private static void EmitMathOp2(AILEmitterCtx Context, string Name) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvecsf(Op.Rn); EmitMathOpCall(Context, Name); Context.EmitStvecsf(Op.Rd); }
public static void Scvtf_S(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvecsi(Op.Rn); EmitFloatCast(Context, Op.Size); Context.EmitStvecsf(Op.Rd); }
public static void Scvtf_Gp(AILEmitterCtx Context) { AOpCodeSimdCvt Op = (AOpCodeSimdCvt)Context.CurrOp; Context.EmitLdintzr(Op.Rn); EmitFloatCast(Context, Op.Size); Context.EmitStvecsf(Op.Rd); }
public static void Fcsel_S(AILEmitterCtx Context) { AOpCodeSimdFcond Op = (AOpCodeSimdFcond)Context.CurrOp; AILLabel LblTrue = new AILLabel(); AILLabel LblEnd = new AILLabel(); Context.EmitCondBranch(LblTrue, Op.Cond); Context.EmitLdvecsf(Op.Rm); Context.EmitStvecsf(Op.Rd); Context.Emit(OpCodes.Br_S, LblEnd); Context.MarkLabel(LblTrue); Context.EmitLdvecsf(Op.Rn); Context.EmitStvecsf(Op.Rd); Context.MarkLabel(LblEnd); }
public static void Fnmul_S(AILEmitterCtx Context) { AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp; Context.EmitLdvecsf(Op.Rn); Context.EmitLdvecsf(Op.Rm); Context.Emit(OpCodes.Mul); Context.Emit(OpCodes.Neg); Context.EmitStvecsf(Op.Rd); }
private static void EmitScalarOp(AILEmitterCtx Context, OpCode ILOp) { AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp; Context.EmitLdvecsf(Op.Rn); //Negate and Not are the only unary operations supported on IL. //"Not" doesn't work with floats, so we don't need to compare it. if (ILOp != OpCodes.Neg) { Context.EmitLdvecsf(Op.Rm); } Context.Emit(ILOp); Context.EmitStvecsf(Op.Rd); }