aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Instructions/VectorHelper.cs
diff options
context:
space:
mode:
authorLDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>2019-04-03 14:21:22 +0200
committergdkchan <gab.dark.100@gmail.com>2019-04-03 09:21:22 -0300
commitfebc2ad6f492972243f0d8918337f08e7bd395ee (patch)
tree0d4630e5004c997fb5618c71d884c12c73617a51 /ChocolArm64/Instructions/VectorHelper.cs
parent464ec7ced8bd8dc9ea8e4021cf602e6caedfffcf (diff)
Sse optimized all the fp to integer conversion instructions (signed) with Tests (signed & unsigned). (#655)
* Update CpuTestSimdCvt.cs * Update CpuTestSimd.cs * Update CpuTestSimdShImm.cs * Update InstEmitSimdCvt.cs * Update InstEmitSimdMove.cs * Update InstEmitSimdCmp.cs * Update VectorHelper.cs * Update InstEmitSimdHelper.cs * Update OpCodeTable.cs * Update InstEmitSimdCvt.cs * Update InstEmitSimdHelper.cs * Update InstEmitSimdMove.cs
Diffstat (limited to 'ChocolArm64/Instructions/VectorHelper.cs')
-rw-r--r--ChocolArm64/Instructions/VectorHelper.cs87
1 files changed, 16 insertions, 71 deletions
diff --git a/ChocolArm64/Instructions/VectorHelper.cs b/ChocolArm64/Instructions/VectorHelper.cs
index edb3428d..d1dfaced 100644
--- a/ChocolArm64/Instructions/VectorHelper.cs
+++ b/ChocolArm64/Instructions/VectorHelper.cs
@@ -26,8 +26,8 @@ namespace ChocolArm64.Instructions
{
if (float.IsNaN(value)) return 0;
- return value > int.MaxValue ? int.MaxValue :
- value < int.MinValue ? int.MinValue : (int)value;
+ return value >= int.MaxValue ? int.MaxValue :
+ value <= int.MinValue ? int.MinValue : (int)value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -35,8 +35,8 @@ namespace ChocolArm64.Instructions
{
if (float.IsNaN(value)) return 0;
- return value > long.MaxValue ? long.MaxValue :
- value < long.MinValue ? long.MinValue : (long)value;
+ return value >= long.MaxValue ? long.MaxValue :
+ value <= long.MinValue ? long.MinValue : (long)value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -44,8 +44,8 @@ namespace ChocolArm64.Instructions
{
if (float.IsNaN(value)) return 0;
- return value > uint.MaxValue ? uint.MaxValue :
- value < uint.MinValue ? uint.MinValue : (uint)value;
+ return value >= uint.MaxValue ? uint.MaxValue :
+ value <= uint.MinValue ? uint.MinValue : (uint)value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -53,8 +53,8 @@ namespace ChocolArm64.Instructions
{
if (float.IsNaN(value)) return 0;
- return value > ulong.MaxValue ? ulong.MaxValue :
- value < ulong.MinValue ? ulong.MinValue : (ulong)value;
+ return value >= ulong.MaxValue ? ulong.MaxValue :
+ value <= ulong.MinValue ? ulong.MinValue : (ulong)value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -62,8 +62,8 @@ namespace ChocolArm64.Instructions
{
if (double.IsNaN(value)) return 0;
- return value > int.MaxValue ? int.MaxValue :
- value < int.MinValue ? int.MinValue : (int)value;
+ return value >= int.MaxValue ? int.MaxValue :
+ value <= int.MinValue ? int.MinValue : (int)value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -71,8 +71,8 @@ namespace ChocolArm64.Instructions
{
if (double.IsNaN(value)) return 0;
- return value > long.MaxValue ? long.MaxValue :
- value < long.MinValue ? long.MinValue : (long)value;
+ return value >= long.MaxValue ? long.MaxValue :
+ value <= long.MinValue ? long.MinValue : (long)value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -80,8 +80,8 @@ namespace ChocolArm64.Instructions
{
if (double.IsNaN(value)) return 0;
- return value > uint.MaxValue ? uint.MaxValue :
- value < uint.MinValue ? uint.MinValue : (uint)value;
+ return value >= uint.MaxValue ? uint.MaxValue :
+ value <= uint.MinValue ? uint.MinValue : (uint)value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -89,8 +89,8 @@ namespace ChocolArm64.Instructions
{
if (double.IsNaN(value)) return 0;
- return value > ulong.MaxValue ? ulong.MaxValue :
- value < ulong.MinValue ? ulong.MinValue : (ulong)value;
+ return value >= ulong.MaxValue ? ulong.MaxValue :
+ value <= ulong.MinValue ? ulong.MinValue : (ulong)value;
}
public static double Round(double value, CpuThreadState state)
@@ -501,50 +501,6 @@ namespace ChocolArm64.Instructions
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Vector128<sbyte> VectorSByteZero()
- {
- if (Sse2.IsSupported)
- {
- return Sse2.SetZeroVector128<sbyte>();
- }
-
- throw new PlatformNotSupportedException();
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Vector128<short> VectorInt16Zero()
- {
- if (Sse2.IsSupported)
- {
- return Sse2.SetZeroVector128<short>();
- }
-
- throw new PlatformNotSupportedException();
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Vector128<int> VectorInt32Zero()
- {
- if (Sse2.IsSupported)
- {
- return Sse2.SetZeroVector128<int>();
- }
-
- throw new PlatformNotSupportedException();
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Vector128<long> VectorInt64Zero()
- {
- if (Sse2.IsSupported)
- {
- return Sse2.SetZeroVector128<long>();
- }
-
- throw new PlatformNotSupportedException();
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector128<float> VectorSingleZero()
{
if (Sse.IsSupported)
@@ -554,16 +510,5 @@ namespace ChocolArm64.Instructions
throw new PlatformNotSupportedException();
}
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Vector128<double> VectorDoubleZero()
- {
- if (Sse2.IsSupported)
- {
- return Sse2.SetZeroVector128<double>();
- }
-
- throw new PlatformNotSupportedException();
- }
}
}