aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Instruction
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-03-02 20:24:16 -0300
committergdkchan <gab.dark.100@gmail.com>2018-03-02 20:24:16 -0300
commitefef605b260119642fa023c8488fb3ff4501cafd (patch)
tree8a70da59795b54954155930b6c65d90006412a5d /ChocolArm64/Instruction
parent829b1b1cc0a7dced1946500c1f27b4a7277ddb26 (diff)
Fix REV64 (vector) instruction
Diffstat (limited to 'ChocolArm64/Instruction')
-rw-r--r--ChocolArm64/Instruction/AInstEmitSimdLogical.cs26
-rw-r--r--ChocolArm64/Instruction/ASoftFallback.cs2
2 files changed, 21 insertions, 7 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitSimdLogical.cs b/ChocolArm64/Instruction/AInstEmitSimdLogical.cs
index f4cc66cf..5b71a0bb 100644
--- a/ChocolArm64/Instruction/AInstEmitSimdLogical.cs
+++ b/ChocolArm64/Instruction/AInstEmitSimdLogical.cs
@@ -1,5 +1,6 @@
+using ChocolArm64.Decoder;
+using ChocolArm64.State;
using ChocolArm64.Translation;
-using System;
using System.Reflection.Emit;
using static ChocolArm64.Instruction.AInstEmitSimdHelper;
@@ -69,12 +70,25 @@ namespace ChocolArm64.Instruction
public static void Rev64_V(AILEmitterCtx Context)
{
- Action Emit = () =>
+ AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
+
+ int Bytes = Context.CurrOp.GetBitsCount() >> 3;
+
+ int Elems = Bytes >> Op.Size;
+
+ int RevIndex = Elems - 1;
+
+ for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
+ {
+ EmitVectorExtractZx(Context, Op.Rn, RevIndex--, Op.Size);
+
+ EmitVectorInsert(Context, Op.Rd, Index, Op.Size);
+ }
+
+ if (Op.RegisterSize == ARegisterSize.SIMD64)
{
- ASoftFallback.EmitCall(Context, nameof(ASoftFallback.ReverseBits64));
- };
-
- EmitVectorUnaryOpZx(Context, Emit);
+ EmitVectorZeroUpper(Context, Op.Rd);
+ }
}
}
} \ No newline at end of file
diff --git a/ChocolArm64/Instruction/ASoftFallback.cs b/ChocolArm64/Instruction/ASoftFallback.cs
index 5127182d..797d8157 100644
--- a/ChocolArm64/Instruction/ASoftFallback.cs
+++ b/ChocolArm64/Instruction/ASoftFallback.cs
@@ -75,7 +75,7 @@ namespace ChocolArm64.Instruction
private static ulong ReverseBytes(ulong Value, RevSize Size)
{
- Value = ((Value & 0xff00ff00ff00ff00) >> 8) | ((Value & 0x00ff00ff00ff00ff) << 8);
+ Value = ((Value & 0xff00ff00ff00ff00) >> 8) | ((Value & 0x00ff00ff00ff00ff) << 8);
if (Size == RevSize.Rev16)
{