aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorLiam <[email protected]>2022-11-16 16:50:33 -0500
committerLiam <[email protected]>2022-12-03 11:16:26 -0500
commit21b42114143c3e09aafd73cf0b0fc5c99b5014c6 (patch)
tree59c844c1e3c548f4b7b494468bb80182ac95c93a /tests
parent16101049f3511b5ccb3b24dd383f8d8e498b0270 (diff)
downloaddynarmic-21b42114143c3e09aafd73cf0b0fc5c99b5014c6.tar.gz
dynarmic-21b42114143c3e09aafd73cf0b0fc5c99b5014c6.zip
Add test for isolated GetNZCVFromOp
Diffstat (limited to 'tests')
-rw-r--r--tests/A64/a64.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/A64/a64.cpp b/tests/A64/a64.cpp
index 6190ae14..5edc7730 100644
--- a/tests/A64/a64.cpp
+++ b/tests/A64/a64.cpp
@@ -1041,6 +1041,37 @@ TEST_CASE("A64: EXTR", "[a64]") {
REQUIRE(jit.GetRegister(23) == 0);
}
+TEST_CASE("A64: Isolated GetNZCVFromOp", "[a64]") {
+ A64TestEnv env;
+ A64::Jit jit{A64::UserConfig{&env}};
+
+ env.code_mem.emplace_back(0xaa1f03f5); // MOV X21, XZR
+ env.code_mem.emplace_back(0x912a02da); // ADD X26, X22, #0xa80
+ env.code_mem.emplace_back(0x913662dc); // ADD X28, X22, #0xd98
+ env.code_mem.emplace_back(0x320003e8); // MOV W8, #1
+ env.code_mem.emplace_back(0xa9006bfc); // STP X28, X26, [SP]
+ env.code_mem.emplace_back(0x7200011f); // TST W8, #1
+ env.code_mem.emplace_back(0xf94007e8); // LDR X8, [SP, #8]
+ env.code_mem.emplace_back(0x321e03e3); // MOV W3, #4
+ env.code_mem.emplace_back(0xaa1303e2); // MOV X2, X19
+ env.code_mem.emplace_back(0x9a881357); // CSEL X23, X26, X8, NE
+ env.code_mem.emplace_back(0xf94003e8); // LDR X8, [SP]
+ env.code_mem.emplace_back(0xaa1703e0); // MOV X0, X23
+ env.code_mem.emplace_back(0x9a881396); // CSEL X22, X28, X8, NE
+ env.code_mem.emplace_back(0x92407ea8); // AND X8, X21, #0xffffffff
+ env.code_mem.emplace_back(0x1ac8269b); // LSR W27, W20, W8
+ env.code_mem.emplace_back(0x0b1b0768); // ADD W8, W27, W27, LSL #1
+ env.code_mem.emplace_back(0x937f7d01); // SBFIZ X1, X8, #1, #32
+ env.code_mem.emplace_back(0x2a1f03e4); // MOV W4, WZR
+ env.code_mem.emplace_back(0x531e7779); // LSL W25, W27, #2
+ env.code_mem.emplace_back(0x14000000); // B .
+
+ jit.SetPC(0);
+
+ env.ticks_left = 20;
+ jit.Run();
+}
+
TEST_CASE("A64: Optimization failure when folding ADD", "[a64]") {
A64TestEnv env;
A64::Jit jit{A64::UserConfig{&env}};