From 2bcdd4df57dd07fb019085fecf3f272ff8df9202 Mon Sep 17 00:00:00 2001 From: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com> Date: Sun, 21 Oct 2018 19:14:48 +0200 Subject: [PATCH] Update CpuTest.cs --- Ryujinx.Tests/Cpu/CpuTest.cs | 42 +++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Ryujinx.Tests/Cpu/CpuTest.cs b/Ryujinx.Tests/Cpu/CpuTest.cs index 24585fe78f..4587189b90 100644 --- a/Ryujinx.Tests/Cpu/CpuTest.cs +++ b/Ryujinx.Tests/Cpu/CpuTest.cs @@ -178,11 +178,30 @@ namespace Ryujinx.Tests.Cpu return GetThreadState(); } + /// Rounding Mode control field. + public enum RMode + { + /// Round to Nearest (RN) mode. + RN, + /// Round towards Plus Infinity (RP) mode. + RP, + /// Round towards Minus Infinity (RM) mode. + RM, + /// Round towards Zero (RZ) mode. + RZ + }; + /// Floating-point Control Register. protected enum FPCR { + /// Rounding Mode control field. + RMode = 22, + /// Flush-to-zero mode control bit. + FZ = 24, /// Default NaN mode control bit. - DN = 25 + DN = 25, + /// Alternative half-precision control bit. + AHP = 26 } /// Floating-point Status Register. @@ -514,6 +533,27 @@ namespace Ryujinx.Tests.Cpu return Sse41.Extract(Sse.StaticCast(Vector), (byte)1); } + protected static ushort GenNormal_H() + { + uint Rnd; + + do Rnd = TestContext.CurrentContext.Random.NextUShort(); + while (( Rnd & 0x7C00u) == 0u || + (~Rnd & 0x7C00u) == 0u); + + return (ushort)Rnd; + } + + protected static ushort GenSubnormal_H() + { + uint Rnd; + + do Rnd = TestContext.CurrentContext.Random.NextUShort(); + while ((Rnd & 0x03FFu) == 0u); + + return (ushort)(Rnd & 0x83FFu); + } + protected static uint GenNormal_S() { uint Rnd;