aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Instruction/AInstEmitSimdMove.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ChocolArm64/Instruction/AInstEmitSimdMove.cs')
-rw-r--r--ChocolArm64/Instruction/AInstEmitSimdMove.cs47
1 files changed, 25 insertions, 22 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitSimdMove.cs b/ChocolArm64/Instruction/AInstEmitSimdMove.cs
index 739f01c6..592cab73 100644
--- a/ChocolArm64/Instruction/AInstEmitSimdMove.cs
+++ b/ChocolArm64/Instruction/AInstEmitSimdMove.cs
@@ -331,17 +331,18 @@ namespace ChocolArm64.Instruction
{
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
- int Bytes = Op.GetBitsCount() >> 3;
-
- int Elems = Bytes >> Op.Size;
+ int Words = Op.GetBitsCount() >> 4;
+ int Pairs = Words >> Op.Size;
- for (int Index = 0; Index < Elems; Index++)
+ for (int Index = 0; Index < Pairs; Index++)
{
- int Elem = (Index & ~1) + Part;
+ int Idx = Index << 1;
- EmitVectorExtractZx(Context, (Index & 1) == 0 ? Op.Rn : Op.Rm, Elem, Op.Size);
+ EmitVectorExtractZx(Context, Op.Rn, Idx + Part, Op.Size);
+ EmitVectorExtractZx(Context, Op.Rm, Idx + Part, Op.Size);
- EmitVectorInsertTmp(Context, Index, Op.Size);
+ EmitVectorInsertTmp(Context, Idx + 1, Op.Size);
+ EmitVectorInsertTmp(Context, Idx , Op.Size);
}
Context.EmitLdvectmp();
@@ -357,18 +358,18 @@ namespace ChocolArm64.Instruction
{
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
- int Bytes = Op.GetBitsCount() >> 3;
+ int Words = Op.GetBitsCount() >> 4;
+ int Pairs = Words >> Op.Size;
- int Elems = Bytes >> Op.Size;
- int Half = Elems >> 1;
-
- for (int Index = 0; Index < Elems; Index++)
+ for (int Index = 0; Index < Pairs; Index++)
{
- int Elem = Part + ((Index & (Half - 1)) << 1);
+ int Idx = Index << 1;
- EmitVectorExtractZx(Context, Index < Half ? Op.Rn : Op.Rm, Elem, Op.Size);
+ EmitVectorExtractZx(Context, Op.Rn, Idx + Part, Op.Size);
+ EmitVectorExtractZx(Context, Op.Rm, Idx + Part, Op.Size);
- EmitVectorInsertTmp(Context, Index, Op.Size);
+ EmitVectorInsertTmp(Context, Pairs + Index, Op.Size);
+ EmitVectorInsertTmp(Context, Index, Op.Size);
}
Context.EmitLdvectmp();
@@ -384,18 +385,20 @@ namespace ChocolArm64.Instruction
{
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
- int Bytes = Op.GetBitsCount() >> 3;
+ int Words = Op.GetBitsCount() >> 4;
+ int Pairs = Words >> Op.Size;
- int Elems = Bytes >> Op.Size;
- int Half = Elems >> 1;
+ int Base = Part != 0 ? Pairs : 0;
- for (int Index = 0; Index < Elems; Index++)
+ for (int Index = 0; Index < Pairs; Index++)
{
- int Elem = Part * Half + (Index >> 1);
+ int Idx = Index << 1;
- EmitVectorExtractZx(Context, (Index & 1) == 0 ? Op.Rn : Op.Rm, Elem, Op.Size);
+ EmitVectorExtractZx(Context, Op.Rn, Base + Index, Op.Size);
+ EmitVectorExtractZx(Context, Op.Rm, Base + Index, Op.Size);
- EmitVectorInsertTmp(Context, Index, Op.Size);
+ EmitVectorInsertTmp(Context, Idx + 1, Op.Size);
+ EmitVectorInsertTmp(Context, Idx , Op.Size);
}
Context.EmitLdvectmp();