summaryrefslogtreecommitdiff
path: root/sim/testsuite/sim/h8300/shll.s
blob: fcff565c6fab4d217b820e070d5f6ccfc5efd451 (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
# Hitachi H8 testcase 'shll'
# mach(): all
# as(h8300):	--defsym sim_cpu=0
# as(h8300h):	--defsym sim_cpu=1
# as(h8300s):	--defsym sim_cpu=2
# as(h8sx):	--defsym sim_cpu=3
# ld(h8300h):	-m h8300helf
# ld(h8300s):	-m h8300self
# ld(h8sx):	-m h8300sxelf

	.include "testutils.inc"

	start

	.data
byte_dest:	.byte	0xa5
	.align 2
word_dest:	.word	0xa5a5
	.align 4
long_dest:	.long	0xa5a5a5a5

	.text

shll_b_reg8_1:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.b	r0l		; shift left logical by one
;;;	.word	0x1008

	test_carry_set		; H=0 N=0 Z=0 V=0 C=1
	test_zero_clear
	test_ovf_clear
	test_neg_clear
	test_h_gr16 0xa54a r0	; 1010 0101 -> 0100 1010
.if (sim_cpu)
	test_h_gr32 0xa5a5a54a er0
.endif
	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

shll_b_reg8_2:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.b	#2, r0l		; shift left logical by two
;;; 	.word	0x1048

	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
	test_zero_clear
	test_ovf_clear
	test_neg_set

	test_h_gr16 0xa594 r0	; 1010 0101 -> 1001 0100
.if (sim_cpu)
	test_h_gr32 0xa5a5a594 er0
.endif
	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

.if (sim_cpu == h8sx)
shll_b_reg8_4:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.b	#4, r0l		; shift left logical by four
;;;	.word	0x10a8

	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
	test_zero_clear
	test_ovf_clear
	test_neg_clear
	test_h_gr16 0xa550 r0	; 1010 0101 -> 0101 0000
	test_h_gr32 0xa5a5a550 er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7
.endif

.if (sim_cpu)			; Not available in h8300 mode
shll_w_reg16_1:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.w	r0		; shift left logical by one
;;;	.word	0x1010

	test_carry_set		; H=0 N=0 Z=0 V=0 C=1
	test_zero_clear
	test_ovf_clear
	test_neg_clear
	test_h_gr16 0x4b4a r0	; 1010 0101 1010 0101 -> 0100 1011 0100 1010
	test_h_gr32 0xa5a54b4a er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

shll_w_reg16_2:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.w	#2, r0		; shift left logical by two
;;;	.word	0x1050

	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
	test_zero_clear
	test_ovf_clear
	test_neg_set
	test_h_gr16 0x9694 r0	; 1010 0101 1010 0101 -> 1001 0110 1001 0100
	test_h_gr32 0xa5a59694 er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

.if (sim_cpu == h8sx)
shll_w_reg16_4:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.w	#4, r0		; shift left logical by four
;;;	.word	0x1020

	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
	test_zero_clear
	test_ovf_clear
	test_neg_clear
	test_h_gr16 0x5a50 r0	; 1010 0101 1010 0101 -> 0101 1010 0101 0000
	test_h_gr32 0xa5a55a50 er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

shll_w_reg16_8:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.w	#8, r0		; shift left logical by eight
;;;	.word	0x1060

	test_carry_set		; H=0 N=1 Z=0 V=0 C=1
	test_zero_clear
	test_ovf_clear
	test_neg_set
	test_h_gr16 0xa500 r0	; 1010 0101 1010 0101 -> 1010 0101 0000 0000
	test_h_gr32 0xa5a5a500 er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7
.endif

shll_l_reg32_1:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.l	er0		; shift left logical by one
;;;	.word	1030

	test_carry_set		; H=0 N=0 Z=0 V=0 C=1
	test_zero_clear
	test_ovf_clear
	test_neg_clear
	; 1010 0101 1010 0101 1010 0101 1010 0101 
	; -> 0100 1011 0100 1011 0100 1011 0100 1010
	test_h_gr32 0x4b4b4b4a er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

shll_l_reg32_2:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.l	#2, er0		; shift left logical by two
;;;	.word	0x1070

	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
	test_zero_clear
	test_ovf_clear
	test_neg_set
	; 1010 0101 1010 0101 1010 0101 1010 0101
	; -> 1001 0110 1001 0110 1001 0110 1001 0100
	test_h_gr32 0x96969694 er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

.if (sim_cpu == h8sx)
shll_l_reg32_4:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.l	#4, er0		; shift left logical by four
;;;	.word	0x1038

	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
	test_zero_clear
	test_ovf_clear
	test_neg_clear
	; 1010 0101 1010 0101 1010 0101 1010 0101
	; -> 0101 1010 0101 1010 0101 1010 0101 0000
	test_h_gr32 0x5a5a5a50 er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

shll_l_reg32_8:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.l	#8, er0		; shift left logical by eight
;;;	.word	0x1078

	test_carry_set		; H=0 N=1 Z=0 V=0 C=1
	test_zero_clear
	test_ovf_clear
	test_neg_set
	test_h_gr16 0xa500 r0	
	; 1010 0101 1010 0101 1010 0101 1010 0101
	; -> 1010 0101 1010 0101 1010 0101 0000 0000
	test_h_gr32 0xa5a5a500 er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7

shll_l_reg32_16:
	set_grs_a5a5		; Fill all general regs with a fixed pattern
	set_ccr_zero

	shll.l	#16, er0	; shift left logical by sixteen
;;;	.word	0x10f8

	test_carry_set		; H=0 N=1 Z=0 V=0 C=1
	test_zero_clear
	test_ovf_clear
	test_neg_set
	; 1010 0101 1010 0101 1010 0101 1010 0101
	;; -> 1010 0101 1010 0101 0000 0000 0000 0000
	test_h_gr32 0xa5a50000 er0

	test_gr_a5a5 1		; Make sure other general regs not disturbed
	test_gr_a5a5 2
	test_gr_a5a5 3
	test_gr_a5a5 4
	test_gr_a5a5 5
	test_gr_a5a5 6
	test_gr_a5a5 7
.endif
.endif

	pass

	exit 0