Просмотр исходного кода

CPU fix for the cases using a Mask with shift = 0

gdkchan 8 лет назад
Родитель
Сommit
b50bc46888
2 измененных файлов с 9 добавлено и 2 удалено
  1. 8 1
      ChocolArm64/Decoder/AOpCodeSimdImm.cs
  2. 1 1
      ChocolArm64/Instruction/AInstEmitSimdShift.cs

+ 8 - 1
ChocolArm64/Decoder/AOpCodeSimdImm.cs

@@ -88,7 +88,14 @@ namespace ChocolArm64.Decoder
 
 
         private static long ShlOnes(long Value, int Shift)
         private static long ShlOnes(long Value, int Shift)
         {
         {
-            return Value << Shift | (long)(ulong.MaxValue >> (64 - Shift));
+            if (Shift != 0)
+            {
+                return Value << Shift | (long)(ulong.MaxValue >> (64 - Shift));
+            }
+            else
+            {
+                return Value;
+            }
         }
         }
     }
     }
 }
 }

+ 1 - 1
ChocolArm64/Instruction/AInstEmitSimdShift.cs

@@ -58,7 +58,7 @@ namespace ChocolArm64.Instruction
 
 
             int Shift = Op.Imm - (8 << Op.Size);
             int Shift = Op.Imm - (8 << Op.Size);
 
 
-            ulong Mask = ulong.MaxValue >> (64 - Shift);            
+            ulong Mask = Shift != 0 ? ulong.MaxValue >> (64 - Shift) : 0;            
 
 
             for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
             for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
             {
             {