From f7ef6364b79ba04af5c7bf0f5ec77fbb6b4aae29 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 6 Jul 2022 08:40:31 -0300 Subject: Implement CPU FCVT Half <-> Double conversion variants (#3439) * Half <-> Double conversion support * Add tests, fast path and deduplicate SoftFloat code * PPTC version --- Ryujinx.Tests/Cpu/CpuTestSimd.cs | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'Ryujinx.Tests') diff --git a/Ryujinx.Tests/Cpu/CpuTestSimd.cs b/Ryujinx.Tests/Cpu/CpuTestSimd.cs index c20e11ee..be3db0e7 100644 --- a/Ryujinx.Tests/Cpu/CpuTestSimd.cs +++ b/Ryujinx.Tests/Cpu/CpuTestSimd.cs @@ -825,6 +825,14 @@ namespace Ryujinx.Tests.Cpu }; } + private static uint[] _F_Cvt_S_DH_() + { + return new uint[] + { + 0x1E63C020u // FCVT H0, D1 + }; + } + private static uint[] _F_Cvt_S_HS_() { return new uint[] @@ -833,6 +841,14 @@ namespace Ryujinx.Tests.Cpu }; } + private static uint[] _F_Cvt_S_HD_() + { + return new uint[] + { + 0x1EE2C020u // FCVT D0, H1 + }; + } + private static uint[] _F_Cvt_ANZ_SU_S_S_() { return new uint[] @@ -1998,6 +2014,22 @@ namespace Ryujinx.Tests.Cpu CompareAgainstUnicorn(); } + [Test, Pairwise] [Explicit] + public void F_Cvt_S_DH([ValueSource("_F_Cvt_S_DH_")] uint opcodes, + [ValueSource("_1D_F_")] ulong a, + [Values(RMode.Rn)] RMode rMode) + { + ulong z = TestContext.CurrentContext.Random.NextULong(); + V128 v0 = MakeVectorE0E1(z, z); + V128 v1 = MakeVectorE0(a); + + int fpcr = (int)rMode << (int)Fpcr.RMode; + + SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr); + + CompareAgainstUnicorn(); + } + [Test, Pairwise] [Explicit] public void F_Cvt_S_HS([ValueSource("_F_Cvt_S_HS_")] uint opcodes, [ValueSource("_1H_F_")] ulong a) @@ -2011,6 +2043,19 @@ namespace Ryujinx.Tests.Cpu CompareAgainstUnicorn(); } + [Test, Pairwise] [Explicit] + public void F_Cvt_S_HD([ValueSource("_F_Cvt_S_HD_")] uint opcodes, + [ValueSource("_1H_F_")] ulong a) + { + ulong z = TestContext.CurrentContext.Random.NextULong(); + V128 v0 = MakeVectorE0E1(z, z); + V128 v1 = MakeVectorE0(a); + + SingleOpcode(opcodes, v0: v0, v1: v1); + + CompareAgainstUnicorn(); + } + [Test, Pairwise] [Explicit] public void F_Cvt_ANZ_SU_S_S([ValueSource("_F_Cvt_ANZ_SU_S_S_")] uint opcodes, [ValueSource("_1S_F_W_")] ulong a) -- cgit v1.2.3