1/*
2This is a very simple check to a condition that on lightning 2.0.5
3could cause an assertion on some backends, due to correcting a problem
4with temporaries that could not be saved/reloaded due to being used only
5in the hardware instruction, or being considered live for too long on the
6lightning instruction, and that could not be reloaded after the jump target
7(or after false/true target on conditional branches).
8
9If this code in lib/lightning.c:_jit_update():
10
11		    for (regno = 0; regno < _jitc->reglen; regno++) {
12			spec = jit_class(_rvs[regno].spec);
13			if (jit_regset_tstbit(mask, regno) &&
14			    (spec & (jit_class_gpr|jit_class_fpr)) &&
15			    !(spec & jit_class_sav))
16			    jit_regset_clrbit(mask, regno);
17		    }
18
19were removed, this test case, on x86_64 would fail like this:
20
21lt-lightning: lightning.c:305: _jit_get_reg: Assertion `regspec & 0x02000000' failed.
22Aborted (core dumped)
23 */
24
25.data	32
26ret:
27#if __WORDSIZE == 32
28.i	0
29#else
30.l	0
31#endif
32ok:
33.c	"ok"
34
35.code
36	prolog
37	jmpi start
38
39add_v1_v2:
40	addr %v1 %v1 %v2
41	ldi %r0 ret
42	jmpr %r0
43
44start:
45	movi %v1 1
46	movi %v2 2
47	movi %r0 ret_add_v1_v2
48	sti ret %r0
49	movi %v0 add_v1_v2
50	jmpr %v0
51	movi_d %f0 3
52	beqi_d pass_movi_f0 %f0 3
53	calli @abort
54pass_movi_f0:
55	beqi pass_check_v2 %v2 2
56	calli @abort
57pass_check_v2:
58ret_add_v1_v2:
59	beqi pass_add_v1_v2 %v1 3
60	calli @abort
61pass_add_v1_v2:
62	prepare
63		pushargi ok
64	finishi @puts
65	ret
66	epilog
67