1# mach: all
2# output:
3# sim: --environment operating
4
5.include "t-macros.i"
6
7	start
8
9
10
11	;; Check that the instruction @REP_E is executed when it
12	;; is reached using a branch instruction
13
14	ldi r2, 1
15test_rep_1:
16	rep	r2, end_rep_1
17	nop || nop
18	nop || nop
19	nop || nop
20	nop || nop
21	ldi	r3, 46
22	bra	end_rep_1
23	ldi	r3, 42
24end_rep_1:
25	addi	r3, 1
26
27	check 1 r3 47
28
29
30	;; Check that the loop is executed the correct number of times
31
32	ldi	r2, 10
33	ldi	r3, 0
34	ldi	r4, 0
35test_rep_2:
36	rep	r2, end_rep_2
37	nop || nop
38	nop || nop
39	nop || nop
40	nop || nop
41	nop || nop
42	addi	r3, 1
43end_rep_2:
44	addi	r4, 1
45
46	check 2 r3 10
47	check 3 r4 10
48
49	exit0
50