Home | History | Annotate | Line # | Download | only in h8300
ldm.s revision 1.1.1.1
      1  1.1  christos # Hitachi H8 testcase 'ldm', 'stm'
      2  1.1  christos # mach(): all
      3  1.1  christos # as(h8300):	--defsym sim_cpu=0
      4  1.1  christos # as(h8300h):	--defsym sim_cpu=1
      5  1.1  christos # as(h8300s):	--defsym sim_cpu=2
      6  1.1  christos # as(h8sx):	--defsym sim_cpu=3
      7  1.1  christos # ld(h8300h):	-m h8300helf
      8  1.1  christos # ld(h8300s):	-m h8300self
      9  1.1  christos # ld(h8sx):	-m h8300sxelf
     10  1.1  christos 
     11  1.1  christos 	.include "testutils.inc"
     12  1.1  christos 	.data
     13  1.1  christos 	.align 4
     14  1.1  christos _stack:	.long	0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0
     15  1.1  christos 	.long	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
     16  1.1  christos 	.long	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
     17  1.1  christos 	.long	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
     18  1.1  christos _stack_top:
     19  1.1  christos 
     20  1.1  christos 	start
     21  1.1  christos 
     22  1.1  christos .if (sim_cpu == h8300s || sim_cpu == h8sx)	; Earlier versions, no exr
     23  1.1  christos stm_2reg:
     24  1.1  christos 	set_grs_a5a5
     25  1.1  christos 	mov	#_stack_top, er7
     26  1.1  christos 	mov	#2, er2
     27  1.1  christos 	mov	#3, er3
     28  1.1  christos 
     29  1.1  christos 	set_ccr_zero
     30  1.1  christos 	stm	er2-er3, @-sp
     31  1.1  christos 	test_cc_clear
     32  1.1  christos 
     33  1.1  christos 	test_gr_a5a5 0		; Make sure other general regs not disturbed
     34  1.1  christos 	test_gr_a5a5 1
     35  1.1  christos 	test_h_gr32  2	er2
     36  1.1  christos 	test_h_gr32  3	er3
     37  1.1  christos 	test_gr_a5a5 4
     38  1.1  christos 	test_gr_a5a5 5
     39  1.1  christos 	test_gr_a5a5 6
     40  1.1  christos 	test_h_gr32  _stack_top-8, er7
     41  1.1  christos 
     42  1.1  christos 	mov	@_stack_top-4, er0
     43  1.1  christos 	cmp	#2, er0
     44  1.1  christos 	bne	fail1
     45  1.1  christos 
     46  1.1  christos 	mov	@_stack_top-8, er0
     47  1.1  christos 	cmp	#3, er0
     48  1.1  christos 	bne	fail1
     49  1.1  christos 
     50  1.1  christos 	mov	@_stack_top-12, er0
     51  1.1  christos 	cmp	#0, er0
     52  1.1  christos 	bne	fail1
     53  1.1  christos 
     54  1.1  christos stm_3reg:
     55  1.1  christos 	set_grs_a5a5
     56  1.1  christos 	mov	#_stack_top, er7
     57  1.1  christos 	mov	#4, er4
     58  1.1  christos 	mov	#5, er5
     59  1.1  christos 	mov	#6, er6
     60  1.1  christos 
     61  1.1  christos 	set_ccr_zero
     62  1.1  christos 	stm	er4-er6, @-sp
     63  1.1  christos 	test_cc_clear
     64  1.1  christos 
     65  1.1  christos 	test_gr_a5a5 0		; Make sure other general regs not disturbed
     66  1.1  christos 	test_gr_a5a5 1
     67  1.1  christos 	test_gr_a5a5 2
     68  1.1  christos 	test_gr_a5a5 3
     69  1.1  christos 	test_h_gr32  4	er4
     70  1.1  christos 	test_h_gr32  5	er5
     71  1.1  christos 	test_h_gr32  6	er6
     72  1.1  christos 	test_h_gr32  _stack_top-12, er7
     73  1.1  christos 
     74  1.1  christos 	mov	@_stack_top-4, er0
     75  1.1  christos 	cmp	#4, er0
     76  1.1  christos 	bne	fail1
     77  1.1  christos 
     78  1.1  christos 	mov	@_stack_top-8, er0
     79  1.1  christos 	cmp	#5, er0
     80  1.1  christos 	bne	fail1
     81  1.1  christos 
     82  1.1  christos 	mov	@_stack_top-12, er0
     83  1.1  christos 	cmp	#6, er0
     84  1.1  christos 	bne	fail1
     85  1.1  christos 
     86  1.1  christos 	mov	@_stack_top-16, er0
     87  1.1  christos 	cmp	#0, er0
     88  1.1  christos 	bne	fail1
     89  1.1  christos 
     90  1.1  christos stm_4reg:
     91  1.1  christos 	set_grs_a5a5
     92  1.1  christos 	mov	#_stack_top, er7
     93  1.1  christos 	mov	#1, er0
     94  1.1  christos 	mov	#2, er1
     95  1.1  christos 	mov	#3, er2
     96  1.1  christos 	mov	#4, er3
     97  1.1  christos 
     98  1.1  christos 	set_ccr_zero
     99  1.1  christos 	stm	er0-er3, @-sp
    100  1.1  christos 	test_cc_clear
    101  1.1  christos 
    102  1.1  christos 	test_h_gr32  1	er0
    103  1.1  christos 	test_h_gr32  2	er1
    104  1.1  christos 	test_h_gr32  3	er2
    105  1.1  christos 	test_h_gr32  4	er3
    106  1.1  christos 	test_gr_a5a5 4		; Make sure other general regs not disturbed
    107  1.1  christos 	test_gr_a5a5 5
    108  1.1  christos 	test_gr_a5a5 6
    109  1.1  christos 	test_h_gr32  _stack_top-16, er7
    110  1.1  christos 
    111  1.1  christos 	mov	@_stack_top-4, er0
    112  1.1  christos 	cmp	#1, er0
    113  1.1  christos 	bne	fail1
    114  1.1  christos 
    115  1.1  christos 	mov	@_stack_top-8, er0
    116  1.1  christos 	cmp	#2, er0
    117  1.1  christos 	bne	fail1
    118  1.1  christos 
    119  1.1  christos 	mov	@_stack_top-12, er0
    120  1.1  christos 	cmp	#3, er0
    121  1.1  christos 	bne	fail1
    122  1.1  christos 
    123  1.1  christos 	mov	@_stack_top-16, er0
    124  1.1  christos 	cmp	#4, er0
    125  1.1  christos 	bne	fail1
    126  1.1  christos 
    127  1.1  christos 	mov	@_stack_top-20, er0
    128  1.1  christos 	cmp	#0, er0
    129  1.1  christos 	bne	fail1
    130  1.1  christos 
    131  1.1  christos ldm_2reg:
    132  1.1  christos 	set_grs_a5a5
    133  1.1  christos 	mov	#_stack, er7
    134  1.1  christos 
    135  1.1  christos 	set_ccr_zero
    136  1.1  christos 	ldm	@sp+, er2-er3
    137  1.1  christos 	test_cc_clear
    138  1.1  christos 
    139  1.1  christos 	test_gr_a5a5 0		; Make sure other general regs not disturbed
    140  1.1  christos 	test_gr_a5a5 1
    141  1.1  christos 	test_h_gr32  1	er2
    142  1.1  christos 	test_h_gr32  0	er3
    143  1.1  christos 	test_gr_a5a5 4
    144  1.1  christos 	test_gr_a5a5 5
    145  1.1  christos 	test_gr_a5a5 6
    146  1.1  christos 	test_h_gr32  _stack+8, er7
    147  1.1  christos 
    148  1.1  christos ldm_3reg:
    149  1.1  christos 	set_grs_a5a5
    150  1.1  christos 	mov	#_stack+4, er7
    151  1.1  christos 
    152  1.1  christos 	set_ccr_zero
    153  1.1  christos 	ldm	@sp+, er4-er6
    154  1.1  christos 	test_cc_clear
    155  1.1  christos 
    156  1.1  christos 	test_gr_a5a5 0		; Make sure other general regs not disturbed
    157  1.1  christos 	test_gr_a5a5 1
    158  1.1  christos 	test_gr_a5a5 2
    159  1.1  christos 	test_gr_a5a5 3
    160  1.1  christos 	test_h_gr32  3	er4
    161  1.1  christos 	test_h_gr32  2	er5
    162  1.1  christos 	test_h_gr32  1	er6
    163  1.1  christos 	test_h_gr32  _stack+16, er7
    164  1.1  christos 
    165  1.1  christos ldm_4reg:
    166  1.1  christos 	set_grs_a5a5
    167  1.1  christos 	mov	#_stack+4, er7
    168  1.1  christos 
    169  1.1  christos 	set_ccr_zero
    170  1.1  christos 	ldm	@sp+, er0-er3
    171  1.1  christos 	test_cc_clear
    172  1.1  christos 
    173  1.1  christos 	test_h_gr32  4	er0
    174  1.1  christos 	test_h_gr32  3	er1
    175  1.1  christos 	test_h_gr32  2	er2
    176  1.1  christos 	test_h_gr32  1	er3
    177  1.1  christos 	test_gr_a5a5 4		; Make sure other general regs not disturbed
    178  1.1  christos 	test_gr_a5a5 5
    179  1.1  christos 	test_gr_a5a5 6
    180  1.1  christos 	test_h_gr32  _stack+20, er7
    181  1.1  christos .endif
    182  1.1  christos 
    183  1.1  christos pushpop:
    184  1.1  christos 	set_grs_a5a5
    185  1.1  christos .if (sim_cpu == h8300)
    186  1.1  christos 	mov	#_stack_top, r7
    187  1.1  christos 	mov	#12, r1
    188  1.1  christos 	mov	#34, r2
    189  1.1  christos 	mov	#56, r3
    190  1.1  christos 	push	r1
    191  1.1  christos 	push	r2
    192  1.1  christos 	push	r3
    193  1.1  christos 	pop	r4
    194  1.1  christos 	pop	r5
    195  1.1  christos 	pop	r6
    196  1.1  christos 
    197  1.1  christos 	test_gr_a5a5 0		; Make sure other general _reg_ not disturbed
    198  1.1  christos 	test_h_gr16  12	r1
    199  1.1  christos 	test_h_gr16  34	r2
    200  1.1  christos 	test_h_gr16  56	r3
    201  1.1  christos 	test_h_gr16  56	r4
    202  1.1  christos 	test_h_gr16  34	r5
    203  1.1  christos 	test_h_gr16  12	r6
    204  1.1  christos 	mov	#_stack_top, r0
    205  1.1  christos 	cmp.w	r0, r7
    206  1.1  christos 	bne	fail1
    207  1.1  christos .else
    208  1.1  christos 	mov	#_stack_top, er7
    209  1.1  christos 	mov	#12, er1
    210  1.1  christos 	mov	#34, er2
    211  1.1  christos 	mov	#56, er3
    212  1.1  christos 	push	er1
    213  1.1  christos 	push	er2
    214  1.1  christos 	push	er3
    215  1.1  christos 	pop	er4
    216  1.1  christos 	pop	er5
    217  1.1  christos 	pop	er6
    218  1.1  christos 
    219  1.1  christos 	test_gr_a5a5 0		; Make sure other general _reg_ not disturbed
    220  1.1  christos 	test_h_gr32  12	er1
    221  1.1  christos 	test_h_gr32  34	er2
    222  1.1  christos 	test_h_gr32  56	er3
    223  1.1  christos 	test_h_gr32  56	er4
    224  1.1  christos 	test_h_gr32  34	er5
    225  1.1  christos 	test_h_gr32  12	er6
    226  1.1  christos 	test_h_gr32  _stack_top, er7
    227  1.1  christos .endif
    228  1.1  christos 
    229  1.1  christos 	pass
    230  1.1  christos 
    231  1.1  christos 	exit 0
    232  1.1  christos 
    233  1.1  christos fail1:	fail
    234