Removed more unnecessary sse checks

This commit is contained in:
Andy Adshead 2019-01-22 19:40:01 +00:00
commit 8db1e8a6c6
3 changed files with 7 additions and 74 deletions

View file

@ -317,11 +317,6 @@ namespace ChocolArm64.Instructions
private unsafe static void FromByteArrayToVector(byte[] state, ref Vector128<float> op) private unsafe static void FromByteArrayToVector(byte[] state, ref Vector128<float> op)
{ {
if (!Sse2.IsSupported)
{
throw new PlatformNotSupportedException();
}
fixed (byte* ptr = &state[0]) fixed (byte* ptr = &state[0])
{ {
op = Sse.StaticCast<byte, float>(Sse2.LoadVector128(ptr)); op = Sse.StaticCast<byte, float>(Sse2.LoadVector128(ptr));

View file

@ -239,21 +239,7 @@ namespace ChocolArm64.Memory
} }
} }
public Vector128<float> ReadVector8(long position) public Vector128<float> ReadVector8(long position) => Vector128.Create(ReadByte(position), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).As<float>();
{
if (Sse2.IsSupported)
{
return Vector128.Create(ReadByte(position), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).As<float>();
}
else
{
Vector128<float> value = VectorHelper.VectorSingleZero();
value = VectorHelper.VectorInsertInt(ReadByte(position), value, 0, 0);
return value;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector128<float> ReadVector16(long position) public Vector128<float> ReadVector16(long position)

View file

@ -430,35 +430,11 @@ namespace Ryujinx.Tests.Cpu
bool IsNormalOrSubnormalD(double d) => double.IsNormal(d) || double.IsSubnormal(d); bool IsNormalOrSubnormalD(double d) => double.IsNormal(d) || double.IsSubnormal(d);
} }
protected static Vector128<float> MakeVectorE0(double e0) protected static Vector128<float> MakeVectorE0(double e0) => Vector128.Create(BitConverter.DoubleToInt64Bits(e0), 0).As<float>();
{
if (!Sse2.IsSupported)
{
throw new PlatformNotSupportedException();
}
return Vector128.Create(BitConverter.DoubleToInt64Bits(e0), 0).As<float>(); protected static Vector128<float> MakeVectorE0E1(double e0, double e1) => Vector128.Create(BitConverter.DoubleToInt64Bits(e0), BitConverter.DoubleToInt64Bits(e1)).As<float>();
}
protected static Vector128<float> MakeVectorE0E1(double e0, double e1) protected static Vector128<float> MakeVectorE1(double e1) => Vector128.Create(0, BitConverter.DoubleToInt64Bits(e1)).As<float>();
{
if (!Sse2.IsSupported)
{
throw new PlatformNotSupportedException();
}
return Vector128.Create(BitConverter.DoubleToInt64Bits(e0), BitConverter.DoubleToInt64Bits(e1)).As<float>();
}
protected static Vector128<float> MakeVectorE1(double e1)
{
if (!Sse2.IsSupported)
{
throw new PlatformNotSupportedException();
}
return Vector128.Create(0, BitConverter.DoubleToInt64Bits(e1)).As<float>();
}
protected static float VectorExtractSingle(Vector128<float> vector, byte index) protected static float VectorExtractSingle(Vector128<float> vector, byte index)
{ {
@ -484,35 +460,11 @@ namespace Ryujinx.Tests.Cpu
return BitConverter.Int64BitsToDouble(value); return BitConverter.Int64BitsToDouble(value);
} }
protected static Vector128<float> MakeVectorE0(ulong e0) protected static Vector128<float> MakeVectorE0(ulong e0) => Vector128.Create(e0, 0).As<float>();
{
if (!Sse2.IsSupported)
{
throw new PlatformNotSupportedException();
}
return Vector128.Create(e0, 0).As<float>(); protected static Vector128<float> MakeVectorE0E1(ulong e0, ulong e1) => Vector128.Create(e0, e1).As<float>();
}
protected static Vector128<float> MakeVectorE0E1(ulong e0, ulong e1) protected static Vector128<float> MakeVectorE1(ulong e1) => Vector128.Create(0, e1).As<float>();
{
if (!Sse2.IsSupported)
{
throw new PlatformNotSupportedException();
}
return Vector128.Create(e0, e1).As<float>();
}
protected static Vector128<float> MakeVectorE1(ulong e1)
{
if (!Sse2.IsSupported)
{
throw new PlatformNotSupportedException();
}
return Vector128.Create(0, e1).As<float>();
}
protected static ulong GetVectorE0(Vector128<float> vector) protected static ulong GetVectorE0(Vector128<float> vector)
{ {