1 .data
2foodata: .hword 42
3 .text
4footext:
5	.text
6
7	.macro test nm:req, args:vararg
8\nm:	\nm \args
9	.global \nm
10	.endm
11
12;;; Basic Instruction Tests
131:				; All branches
14        test beq,1b
15        test bne,1b
16        test bgtu,1b
17	test bgteu,1b
18	test blteu,1b
19        test bltu,1b
20	test bgt,1b
21	test bgte,1b
22	test blt,1b
23	test blte,1b
24
25	test bbeq,1b
26	test bbne,1b
27	test bblt,1b
28	test b,1b
29	test bl,1b
30
31;;; jumps
32	test jr,r1
33	jr	r31
34
35	test jalr,r1
36	jalr r31
37
38
39	.macro test3i nm:req
40	test \nm,r1,r2,r3
41	\nm	r32,r33,r34
42	\nm	r1,r2,#3
43	\nm	r11,r2,#16
44	.endm
45	test3i add
46	test3i sub
47	test3i asr
48	test3i lsr
49	test3i lsl
50
51	.macro test3 nm:req
52	test \nm,r1,r2,r3
53	\nm	r11,r12,r13
54	.endm
55
56	test3 orr
57	test3 and
58	test3 eor
59
60	.macro testmem  nm:req
61        \nm	r0,[r1,#3]
62	\nm	r10,[r1,#255]
63	\nm	r0,[r1,r2]
64	\nm	r0,[r1,r11]
65	\nm	r0,[r3],r2
66	\nm	r10,[r12],r13
67	.endm
68
69	testmem ldrb
70	testmem ldrh
71	testmem ldr
72	testmem	ldrd
73
74
75	testmem strb
76	testmem strh
77	testmem str
78	testmem	strd
79
80	test mov,r6,#255
81	mov	r31,#65535
82	mov	r0,#4098
83
84	.macro testmov cond:req
85	mov\cond r1,r2
86	mov\cond r11,r12
87	.endm
88
89	testmov eq
90	testmov	ne
91	testmov	gtu
92	testmov gteu
93	testmov lteu
94	testmov ltu
95	testmov	gt
96	testmov gte
97	testmov	lt
98	testmov	lte
99	testmov beq
100	testmov bne
101	testmov blt
102	testmov blte
103	mov	r1,r2
104	mov	r11,r12
105
106	test	nop
107	test	idle
108	test	bkpt
109
110	test3	fadd
111	test3	fsub
112	test3	fmul
113	test3	fmadd
114	test3	fmsub
115
116	movts	config,r1
117	movts	status,r31
118
119	movfs	r1,imask
120	movfs	r31,pc
121
122	test trap,#0		; write syscall for simulator.
123        rti     		; dummy instruction
124