aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Instructions/InstEmitSimdHelper32.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/Instructions/InstEmitSimdHelper32.cs')
-rw-r--r--ARMeilleure/Instructions/InstEmitSimdHelper32.cs56
1 files changed, 12 insertions, 44 deletions
diff --git a/ARMeilleure/Instructions/InstEmitSimdHelper32.cs b/ARMeilleure/Instructions/InstEmitSimdHelper32.cs
index 67dc25c7..9697715a 100644
--- a/ARMeilleure/Instructions/InstEmitSimdHelper32.cs
+++ b/ARMeilleure/Instructions/InstEmitSimdHelper32.cs
@@ -3,6 +3,8 @@ using ARMeilleure.IntermediateRepresentation;
using ARMeilleure.Translation;
using System;
using System.Diagnostics;
+using System.Reflection;
+
using static ARMeilleure.Instructions.InstEmitHelper;
using static ARMeilleure.Instructions.InstEmitSimdHelper;
using static ARMeilleure.IntermediateRepresentation.OperandHelper;
@@ -39,7 +41,7 @@ namespace ARMeilleure.Instructions
{
// From dreg.
return context.VectorExtract(type, GetVecA32(reg >> 1), reg & 1);
- }
+ }
else
{
// From sreg.
@@ -575,7 +577,7 @@ namespace ARMeilleure.Instructions
if (targetSide == 1)
{
return context.AddIntrinsic(Intrinsic.X86Movlhps, input, input); // Low to high.
- }
+ }
else
{
return context.AddIntrinsic(Intrinsic.X86Movhlps, input, input); // High to low.
@@ -592,7 +594,7 @@ namespace ARMeilleure.Instructions
if (targetSide == 1)
{
return context.AddIntrinsic(Intrinsic.X86Shufpd, target, value, Const(shuffleMask));
- }
+ }
else
{
return context.AddIntrinsic(Intrinsic.X86Shufpd, value, target, Const(shuffleMask));
@@ -622,7 +624,7 @@ namespace ARMeilleure.Instructions
if (Optimizations.UseSse41)
{
return context.AddIntrinsic(Intrinsic.X86Insertps, target, value, Const(index << 4));
- }
+ }
else
{
target = EmitSwapScalar(context, target, index, doubleWidth); // Swap value to replace into element 0.
@@ -642,7 +644,7 @@ namespace ARMeilleure.Instructions
{
int shuffleMask = 1; // Swap top and bottom. (b0 = 1, b1 = 0)
return context.AddIntrinsic(Intrinsic.X86Shufpd, target, target, Const(shuffleMask));
- }
+ }
else
{
int shuffleMask = (3 << 6) | (2 << 4) | (1 << 2) | index; // Swap index and 0. (others remain)
@@ -1000,52 +1002,18 @@ namespace ARMeilleure.Instructions
// Generic Functions
- public static Operand EmitSoftFloatCallDefaultFpscr(
- ArmEmitterContext context,
- _F32_F32_Bool f32,
- _F64_F64_Bool f64,
- params Operand[] callArgs)
- {
- IOpCodeSimd op = (IOpCodeSimd)context.CurrOp;
-
- Delegate dlg = (op.Size & 1) == 0 ? (Delegate)f32 : (Delegate)f64;
-
- Array.Resize(ref callArgs, callArgs.Length + 1);
- callArgs[callArgs.Length - 1] = Const(1);
-
- return context.Call(dlg, callArgs);
- }
-
- public static Operand EmitSoftFloatCallDefaultFpscr(
- ArmEmitterContext context,
- _F32_F32_F32_Bool f32,
- _F64_F64_F64_Bool f64,
- params Operand[] callArgs)
- {
- IOpCodeSimd op = (IOpCodeSimd)context.CurrOp;
-
- Delegate dlg = (op.Size & 1) == 0 ? (Delegate)f32 : (Delegate)f64;
-
- Array.Resize(ref callArgs, callArgs.Length + 1);
- callArgs[callArgs.Length - 1] = Const(1);
-
- return context.Call(dlg, callArgs);
- }
-
- public static Operand EmitSoftFloatCallDefaultFpscr(
- ArmEmitterContext context,
- _F32_F32_F32_F32_Bool f32,
- _F64_F64_F64_F64_Bool f64,
- params Operand[] callArgs)
+ public static Operand EmitSoftFloatCallDefaultFpscr(ArmEmitterContext context, string name, params Operand[] callArgs)
{
IOpCodeSimd op = (IOpCodeSimd)context.CurrOp;
- Delegate dlg = (op.Size & 1) == 0 ? (Delegate)f32 : (Delegate)f64;
+ MethodInfo info = (op.Size & 1) == 0
+ ? typeof(SoftFloat32).GetMethod(name)
+ : typeof(SoftFloat64).GetMethod(name);
Array.Resize(ref callArgs, callArgs.Length + 1);
callArgs[callArgs.Length - 1] = Const(1);
- return context.Call(dlg, callArgs);
+ return context.Call(info, callArgs);
}
public static Operand EmitVectorExtractSx32(ArmEmitterContext context, int reg, int index, int size)