aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite/sh/fmov.s
blob: 29c51b5d1e595b182ae248f54285924553dc8908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# sh testcase for all fmov instructions
# mach: sh
# as(sh):	-defsym sim_cpu=0

	.include "testutils.inc"

	.macro init
	fldi0	fr0
	fldi1	fr1
	fldi1	fr2
	fldi1	fr3
	.endm

	start

fmov1:	# Test fr -> fr.
	set_grs_a5a5
	set_fprs_a5a5
	init
	single_prec
	sz_32
	fmov	fr0, fr1
	# Ensure fr0 and fr1 are now equal.
	fcmp/eq	fr0, fr1
	bt	fmov2
	fail

fmov2:	# Test dr -> dr.
	init
	double_prec
	sz_64
	fmov	dr0, dr2
	# Ensure dr0 and dr2 are now equal.
	fcmp/eq	dr0, dr2
	bt	fmov3
	fail

fmov3:	# Test dr -> xd and xd -> dr.
	init
	sz_64
	fmov	dr0, xd0
	# Ensure dr0 and xd0 are now equal.
	fmov	xd0, dr2
	fcmp/eq	dr0, dr2
	bt	fmov4
	fail

fmov4:	# Test xd -> xd.
	init
	sz_64
	double_prec
	fmov	dr0, xd0
	fmov	xd0, xd2
	fmov	xd2, dr2
	# Ensure dr0 and dr2 are now equal.
	fcmp/eq	dr0, dr2
	bt	.L0
	fail

	# FIXME: test fmov.s fr -> @gr,      fmov dr -> @gr
	# FIXME: test fmov.s @gr -> fr,      fmov @gr -> dr
	# FIXME: test fmov.s @gr+ -> fr,     fmov @gr+ -> dr
	# FIXME: test fmov.s fr -> @-gr,     fmov dr -> @-gr
	# FIXME: test fmov.s @(r0,gr) -> fr, fmov @(r0,gr) -> dr
	# FIXME: test fmov.s fr -> @(r0,gr), fmov dr -> @(r0,gr)
	
.L0:
	test_grs_a5a5
	sz_32
	single_prec
	assert_fpreg_i	0, fr0
	assert_fpreg_i	1, fr1
	assert_fpreg_i	0, fr2
	assert_fpreg_i	1, fr3
	test_fpr_a5a5	fr4
	test_fpr_a5a5	fr5
	test_fpr_a5a5	fr6
	test_fpr_a5a5	fr7
	test_fpr_a5a5	fr8
	test_fpr_a5a5	fr9
	test_fpr_a5a5	fr10
	test_fpr_a5a5	fr11
	test_fpr_a5a5	fr12
	test_fpr_a5a5	fr13
	test_fpr_a5a5	fr14
	test_fpr_a5a5	fr15

fmov5:	# Test fr -> @rn and @rn -> fr.
	init
	sz_32
	single_prec
	# FIXME!  Use a reserved memory location!
	mov	#40, r0
	shll8	r0
	fmov	fr0, @r0
	fmov	@r0, fr1
	fcmp/eq	fr0, fr1
	bt	fmov6
	fail

fmov6:	# Test dr -> @rn and @rn -> dr.
	init
	sz_64
	double_prec
	mov	#40, r0
	shll8	r0
	fmov	dr0, @r0
	fmov	@r0, dr2
	fcmp/eq	dr0, dr2
	bt	fmov7
	fail

fmov7:	# Test xd -> @rn and @rn -> xd.
	init
	sz_64
	double_prec
	mov	#40, r0
	shll8	r0
	fmov	dr0, xd0
	fmov	xd0, @r0
	fmov	@r0, xd2
	fmov	xd2, dr2
	fcmp/eq	dr0, dr2
	bt	fmov8
	fail

fmov8:	# Test fr -> @-rn.
	init
	sz_32
	single_prec
	mov	#40, r0
	shll8	r0
	# Preserve.
	mov	r0, r1
	fmov	fr0, @-r0
	fmov	@r0, fr2
	fcmp/eq	fr0, fr2
	bt	f8b
	fail
f8b:	# check pre-dec.
	add	#4, r0
	cmp/eq	r0, r1
	bt	fmov9
	fail

fmov9:	# Test dr -> @-rn.
	init
	sz_64
	double_prec
	mov	#40, r0
	shll8	r0
	# Preserve r0.
	mov	r0, r1
	fmov	dr0, @-r0
	fmov	@r0, dr2
	fcmp/eq	dr0, dr2
	bt	f9b
	fail
f9b:	# check pre-dec.
	add	#8, r0
	cmp/eq	r0, r1
	bt	fmov10
	fail

fmov10:	# Test xd -> @-rn.
	init
	sz_64
	double_prec
	mov	#40, r0
	shll8	r0
	# Preserve r0.
	mov	r0, r1
	fmov	dr0, xd0
	fmov	xd0, @-r0
	fmov	@r0, xd2
	fmov	xd2, dr2
	fcmp/eq	dr0, dr2
	bt	f10b
	fail
f10b:	# check pre-dec.
	add	#8, r0
	cmp/eq	r0, r1
	bt	fmov11
	fail

fmov11:	# Test @rn+ -> fr.
	init
	sz_32
	single_prec
	mov	#40, r0
	shll8	r0
	# Preserve r0.
	mov	r0, r1
	fmov	fr0, @r0
	fmov	@r0+, fr2
	fcmp/eq	fr0, fr2
	bt	f11b
	fail
f11b:	# check post-inc.
	add	#4, r1
	cmp/eq	r0, r1
	bt	fmov12
	fail

fmov12:	# Test @rn+ -> dr.
	init
	sz_64
	double_prec
	mov	#40, r0
	shll8	r0
	# preserve r0.
	mov	r0, r1
	fmov	dr0, @r0
	fmov	@r0+, dr2
	fcmp/eq	dr0, dr2
	bt	f12b
	fail
f12b:	# check post-inc.
	add	#8, r1
	cmp/eq	r0, r1
	bt	fmov13
	fail

fmov13:	# Test @rn -> xd.
	init
	sz_64
	double_prec
	mov	#40, r0
	shll8	r0
	# Preserve r0.
	mov	r0, r1
	fmov	dr0, xd0
	fmov	xd0, @r0
	fmov	@r0+, xd2
	fmov	xd2, dr2
	fcmp/eq	dr0, dr2
	bt	f13b
	fail
f13b:
	add	#8, r1
	cmp/eq	r0, r1
	bt	fmov14
	fail

fmov14:	# Test fr -> @(r0,rn), @(r0, rn) -> fr.
	init
	sz_32
	single_prec
	mov	#40, r0
	shll8	r0
	mov	#0, r1
	fmov	fr0, @(r0, r1)
	fmov	@(r0, r1), fr1
	fcmp/eq	fr0, fr1
	bt	fmov15
	fail

fmov15:	# Test dr -> @(r0, rn), @(r0, rn) -> dr.
	init
	sz_64
	double_prec
	mov	#40, r0
	shll8	r0
	mov	#0, r1
	fmov	dr0, @(r0, r1)
	fmov	@(r0, r1), dr2
	fcmp/eq	dr0, dr2
	bt	fmov16
	fail

fmov16:	# Test xd -> @(r0, rn), @(r0, rn) -> xd.
	init
	sz_64
	double_prec
	mov	#40, r0
	shll8	r0
	mov	#0, r1
	fmov	dr0, xd0
	fmov	xd0, @(r0, r1)
	fmov	@(r0, r1), xd2
	fmov	xd2, dr2
	fcmp/eq	dr0, dr2
	bt	.L1
	fail
.L1:
	assertreg0	0x2800
	assertreg	0, r1
	test_gr_a5a5	r2
	test_gr_a5a5	r3
	test_gr_a5a5	r4
	test_gr_a5a5	r5
	test_gr_a5a5	r6
	test_gr_a5a5	r7
	test_gr_a5a5	r8
	test_gr_a5a5	r9
	test_gr_a5a5	r10
	test_gr_a5a5	r11
	test_gr_a5a5	r12
	test_gr_a5a5	r13
	test_gr_a5a5	r14

	sz_32
	single_prec
	assert_fpreg_i	0, fr0
	assert_fpreg_i	1, fr1
	assert_fpreg_i	0, fr2
	assert_fpreg_i	1, fr3
	test_fpr_a5a5	fr4
	test_fpr_a5a5	fr5
	test_fpr_a5a5	fr6
	test_fpr_a5a5	fr7
	test_fpr_a5a5	fr8
	test_fpr_a5a5	fr9
	test_fpr_a5a5	fr10
	test_fpr_a5a5	fr11
	test_fpr_a5a5	fr12
	test_fpr_a5a5	fr13
	test_fpr_a5a5	fr14
	test_fpr_a5a5	fr15

	pass
	exit 0