aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/A64/fp_min_max.cpp
diff options
context:
space:
mode:
authormerry <[email protected]>2022-12-29 19:32:38 +0000
committermerry <[email protected]>2022-12-29 19:38:45 +0000
commitc63c134582c6adee1113f9f194161164b6bddbec (patch)
tree12f8c484f0a2a1549c89a363d38f342ae3df6201 /tests/A64/fp_min_max.cpp
parent249297003994e5f65a9796d996445583a88f52c5 (diff)
downloaddynarmic-c63c134582c6adee1113f9f194161164b6bddbec.tar.gz
dynarmic-c63c134582c6adee1113f9f194161164b6bddbec.zip
tests/fp_min_max: Test FPCR.FZ
Diffstat (limited to 'tests/A64/fp_min_max.cpp')
-rw-r--r--tests/A64/fp_min_max.cpp108
1 files changed, 55 insertions, 53 deletions
diff --git a/tests/A64/fp_min_max.cpp b/tests/A64/fp_min_max.cpp
index 9e5e11b8..1644fb64 100644
--- a/tests/A64/fp_min_max.cpp
+++ b/tests/A64/fp_min_max.cpp
@@ -69,82 +69,84 @@ void run_test(u32 instruction, Fn fn) {
env.code_mem.emplace_back(instruction); // FMAX S0, S1, S2
env.code_mem.emplace_back(0x14000000); // B .
- for (const auto test_case : test_cases) {
- INFO(test_case.a);
- INFO(test_case.b);
+ for (const auto base_fpcr : {0, 0x01000000}) {
+ for (const auto test_case : test_cases) {
+ INFO(test_case.a);
+ INFO(test_case.b);
- jit.SetFpcr(0);
+ jit.SetFpcr(base_fpcr);
- jit.SetVector(0, {42, 0});
- jit.SetVector(1, {test_case.a, 0});
- jit.SetVector(2, {test_case.b, 0});
- jit.SetPC(0);
+ jit.SetVector(0, {42, 0});
+ jit.SetVector(1, {test_case.a, 0});
+ jit.SetVector(2, {test_case.b, 0});
+ jit.SetPC(0);
- env.ticks_left = 2;
- jit.Run();
+ env.ticks_left = 2;
+ jit.Run();
- REQUIRE(jit.GetVector(0)[0] == fn(test_case));
+ REQUIRE(jit.GetVector(0)[0] == fn(test_case));
- jit.SetVector(0, {42, 0});
- jit.SetVector(1, {test_case.b, 0});
- jit.SetVector(2, {test_case.a, 0});
- jit.SetPC(0);
+ jit.SetVector(0, {42, 0});
+ jit.SetVector(1, {test_case.b, 0});
+ jit.SetVector(2, {test_case.a, 0});
+ jit.SetPC(0);
- env.ticks_left = 2;
- jit.Run();
+ env.ticks_left = 2;
+ jit.Run();
- 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(1, {test_case.a, 0});
- jit.SetVector(2, {test_case.b, 0});
- jit.SetPC(0);
+ jit.SetVector(0, {42, 0});
+ jit.SetVector(1, {test_case.a, 0});
+ jit.SetVector(2, {test_case.b, 0});
+ jit.SetPC(0);
- env.ticks_left = 2;
- jit.Run();
+ env.ticks_left = 2;
+ jit.Run();
- REQUIRE(jit.GetVector(0)[0] == force_default_nan(fn(test_case)));
+ REQUIRE(jit.GetVector(0)[0] == force_default_nan(fn(test_case)));
- jit.SetVector(0, {42, 0});
- jit.SetVector(1, {test_case.b, 0});
- jit.SetVector(2, {test_case.a, 0});
- jit.SetPC(0);
+ jit.SetVector(0, {42, 0});
+ jit.SetVector(1, {test_case.b, 0});
+ jit.SetVector(2, {test_case.a, 0});
+ jit.SetPC(0);
- env.ticks_left = 2;
- jit.Run();
+ env.ticks_left = 2;
+ jit.Run();
- REQUIRE(jit.GetVector(0)[0] == force_default_nan(fn(test_case)));
- }
+ REQUIRE(jit.GetVector(0)[0] == force_default_nan(fn(test_case)));
+ }
- for (const auto test_case : unidirectional_test_cases) {
- INFO(test_case.a);
- INFO(test_case.b);
+ for (const auto test_case : unidirectional_test_cases) {
+ INFO(test_case.a);
+ INFO(test_case.b);
- jit.SetFpcr(0);
+ jit.SetFpcr(base_fpcr);
- jit.SetVector(0, {42, 0});
- jit.SetVector(1, {test_case.a, 0});
- jit.SetVector(2, {test_case.b, 0});
- jit.SetPC(0);
+ jit.SetVector(0, {42, 0});
+ jit.SetVector(1, {test_case.a, 0});
+ jit.SetVector(2, {test_case.b, 0});
+ jit.SetPC(0);
- env.ticks_left = 2;
- jit.Run();
+ env.ticks_left = 2;
+ jit.Run();
- 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(1, {test_case.a, 0});
- jit.SetVector(2, {test_case.b, 0});
- jit.SetPC(0);
+ jit.SetVector(0, {42, 0});
+ jit.SetVector(1, {test_case.a, 0});
+ jit.SetVector(2, {test_case.b, 0});
+ jit.SetPC(0);
- env.ticks_left = 2;
- jit.Run();
+ env.ticks_left = 2;
+ jit.Run();
- REQUIRE(jit.GetVector(0)[0] == force_default_nan(fn(test_case)));
+ REQUIRE(jit.GetVector(0)[0] == force_default_nan(fn(test_case)));
+ }
}
}