aboutsummaryrefslogtreecommitdiff
path: root/deps/lightning/check/jmpr.tst
diff options
context:
space:
mode:
authorTwinaphex2020-02-08 16:24:22 +0100
committerGitHub2020-02-08 16:24:22 +0100
commit0adc619b5a5705d16cc6caea64951776ababbb96 (patch)
treefbae9b1d18d04d8e7908aa1c3446782ebf6e8785 /deps/lightning/check/jmpr.tst
parent0204c39a68a1fd4bf667aa8ece5a769f2983b7d0 (diff)
parent6f1edc3c7fd1f7f58155107d0c99d0ac7d22443b (diff)
downloadpcsx_rearmed-0adc619b5a5705d16cc6caea64951776ababbb96.tar.gz
pcsx_rearmed-0adc619b5a5705d16cc6caea64951776ababbb96.tar.bz2
pcsx_rearmed-0adc619b5a5705d16cc6caea64951776ababbb96.zip
Merge pull request #377 from pcercuei/libretro
Lightrec dynarec
Diffstat (limited to 'deps/lightning/check/jmpr.tst')
-rw-r--r--deps/lightning/check/jmpr.tst66
1 files changed, 66 insertions, 0 deletions
diff --git a/deps/lightning/check/jmpr.tst b/deps/lightning/check/jmpr.tst
new file mode 100644
index 0000000..669f54e
--- /dev/null
+++ b/deps/lightning/check/jmpr.tst
@@ -0,0 +1,66 @@
+/*
+This is a very simple check to a condition that on lightning 2.0.5
+could cause an assertion on some backends, due to correcting a problem
+with temporaries that could not be saved/reloaded due to being used only
+in the hardware instruction, or being considered live for too long on the
+lightning instruction, and that could not be reloaded after the jump target
+(or after false/true target on conditional branches).
+
+If this code in lib/lightning.c:_jit_update():
+
+ for (regno = 0; regno < _jitc->reglen; regno++) {
+ spec = jit_class(_rvs[regno].spec);
+ if (jit_regset_tstbit(mask, regno) &&
+ (spec & (jit_class_gpr|jit_class_fpr)) &&
+ !(spec & jit_class_sav))
+ jit_regset_clrbit(mask, regno);
+ }
+
+were removed, this test case, on x86_64 would fail like this:
+
+lt-lightning: lightning.c:305: _jit_get_reg: Assertion `regspec & 0x02000000' failed.
+Aborted (core dumped)
+ */
+
+.data 32
+ret:
+#if __WORDSIZE == 32
+.i 0
+#else
+.l 0
+#endif
+ok:
+.c "ok"
+
+.code
+ prolog
+ jmpi start
+
+add_v1_v2:
+ addr %v1 %v1 %v2
+ ldi %r0 ret
+ jmpr %r0
+
+start:
+ movi %v1 1
+ movi %v2 2
+ movi %r0 ret_add_v1_v2
+ sti ret %r0
+ movi %v0 add_v1_v2
+ jmpr %v0
+ movi_d %f0 3
+ beqi_d pass_movi_f0 %f0 3
+ calli @abort
+pass_movi_f0:
+ beqi pass_check_v2 %v2 2
+ calli @abort
+pass_check_v2:
+ret_add_v1_v2:
+ beqi pass_add_v1_v2 %v1 3
+ calli @abort
+pass_add_v1_v2:
+ prepare
+ pushargi ok
+ finishi @puts
+ ret
+ epilog