From e1ff5cadef5b31adbde7b97ae5488b9c1d6bd0a5 Mon Sep 17 00:00:00 2001 From: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com> Date: Thu, 23 Aug 2018 20:37:51 +0200 Subject: [PATCH] Update CpuTest.cs --- Ryujinx.Tests/Cpu/CpuTest.cs | 49 ++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/Ryujinx.Tests/Cpu/CpuTest.cs b/Ryujinx.Tests/Cpu/CpuTest.cs index e6a0237987..4ac05f1b83 100644 --- a/Ryujinx.Tests/Cpu/CpuTest.cs +++ b/Ryujinx.Tests/Cpu/CpuTest.cs @@ -119,22 +119,42 @@ namespace Ryujinx.Tests.Cpu protected static Vector128 MakeVectorE0(double E0) { + if (!Sse2.IsSupported) + { + throw new PlatformNotSupportedException(); + } + return Sse.StaticCast(Sse2.SetVector128(0, BitConverter.DoubleToInt64Bits(E0))); } protected static Vector128 MakeVectorE0E1(double E0, double E1) { - return Sse.StaticCast(Sse2.SetVector128(BitConverter.DoubleToInt64Bits(E1), - BitConverter.DoubleToInt64Bits(E0))); + if (!Sse2.IsSupported) + { + throw new PlatformNotSupportedException(); + } + + return Sse.StaticCast( + Sse2.SetVector128(BitConverter.DoubleToInt64Bits(E1), BitConverter.DoubleToInt64Bits(E0))); } protected static Vector128 MakeVectorE1(double E1) { + if (!Sse2.IsSupported) + { + throw new PlatformNotSupportedException(); + } + return Sse.StaticCast(Sse2.SetVector128(BitConverter.DoubleToInt64Bits(E1), 0)); } protected static double VectorExtractDouble(Vector128 Vector, byte Index) { + if (!Sse41.IsSupported) + { + throw new PlatformNotSupportedException(); + } + long Value = Sse41.Extract(Sse.StaticCast(Vector), Index); return BitConverter.Int64BitsToDouble(Value); @@ -142,26 +162,51 @@ namespace Ryujinx.Tests.Cpu protected static Vector128 MakeVectorE0(ulong E0) { + if (!Sse2.IsSupported) + { + throw new PlatformNotSupportedException(); + } + return Sse.StaticCast(Sse2.SetVector128(0, E0)); } protected static Vector128 MakeVectorE0E1(ulong E0, ulong E1) { + if (!Sse2.IsSupported) + { + throw new PlatformNotSupportedException(); + } + return Sse.StaticCast(Sse2.SetVector128(E1, E0)); } protected static Vector128 MakeVectorE1(ulong E1) { + if (!Sse2.IsSupported) + { + throw new PlatformNotSupportedException(); + } + return Sse.StaticCast(Sse2.SetVector128(E1, 0)); } protected static ulong GetVectorE0(Vector128 Vector) { + if (!Sse41.IsSupported) + { + throw new PlatformNotSupportedException(); + } + return Sse41.Extract(Sse.StaticCast(Vector), (byte)0); } protected static ulong GetVectorE1(Vector128 Vector) { + if (!Sse41.IsSupported) + { + throw new PlatformNotSupportedException(); + } + return Sse41.Extract(Sse.StaticCast(Vector), (byte)1); } }