1 # Hitachi H8 testcase 'ldc'
3 # as(h8300): --defsym sim_cpu=0
4 # as(h8300h): --defsym sim_cpu=1
5 # as(h8300s): --defsym sim_cpu=2
6 # as(h8sx): --defsym sim_cpu=3
7 # ld(h8300h): -m h8300helf
8 # ld(h8300s): -m h8300self
9 # ld(h8sx): -m h8300sxelf
11 .include "testutils.inc"
18 .if (sim_cpu == h8300)
28 set_grs_a5a5 ; Fill all general regs with
a fixed pattern
30 .if (sim_cpu == h8300)
35 push.w
r0 ; a5a5 is negative
64 push.w
r1 ;
#1 is non-negative, non-zero
85 .if (sim_cpu == h8300)
91 ;;; test_h_gr16 stacktop-
16 r7 ; FIXME
93 test_h_gr32
0xa5a50004 er0
94 test_h_gr32
0xa5a50001 er1
95 test_h_gr32
0xa5a50002 er2
96 test_h_gr32
0xa5a50003 er3
97 test_h_gr32
0xa5a50004 er4
98 test_h_gr32 stacktop-
16 er7
104 set_grs_a5a5 ; Fill all general regs with
a fixed pattern
106 .if (sim_cpu == h8300)
107 mov.w
#stacktop-16, r7
109 mov.
l #stacktop-16, er7
114 pop.w
r1 ; Should set all flags zero
125 pop.w
r1 ; a5a5 is negative
138 .if (sim_cpu == h8300)
139 ;;; test_h_gr16 stacktop
r7 ; FIXME
141 test_h_gr32 stacktop er7
144 .if (sim_cpu) ; non-zero means not h8300
146 set_grs_a5a5 ; Fill all general regs with
a fixed pattern
149 push.
l er0 ; a5a5 is negative
168 mov @stacktop-
12, er0
170 mov @stacktop-
16, er0
178 push.
l er1 ;
#1 is non-negative, non-zero
190 mov @stacktop-
20, er0
192 mov @stacktop-
24, er0
194 mov @stacktop-
28, er0
196 mov @stacktop-
32, er0
206 test_h_gr32 stacktop-
32 er7
209 set_grs_a5a5 ; Fill all general regs with
a fixed pattern
211 mov.
l #stacktop-32, er7
215 pop.
l er1 ; Should set all flags zero
226 pop.
l er1 ; a5a5 is negative
239 test_h_gr32 stacktop er7
242 ;; Jump over subroutine
246 test_ccr
0 ; call should
not affect ccr
257 .if (sim_cpu == h8300)
272 .if (sim_cpu == h8300)
273 ;;; test_h_gr16 stacktop
, r7 ; FIXME
275 test_h_gr32 stacktop
, er7
279 .if (sim_cpu == h8300)
294 .if (sim_cpu == h8300)
295 ;;; test_h_gr16 stacktop
, r7 ; FIXME
297 test_h_gr32 stacktop
, er7
300 .if (sim_cpu) ; not zero ie. not h8300
303 mov.
l #trap_handler, er7 ; trap vector
309 test_cc_clear ; ccr should
be restored by rte
317 test_h_gr32 stacktop er7
320 .if (sim_cpu == h8sx)
321 _rtsl
: ; Test rts
/l insn.
333 test_h_gr32
0xa5a5a500 er0
334 test_h_gr32
0xa5a5a501 er1
335 test_h_gr32
0xa5a5a502 er2
336 test_h_gr32
0xa5a5a503 er3
337 test_h_gr32
0xa5a5a504 er4
338 test_h_gr32
0xa5a5a505 er5
339 test_h_gr32
0xa5a5a506 er6
340 test_h_gr32 stacktop er7
343 test_h_gr32
0xa5a5a500 er0
344 test_h_gr32
0xa5a5a501 er1
345 test_h_gr32
0xa5a5a502 er2
346 test_h_gr32
0xa5a5a503 er3
347 test_h_gr32
0xa5a5a504 er4
348 test_h_gr32
0xa5a5a505 er5
349 test_h_gr32
0xa5a5a506 er6
350 test_h_gr32 stacktop er7
353 test_h_gr32
0xa5a5a500 er0
354 test_h_gr32
0xa5a5a501 er1
355 test_h_gr32
0xa5a5a502 er2
356 test_h_gr32
0xa5a5a503 er3
357 test_h_gr32
0xa5a5a504 er4
358 test_h_gr32
0xa5a5a505 er5
359 test_h_gr32
0xa5a5a506 er6
360 test_h_gr32 stacktop er7
363 test_h_gr32
0xa5a5a500 er0
364 test_h_gr32
0xa5a5a501 er1
365 test_h_gr32
0xa5a5a502 er2
366 test_h_gr32
0xa5a5a503 er3
367 test_h_gr32
0xa5a5a504 er4
368 test_h_gr32
0xa5a5a505 er5
369 test_h_gr32
0xa5a5a506 er6
370 test_h_gr32 stacktop er7
377 ;; Handler for
a software exception
(trap).
379 ;; Test the
'i' interrupt mask flag.
382 ;; Change the registers
(so we know we
've been here)
390 ;; Change the ccr (which will be restored by RTE)
394 .if (sim_cpu == h8sx)
395 ;; Functions for testing rts/l
396 rtsl1_func: ; Save and restore R0
398 ;; Now modify it, and verify the modification.
400 test_h_gr32 0xfeedface, er0
401 ;; Then use rts/l to restore them and return.
404 rtsl2_func: ; Save and restore R5 and R6
407 ;; Now modify them, and verify the modification.
410 test_h_gr32 0xdeadbeef, er5
411 test_h_gr32 0xfeedface, er6
412 ;; Then use rts/l to restore them and return.
415 rtsl3_func: ; Save and restore R4, R5, and R6
419 ;; Now modify them, and verify the modification.
423 test_h_gr32 0xdeafcafe, er4
424 test_h_gr32 0xdeadbeef, er5
425 test_h_gr32 0xfeedface, er6
426 ;; Then use rts/l to restore them and return.
429 rtsl4_func: ; Save and restore R0 - R3
434 ;; Now modify them, and verify the modification.
439 test_h_gr32 0xdadacafe, er0
440 test_h_gr32 0xfeedbeef, er1
441 test_h_gr32 0xdeadface, er2
442 test_h_gr32 0xf00dd00d, er3
443 ;; Then use rts/l to restore them and return.