aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Instruction/ASoftFallback.cs
diff options
context:
space:
mode:
authorLDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>2018-07-03 08:31:16 +0200
committergdkchan <gab.dark.100@gmail.com>2018-07-03 03:31:16 -0300
commitc228cf320d476303da679066c67c3a8c9c6aa3e1 (patch)
tree1ccab1be1ef348cef8642575a116bc5b2e741c18 /ChocolArm64/Instruction/ASoftFallback.cs
parentd24ea0d51b988195f5d3cf8c1194cb012067fa9d (diff)
Add Rbit_V instruction. Add 8 tests (Rbit_V; Rev16_V, Rev32_V, Rev64_V). Improve CountSetBits8() algorithm. (#212)
* Update AOpCodeTable.cs * Update AInstEmitSimdArithmetic.cs * Update AInstEmitSimdLogical.cs * Update AVectorHelper.cs * Update ASoftFallback.cs * Update Instructions.cs * Update CpuTestSimd.cs * Update CpuTestSimdReg.cs * Improve CountSetBits8() algorithm. * Improve CountSetBits8() algorithm.
Diffstat (limited to 'ChocolArm64/Instruction/ASoftFallback.cs')
-rw-r--r--ChocolArm64/Instruction/ASoftFallback.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/ChocolArm64/Instruction/ASoftFallback.cs b/ChocolArm64/Instruction/ASoftFallback.cs
index d626622a..5c0a9c8e 100644
--- a/ChocolArm64/Instruction/ASoftFallback.cs
+++ b/ChocolArm64/Instruction/ASoftFallback.cs
@@ -30,6 +30,14 @@ namespace ChocolArm64.Instruction
return (ulong)Size;
}
+ public static uint CountSetBits8(uint Value)
+ {
+ Value = ((Value >> 1) & 0x55) + (Value & 0x55);
+ Value = ((Value >> 2) & 0x33) + (Value & 0x33);
+
+ return (Value >> 4) + (Value & 0x0f);
+ }
+
private const uint Crc32RevPoly = 0xedb88320;
private const uint Crc32cRevPoly = 0x82f63b78;
@@ -89,6 +97,14 @@ namespace ChocolArm64.Instruction
return Crc;
}
+ public static uint ReverseBits8(uint Value)
+ {
+ Value = ((Value & 0xaa) >> 1) | ((Value & 0x55) << 1);
+ Value = ((Value & 0xcc) >> 2) | ((Value & 0x33) << 2);
+
+ return (Value >> 4) | ((Value & 0x0f) << 4);
+ }
+
public static uint ReverseBits32(uint Value)
{
Value = ((Value & 0xaaaaaaaa) >> 1) | ((Value & 0x55555555) << 1);
@@ -101,10 +117,10 @@ namespace ChocolArm64.Instruction
public static ulong ReverseBits64(ulong Value)
{
- Value = ((Value & 0xaaaaaaaaaaaaaaaa) >> 1) | ((Value & 0x5555555555555555) << 1);
- Value = ((Value & 0xcccccccccccccccc) >> 2) | ((Value & 0x3333333333333333) << 2);
- Value = ((Value & 0xf0f0f0f0f0f0f0f0) >> 4) | ((Value & 0x0f0f0f0f0f0f0f0f) << 4);
- Value = ((Value & 0xff00ff00ff00ff00) >> 8) | ((Value & 0x00ff00ff00ff00ff) << 8);
+ Value = ((Value & 0xaaaaaaaaaaaaaaaa) >> 1 ) | ((Value & 0x5555555555555555) << 1 );
+ Value = ((Value & 0xcccccccccccccccc) >> 2 ) | ((Value & 0x3333333333333333) << 2 );
+ Value = ((Value & 0xf0f0f0f0f0f0f0f0) >> 4 ) | ((Value & 0x0f0f0f0f0f0f0f0f) << 4 );
+ Value = ((Value & 0xff00ff00ff00ff00) >> 8 ) | ((Value & 0x00ff00ff00ff00ff) << 8 );
Value = ((Value & 0xffff0000ffff0000) >> 16) | ((Value & 0x0000ffff0000ffff) << 16);
return (Value >> 32) | (Value << 32);