tests/fp_min_max: Test FPCR.FZ

This commit is contained in:
merry 2022-12-29 19:32:38 +00:00
parent 2492970039
commit c63c134582

View file

@ -69,11 +69,12 @@ void run_test(u32 instruction, Fn fn) {
env.code_mem.emplace_back(instruction); // FMAX S0, S1, S2 env.code_mem.emplace_back(instruction); // FMAX S0, S1, S2
env.code_mem.emplace_back(0x14000000); // B . env.code_mem.emplace_back(0x14000000); // B .
for (const auto base_fpcr : {0, 0x01000000}) {
for (const auto test_case : test_cases) { for (const auto test_case : test_cases) {
INFO(test_case.a); INFO(test_case.a);
INFO(test_case.b); INFO(test_case.b);
jit.SetFpcr(0); jit.SetFpcr(base_fpcr);
jit.SetVector(0, {42, 0}); jit.SetVector(0, {42, 0});
jit.SetVector(1, {test_case.a, 0}); jit.SetVector(1, {test_case.a, 0});
@ -95,7 +96,7 @@ void run_test(u32 instruction, Fn fn) {
REQUIRE(jit.GetVector(0)[0] == fn(test_case)); REQUIRE(jit.GetVector(0)[0] == fn(test_case));
jit.SetFpcr(0x02000000); jit.SetFpcr(base_fpcr | 0x02000000);
jit.SetVector(0, {42, 0}); jit.SetVector(0, {42, 0});
jit.SetVector(1, {test_case.a, 0}); jit.SetVector(1, {test_case.a, 0});
@ -122,7 +123,7 @@ void run_test(u32 instruction, Fn fn) {
INFO(test_case.a); INFO(test_case.a);
INFO(test_case.b); INFO(test_case.b);
jit.SetFpcr(0); jit.SetFpcr(base_fpcr);
jit.SetVector(0, {42, 0}); jit.SetVector(0, {42, 0});
jit.SetVector(1, {test_case.a, 0}); jit.SetVector(1, {test_case.a, 0});
@ -134,7 +135,7 @@ void run_test(u32 instruction, Fn fn) {
REQUIRE(jit.GetVector(0)[0] == fn(test_case)); REQUIRE(jit.GetVector(0)[0] == fn(test_case));
jit.SetFpcr(0x02000000); jit.SetFpcr(base_fpcr | 0x02000000);
jit.SetVector(0, {42, 0}); jit.SetVector(0, {42, 0});
jit.SetVector(1, {test_case.a, 0}); jit.SetVector(1, {test_case.a, 0});
@ -146,6 +147,7 @@ void run_test(u32 instruction, Fn fn) {
REQUIRE(jit.GetVector(0)[0] == force_default_nan(fn(test_case))); REQUIRE(jit.GetVector(0)[0] == force_default_nan(fn(test_case)));
} }
}
} }
} // namespace } // namespace