From a1192a51d846e7de9018f0f856595323b977e886 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Mon, 14 Jun 2021 12:43:06 -0700 Subject: [PATCH] tests: add F{MIN,MAX}NM tests --- tests/A64/a64.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/A64/a64.cpp b/tests/A64/a64.cpp index 7a258e11..a6e54975 100644 --- a/tests/A64/a64.cpp +++ b/tests/A64/a64.cpp @@ -520,6 +520,50 @@ TEST_CASE("A64: FMAX", "[a64]") { REQUIRE(jit.GetVector(2) == Vector{0x7fc0000009503366, 0x6e4b0a41ffffffff}); } +TEST_CASE("A64: FMINNM", "[a64]") { + A64TestEnv env; + A64::Jit jit{A64::UserConfig{&env}}; + + env.code_mem.emplace_back(0x4ea1c400); // FMINNM.4S V0, V0, V1 + env.code_mem.emplace_back(0x4ee3c442); // FMINNM.2D V2, V2, V3 + env.code_mem.emplace_back(0x14000000); // B . + + jit.SetPC(0); + jit.SetVector(0, {0x7fc00000'09503366, 0x00000000'7f984a37}); + jit.SetVector(1, {0xc1200000'00000001, 0x6e4b0a41'ffffffff}); + + jit.SetVector(2, {0x7fc0000009503366, 0x3ff0000000000000}); + jit.SetVector(3, {0xfff0000000000000, 0xffffffffffffffff}); + + env.ticks_left = 2; + jit.Run(); + + REQUIRE(jit.GetVector(0) == Vector{0xc1200000'00000001, 0x00000000'7fd84a37}); + REQUIRE(jit.GetVector(2) == Vector{0xfff0000000000000, 0x3ff0000000000000}); +} + +TEST_CASE("A64: FMAXNM", "[a64]") { + A64TestEnv env; + A64::Jit jit{A64::UserConfig{&env}}; + + env.code_mem.emplace_back(0x4e21c400); // FMAXNM.4S V0, V0, V1 + env.code_mem.emplace_back(0x4e63c442); // FMAXNM.2D V2, V2, V3 + env.code_mem.emplace_back(0x14000000); // B . + + jit.SetPC(0); + jit.SetVector(0, {0x7fc00000'09503366, 0x00000000'7f984a37}); + jit.SetVector(1, {0xc1200000'00000001, 0x6e4b0a41'ffffffff}); + + jit.SetVector(2, {0x7fc0000009503366, 0x3ff0000000000000}); + jit.SetVector(3, {0xfff0000000000000, 0xffffffffffffffff}); + + env.ticks_left = 2; + jit.Run(); + + REQUIRE(jit.GetVector(0) == Vector{0xc1200000'09503366, 0x6e4b0a41'7fd84a37}); + REQUIRE(jit.GetVector(2) == Vector{0x7fc0000009503366, 0x3ff0000000000000}); +} + TEST_CASE("A64: 128-bit exclusive read/write", "[a64]") { A64TestEnv env; ExclusiveMonitor monitor{1};