diff options
Diffstat (limited to 'ARMeilleure/Instructions/InstEmitSimdMove.cs')
-rw-r--r-- | ARMeilleure/Instructions/InstEmitSimdMove.cs | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/ARMeilleure/Instructions/InstEmitSimdMove.cs b/ARMeilleure/Instructions/InstEmitSimdMove.cs index a1a4635f..12fc71c9 100644 --- a/ARMeilleure/Instructions/InstEmitSimdMove.cs +++ b/ARMeilleure/Instructions/InstEmitSimdMove.cs @@ -1,8 +1,8 @@ using ARMeilleure.Decoders; using ARMeilleure.IntermediateRepresentation; using ARMeilleure.Translation; -using System; using System.Collections.Generic; +using System.Reflection; using static ARMeilleure.Instructions.InstEmitHelper; using static ARMeilleure.Instructions.InstEmitSimdHelper; @@ -284,13 +284,26 @@ namespace ARMeilleure.Instructions { OpCodeSimdFmov op = (OpCodeSimdFmov)context.CurrOp; - if (op.Size == 0) + if (Optimizations.UseSse2) { - context.Copy(GetVec(op.Rd), X86GetScalar(context, (int)op.Immediate)); + if (op.Size == 0) + { + context.Copy(GetVec(op.Rd), X86GetScalar(context, (int)op.Immediate)); + } + else + { + context.Copy(GetVec(op.Rd), X86GetScalar(context, op.Immediate)); + } } else { - context.Copy(GetVec(op.Rd), X86GetScalar(context, op.Immediate)); + Operand e = Const(op.Immediate); + + Operand res = context.VectorZero(); + + res = EmitVectorInsert(context, res, e, 0, op.Size + 2); + + context.Copy(GetVec(op.Rd), res); } } @@ -350,7 +363,7 @@ namespace ARMeilleure.Instructions { if (Optimizations.UseSse2) { - EmitSse2MoviMvni(context, not: false); + EmitSse2VectorMoviMvniOp(context, not: false); } else { @@ -362,7 +375,7 @@ namespace ARMeilleure.Instructions { if (Optimizations.UseSse2) { - EmitSse2MoviMvni(context, not: true); + EmitSse2VectorMoviMvniOp(context, not: true); } else { @@ -476,7 +489,7 @@ namespace ARMeilleure.Instructions EmitVectorZip(context, part: 1); } - private static void EmitSse2MoviMvni(ArmEmitterContext context, bool not) + private static void EmitSse2VectorMoviMvniOp(ArmEmitterContext context, bool not) { OpCodeSimdImm op = (OpCodeSimdImm)context.CurrOp; @@ -593,32 +606,30 @@ namespace ARMeilleure.Instructions args.Add(GetVec((op.Rn + index) & 0x1F)); } - Delegate dlg = null; + MethodInfo info = null; - switch (op.Size) + if (isTbl) { - case 1: dlg = isTbl - ? (Delegate)new _V128_V128_S32_V128 (SoftFallback.Tbl1) - : (Delegate)new _V128_V128_V128_S32_V128(SoftFallback.Tbx1); - break; - - case 2: dlg = isTbl - ? (Delegate)new _V128_V128_S32_V128_V128 (SoftFallback.Tbl2) - : (Delegate)new _V128_V128_V128_S32_V128_V128(SoftFallback.Tbx2); - break; - - case 3: dlg = isTbl - ? (Delegate)new _V128_V128_S32_V128_V128_V128 (SoftFallback.Tbl3) - : (Delegate)new _V128_V128_V128_S32_V128_V128_V128(SoftFallback.Tbx3); - break; - - case 4: dlg = isTbl - ? (Delegate)new _V128_V128_S32_V128_V128_V128_V128 (SoftFallback.Tbl4) - : (Delegate)new _V128_V128_V128_S32_V128_V128_V128_V128(SoftFallback.Tbx4); - break; + switch (op.Size) + { + case 1: info = typeof(SoftFallback).GetMethod(nameof(SoftFallback.Tbl1)); break; + case 2: info = typeof(SoftFallback).GetMethod(nameof(SoftFallback.Tbl2)); break; + case 3: info = typeof(SoftFallback).GetMethod(nameof(SoftFallback.Tbl3)); break; + case 4: info = typeof(SoftFallback).GetMethod(nameof(SoftFallback.Tbl4)); break; + } + } + else + { + switch (op.Size) + { + case 1: info = typeof(SoftFallback).GetMethod(nameof(SoftFallback.Tbx1)); break; + case 2: info = typeof(SoftFallback).GetMethod(nameof(SoftFallback.Tbx2)); break; + case 3: info = typeof(SoftFallback).GetMethod(nameof(SoftFallback.Tbx3)); break; + case 4: info = typeof(SoftFallback).GetMethod(nameof(SoftFallback.Tbx4)); break; + } } - context.Copy(d, context.Call(dlg, args.ToArray())); + context.Copy(d, context.Call(info, args.ToArray())); } } |