// TSrc (16bit, 32bit, 64bit; signed, unsigned) > TDst (8bit, 16bit, 32bit; signed, unsigned). public static void EmitSatQ( AILEmitterCtx Context, int SizeDst, bool SignedSrc, bool SignedDst) { if (SizeDst > 2) { throw new ArgumentOutOfRangeException(nameof(SizeDst)); } Context.EmitLdc_I4(SizeDst); Context.EmitLdarg(ATranslatedSub.StateArgIdx); if (SignedSrc) { ASoftFallback.EmitCall(Context, SignedDst ? nameof(ASoftFallback.SignedSrcSignedDstSatQ) : nameof(ASoftFallback.SignedSrcUnsignedDstSatQ)); } else { ASoftFallback.EmitCall(Context, SignedDst ? nameof(ASoftFallback.UnsignedSrcSignedDstSatQ) : nameof(ASoftFallback.UnsignedSrcUnsignedDstSatQ)); } }
private static void EmitVectorImmBinaryOp(AILEmitterCtx Context, Action Emit, long Imm, bool Signed) { AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp; int Bytes = Context.CurrOp.GetBitsCount() >> 3; for (int Index = 0; Index < (Bytes >> Op.Size); Index++) { Context.EmitLdvec(Op.Rd); Context.EmitLdc_I4(Index); Context.EmitLdc_I4(Op.Size); EmitVectorExtract(Context, Op.Rn, Index, Op.Size, Signed); Context.EmitLdc_I8(Imm); Emit(); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.InsertVec)); Context.EmitStvec(Op.Rd); } if (Op.RegisterSize == ARegisterSize.SIMD64) { EmitVectorZeroUpper(Context, Op.Rd); } }
private static void EmitCvtToUInt(AILEmitterCtx Context, int Size) { if (Size < 0 || Size > 1) { throw new ArgumentOutOfRangeException(nameof(Size)); } Context.EmitLdc_I4(0); if (Context.CurrOp.RegisterSize == ARegisterSize.Int32) { if (Size == 0) { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SatSingleToUInt32)); } else /* if (Size == 1) */ { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SatDoubleToUInt32)); } } else { if (Size == 0) { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SatSingleToUInt64)); } else /* if (Size == 1) */ { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SatDoubleToUInt64)); } } }
public static void Tbl_V(AILEmitterCtx Context) { AOpCodeSimdTbl Op = (AOpCodeSimdTbl)Context.CurrOp; Context.EmitLdvec(Op.Rm); for (int Index = 0; Index < Op.Size; Index++) { Context.EmitLdvec((Op.Rn + Index) & 0x1f); } switch (Op.Size) { case 1: ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Tbl1_V64), nameof(ASoftFallback.Tbl1_V128)); break; case 2: ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Tbl2_V64), nameof(ASoftFallback.Tbl2_V128)); break; case 3: ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Tbl3_V64), nameof(ASoftFallback.Tbl3_V128)); break; case 4: ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Tbl4_V64), nameof(ASoftFallback.Tbl4_V128)); break; default: throw new InvalidOperationException(); } Context.EmitStvec(Op.Rd); }
public static void Frinti_V(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; int SizeF = Op.Size & 1; EmitVectorUnaryOpF(Context, () => { Context.EmitLdarg(ATranslatedSub.StateArgIdx); Context.EmitCallPropGet(typeof(AThreadState), nameof(AThreadState.Fpcr)); if (SizeF == 0) { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.RoundF)); } else if (SizeF == 1) { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Round)); } else { throw new InvalidOperationException(); } }); }
private static void EmitVectorAddv(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; int Bytes = Context.CurrOp.GetBitsCount() >> 3; EmitVectorZeroLower(Context, Op.Rd); EmitVectorZeroUpper(Context, Op.Rd); Context.EmitLdvec(Op.Rd); Context.EmitLdc_I4(0); Context.EmitLdc_I4(Op.Size); EmitVectorExtractZx(Context, Op.Rn, 0); for (int Index = 1; Index < (Bytes >> Op.Size); Index++) { EmitVectorExtractZx(Context, Op.Rn, Index); Context.Emit(OpCodes.Add); } ASoftFallback.EmitCall(Context, nameof(ASoftFallback.InsertVec)); Context.EmitStvec(Op.Rd); }
private static void EmitScalarFcvtu(AILEmitterCtx Context, int Size, int FBits) { if (Size < 0 || Size > 1) { throw new ArgumentOutOfRangeException(nameof(Size)); } EmitF2iFBitsMul(Context, Size, FBits); if (Context.CurrOp.RegisterSize == ARegisterSize.Int32) { if (Size == 0) { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SatF32ToU32)); } else /* if (Size == 1) */ { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SatF64ToU32)); } } else { if (Size == 0) { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SatF32ToU64)); } else /* if (Size == 1) */ { ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SatF64ToU64)); } } }
public static void Aesmc_V(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvec(Op.Rn); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.MixColumns)); Context.EmitStvec(Op.Rd); }
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); }
private static void EmitVectorInsert(AILEmitterCtx Context, int Reg, int Index, int Size) { Context.EmitLdvec(Reg); Context.EmitLdc_I4(Index); Context.EmitLdc_I4(Size); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.VectorInsertInt)); Context.EmitStvec(Reg); }
public static void Sha256su0_V(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvec(Op.Rd); Context.EmitLdvec(Op.Rn); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.SchedulePart1)); Context.EmitStvec(Op.Rd); }
// TSrc (64bit) == TDst (64bit); signed. public static void EmitUnarySignedSatQAbsOrNeg(AILEmitterCtx Context) { if (((AOpCodeSimd)Context.CurrOp).Size < 3) { throw new InvalidOperationException(); } Context.EmitLdarg(ATranslatedSub.StateArgIdx); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.UnarySignedSatQAbsOrNeg)); }
public static void Umulh(AILEmitterCtx Context) { AOpCodeMul Op = (AOpCodeMul)Context.CurrOp; Context.EmitLdintzr(Op.Rn); Context.EmitLdintzr(Op.Rm); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.UMulHi128)); Context.EmitStintzr(Op.Rd); }
public static void Addp_S(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvec(Op.Rn); Context.EmitLdc_I4(Op.Size); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Addp_S)); Context.EmitStvec(Op.Rd); }
public static void Fmov_Ftoi1(AILEmitterCtx Context) { AOpCodeSimdCvt Op = (AOpCodeSimdCvt)Context.CurrOp; Context.EmitLdvec(Op.Rn); Context.EmitLdc_I4(1); Context.EmitLdc_I4(3); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.ExtractVec)); Context.EmitStintzr(Op.Rd); }
public static void EmitVectorInsertTmp(AILEmitterCtx Context, int Index, int Size) { ThrowIfInvalid(Index, Size); Context.EmitLdvectmp(); Context.EmitLdc_I4(Index); Context.EmitLdc_I4(Size); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.VectorInsertInt)); Context.EmitStvectmp(); }
public static void Cnt_V(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvec(Op.Rn); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Cnt64), nameof(ASoftFallback.Cnt128)); Context.EmitStvec(Op.Rd); }
public static void Sha256h_V(AILEmitterCtx Context) { AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp; Context.EmitLdvec(Op.Rd); Context.EmitLdvec(Op.Rn); Context.EmitLdvec(Op.Rm); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.HashLower)); Context.EmitStvec(Op.Rd); }
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); }
private static void EmitVectorExtract(AILEmitterCtx Context, int Reg, int Index, bool Signed) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvec(Reg); Context.EmitLdc_I4(Index); Context.EmitLdc_I4(Op.Size); ASoftFallback.EmitCall(Context, Signed ? nameof(ASoftFallback.ExtractSVec) : nameof(ASoftFallback.ExtractVec)); }
public static void Fmov_S(AILEmitterCtx Context) { AOpCodeSimdFmov Op = (AOpCodeSimdFmov)Context.CurrOp; Context.EmitLdc_I8(Op.Imm); Context.EmitLdc_I4(0); Context.EmitLdc_I4(Op.Size + 2); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Fmov_S)); Context.EmitStvec(Op.Rd); }
public static void Fmov_Itof1(AILEmitterCtx Context) { AOpCodeSimdCvt Op = (AOpCodeSimdCvt)Context.CurrOp; Context.EmitLdintzr(Op.Rn); Context.EmitLdc_I4(1); Context.EmitLdc_I4(3); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Fmov_S)); Context.EmitStvec(Op.Rd); }
public static void Dup_S(AILEmitterCtx Context) { AOpCodeSimdIns Op = (AOpCodeSimdIns)Context.CurrOp; Context.EmitLdvec(Op.Rn); Context.EmitLdc_I4(Op.DstIndex); Context.EmitLdc_I4(Op.Size); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Dup_S)); Context.EmitStvec(Op.Rd); }
// Dst_64 = (Int(Src_64, Signed) + RoundConst) >> Shift; private static void EmitShrImm_64( AILEmitterCtx Context, bool Signed, long RoundConst, int Shift) { Context.EmitLdc_I8(RoundConst); Context.EmitLdc_I4(Shift); ASoftFallback.EmitCall(Context, Signed ? nameof(ASoftFallback.SignedShrImm_64) : nameof(ASoftFallback.UnsignedShrImm_64)); }
public static void Uaddlv_V(AILEmitterCtx Context) { AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp; Context.EmitLdvec(Op.Rn); Context.EmitLdc_I4(Op.Size); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Uaddlv64), nameof(ASoftFallback.Uaddlv128)); Context.EmitStvec(Op.Rd); }
public static void Dup_Gp(AILEmitterCtx Context) { AOpCodeSimdIns Op = (AOpCodeSimdIns)Context.CurrOp; Context.EmitLdintzr(Op.Rn); Context.EmitLdc_I4(Op.Size); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Dup_Gp64), nameof(ASoftFallback.Dup_Gp128)); Context.EmitStvec(Op.Rd); }
public static void Fmov_V(AILEmitterCtx Context) { AOpCodeSimdImm Op = (AOpCodeSimdImm)Context.CurrOp; Context.EmitLdc_I8(Op.Imm); Context.EmitLdc_I4(Op.Size + 2); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Dup_Gp64), nameof(ASoftFallback.Dup_Gp128)); Context.EmitStvec(Op.Rd); }
// TSrcs (64bit) == TDst (64bit); signed, unsigned. public static void EmitBinarySatQAccumulate(AILEmitterCtx Context, bool Signed) { if (((AOpCodeSimd)Context.CurrOp).Size < 3) { throw new InvalidOperationException(); } Context.EmitLdarg(ATranslatedSub.StateArgIdx); ASoftFallback.EmitCall(Context, Signed ? nameof(ASoftFallback.BinarySignedSatQAcc) : nameof(ASoftFallback.BinaryUnsignedSatQAcc)); }
private static void EmitMovi_V(AILEmitterCtx Context, bool Not) { AOpCodeSimdImm Op = (AOpCodeSimdImm)Context.CurrOp; Context.EmitLdc_I8(Not ? ~Op.Imm : Op.Imm); Context.EmitLdc_I4(Op.Size); ASoftFallback.EmitCall(Context, nameof(ASoftFallback.Dup_Gp64), nameof(ASoftFallback.Dup_Gp128)); Context.EmitStvec(Op.Rd); }
public static void EmitVectorExtract(AILEmitterCtx Context, int Reg, int Index, int Size, bool Signed) { ThrowIfInvalid(Index, Size); IAOpCodeSimd Op = (IAOpCodeSimd)Context.CurrOp; Context.EmitLdvec(Reg); Context.EmitLdc_I4(Index); Context.EmitLdc_I4(Size); ASoftFallback.EmitCall(Context, Signed ? nameof(ASoftFallback.VectorExtractIntSx) : nameof(ASoftFallback.VectorExtractIntZx)); }