xref: /netbsd-src/external/gpl3/gdb/dist/sim/testsuite/bfin/hwloop-branch-out.s (revision 4b169a6ba595ae283ca507b26b15fdff40495b1c)
1# Blackfin testcase for branching out of the middle of a hardware loop
2# mach: bfin
3
4	.include "testutils.inc"
5
6	.macro test_prep lc:req, sym:req
7	imm32 P0, \lc
8	loadsym P1, \sym
9	R5 = 0;
10	R6 = 0;
11	R7 = 0;
12	LSETUP (1f, 2f) LC0 = P0;
13	.endm
14
15	.macro test_check exp5:req, exp6:req, exp7:req, expLC
16	imm32 R4, \exp5;
17	CC = R4 == R5;
18	IF !CC JUMP 2f;
19	imm32 R4, \exp6;
20	CC = R4 == R6;
21	IF !CC JUMP 2f;
22	imm32 R4, \exp7;
23	CC = R4 == R7;
24	IF !CC JUMP 2f;
25	R3 = LC0;
26	imm32 R4, \expLC;
27	CC = R4 == R3;
28	IF !CC JUMP 2f;
29	JUMP 3f;
302:	fail
313:
32	.endm
33
34	start
35	mnop;
36
37test_jump_s:
38	.macro test_jump_s lc:req
39	test_prep \lc, 3f
401:	JUMP (P1);
41	R5 += 1;
422:	R6 += 1;
43	fail
443:	R7 += 1;
45	test_check 0, 0, 1, \lc
46	.endm
47	test_jump_s 0
48	test_jump_s 1
49	test_jump_s 2
50	test_jump_s 10
51
52test_jump_m:
53	.macro test_jump_m lc:req
54	test_prep \lc, 3f
551:	R5 += 1;
56	JUMP (P1);
572:	R6 += 1;
58	fail
593:	R7 += 1;
60	test_check 1, 0, 1, \lc
61	.endm
62	test_jump_m 0
63	test_jump_m 1
64	test_jump_m 2
65	test_jump_m 10
66
67test_jump_e:
68	.macro test_jump_e lc:req, lcend:req
69	test_prep \lc, 3f
701:	R5 += 1;
71	R6 += 1;
722:	JUMP (P1);
73	fail
743:	R7 += 1;
75	test_check 1, 1, 1, \lcend
76	.endm
77	test_jump_e 0, 0
78	test_jump_e 1, 0
79	test_jump_e 2, 1
80	test_jump_e 10, 9
81
82test_call_s:
83	.macro test_call_s lc:req, exp5:req, exp6:req, exp7:req
84	test_prep \lc, __ret
851:	CALL (P1);
86	R5 += 1;
872:	R6 += 1;
883:	R7 += 1;
89	test_check \exp5, \exp6, \exp7, 0
90	.endm
91	test_call_s 0, 1, 1, 2
92	test_call_s 1, 1, 1, 2
93	test_call_s 2, 2, 2, 3
94	test_call_s 10, 10, 10, 11
95
96test_call_m:
97	.macro test_call_m lc:req, exp5:req, exp6:req, exp7:req
98	test_prep \lc, __ret
991:	R5 += 1;
100	CALL (P1);
1012:	R6 += 1;
1023:	R7 += 1;
103	test_check \exp5, \exp6, \exp7, 0
104	.endm
105	test_call_m 0, 1, 1, 2
106	test_call_m 1, 1, 1, 2
107	test_call_m 2, 2, 2, 3
108	test_call_m 10, 10, 10, 11
109
110test_call_e:
111	.macro test_call_e lc:req, exp5:req, exp6:req, exp7:req
112	test_prep \lc, __ret
1131:	R5 += 1;
114	R6 += 1;
1152:	CALL (P1);
1163:	R7 += 1;
117	test_check \exp5, \exp6, \exp7, 0
118	.endm
119	test_call_e 0, 1, 1, 2
120	test_call_e 1, 1, 1, 2
121	test_call_e 2, 2, 2, 3
122	test_call_e 10, 10, 10, 11
123
124	pass
125
126__ret:
127	nop;nop;nop;
128	R7 += 1;
129	rts;
130