UnitTests: Put PowerPC test values in a separate file

We use more or less the same values for all PowerPC float unit
tests. Let's put them in one place instead of duplicating them.
This commit is contained in:
JosJuice
2021-05-02 17:14:06 +02:00
parent ade9d6c954
commit bb39f75093
6 changed files with 115 additions and 179 deletions

View File

@ -3,7 +3,6 @@
// Refer to the license.txt file included.
#include <cstring>
#include <vector>
#include "Common/BitUtils.h"
#include "Common/CommonTypes.h"
@ -14,6 +13,8 @@
#include "Core/PowerPC/Jit64Common/Jit64AsmCommon.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "../TestValues.h"
#include <fmt/format.h>
#include <gtest/gtest.h>
@ -60,38 +61,9 @@ TEST(Jit64, Frsqrte)
{
TestCommonAsmRoutines routines;
const std::vector<u64> special_values{
0x0000'0000'0000'0000, // positive zero
0x0000'0000'0000'0001, // smallest positive denormal
0x0000'0000'0100'0000,
0x000F'FFFF'FFFF'FFFF, // largest positive denormal
0x0010'0000'0000'0000, // smallest positive normal
0x0010'0000'0000'0002,
0x3FF0'0000'0000'0000, // 1.0
0x7FEF'FFFF'FFFF'FFFF, // largest positive normal
0x7FF0'0000'0000'0000, // positive infinity
0x7FF0'0000'0000'0001, // first positive SNaN
0x7FF7'FFFF'FFFF'FFFF, // last positive SNaN
0x7FF8'0000'0000'0000, // first positive QNaN
0x7FFF'FFFF'FFFF'FFFF, // last positive QNaN
0x8000'0000'0000'0000, // negative zero
0x8000'0000'0000'0001, // smallest negative denormal
0x8000'0000'0100'0000,
0x800F'FFFF'FFFF'FFFF, // largest negative denormal
0x8010'0000'0000'0000, // smallest negative normal
0x8010'0000'0000'0002,
0xBFF0'0000'0000'0000, // -1.0
0xFFEF'FFFF'FFFF'FFFF, // largest negative normal
0xFFF0'0000'0000'0000, // negative infinity
0xFFF0'0000'0000'0001, // first negative SNaN
0xFFF7'FFFF'FFFF'FFFF, // last negative SNaN
0xFFF8'0000'0000'0000, // first negative QNaN
0xFFFF'FFFF'FFFF'FFFF, // last negative QNaN
};
UReg_FPSCR fpscr;
for (u64 ivalue : special_values)
for (const u64 ivalue : double_test_values)
{
double dvalue = Common::BitCast<double>(ivalue);