Home | History | Annotate | Line # | Download | only in h8300
      1      1.1  christos # Hitachi H8 testcase 'ldc'
      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 byte_pre:
     14      1.1  christos 	.byte	0
     15      1.1  christos byte_src:
     16      1.1  christos 	.byte	0xff
     17      1.1  christos byte_post:
     18      1.1  christos 	.byte	0
     19      1.1  christos 
     20      1.1  christos 	start
     21      1.1  christos 
     22      1.1  christos ldc_imm8_ccr:
     23      1.1  christos 	set_grs_a5a5
     24      1.1  christos 	set_ccr_zero
     25      1.1  christos 
     26      1.1  christos 	ldc	#0xff, ccr	; set all ccr flags high, immediate operand
     27      1.1  christos 	bcs	.L1		; carry flag set?
     28      1.1  christos 	fail
     29      1.1  christos .L1:	bvs	.L2		; overflow flag set?
     30      1.1  christos 	fail
     31      1.1  christos .L2:	beq	.L3		; zero flag set?
     32      1.1  christos 	fail
     33      1.1  christos .L3:	bmi	.L4		; neg flag set?
     34      1.1  christos 	fail
     35      1.1  christos .L4:
     36      1.1  christos 	ldc	#0, ccr		; set all ccr flags low, immediate operand
     37      1.1  christos 	bcc	.L5		; carry flag clear?
     38      1.1  christos 	fail
     39      1.1  christos .L5:	bvc	.L6		; overflow flag clear?
     40      1.1  christos 	fail
     41      1.1  christos .L6:	bne	.L7		; zero flag clear?
     42      1.1  christos 	fail
     43      1.1  christos .L7:	bpl	.L8		; neg flag clear?
     44      1.1  christos 	fail
     45      1.1  christos .L8:
     46      1.1  christos 	test_cc_clear
     47      1.1  christos 	test_grs_a5a5
     48      1.1  christos 
     49      1.1  christos ldc_reg8_ccr:
     50      1.1  christos 	set_grs_a5a5
     51      1.1  christos 	set_ccr_zero
     52      1.1  christos 
     53      1.1  christos 	mov	#0xff, r0h
     54      1.1  christos 	ldc	r0h, ccr	; set all ccr flags high, reg operand
     55      1.1  christos 	bcs	.L11		; carry flag set?
     56      1.1  christos 	fail
     57      1.1  christos .L11:	bvs	.L12		; overflow flag set?
     58      1.1  christos 	fail
     59      1.1  christos .L12:	beq	.L13		; zero flag set?
     60      1.1  christos 	fail
     61      1.1  christos .L13:	bmi	.L14		; neg flag set?
     62      1.1  christos 	fail
     63      1.1  christos .L14:
     64      1.1  christos 	mov	#0, r0h
     65      1.1  christos 	ldc	r0h, ccr	; set all ccr flags low, reg operand
     66      1.1  christos 	bcc	.L15		; carry flag clear?
     67      1.1  christos 	fail
     68      1.1  christos .L15:	bvc	.L16		; overflow flag clear?
     69      1.1  christos 	fail
     70      1.1  christos .L16:	bne	.L17		; zero flag clear?
     71      1.1  christos 	fail
     72      1.1  christos .L17:	bpl	.L18		; neg flag clear?
     73      1.1  christos 	fail
     74      1.1  christos .L18:
     75      1.1  christos 	test_cc_clear
     76      1.1  christos 	test_h_gr16  0x00a5 r0	; Register 0 modified by test procedure.
     77      1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
     78      1.1  christos 	test_gr_a5a5 2
     79      1.1  christos 	test_gr_a5a5 3
     80      1.1  christos 	test_gr_a5a5 4
     81      1.1  christos 	test_gr_a5a5 5
     82      1.1  christos 	test_gr_a5a5 6
     83      1.1  christos 	test_gr_a5a5 7
     84      1.1  christos 
     85      1.1  christos .if (sim_cpu == h8300s || sim_cpu == h8sx)	; Earlier versions, no exr
     86      1.1  christos ldc_imm8_exr:
     87      1.1  christos 	set_grs_a5a5
     88      1.1  christos 	set_ccr_zero
     89      1.1  christos 
     90      1.1  christos 	ldc	#0, exr
     91      1.1  christos 	ldc	#0x87, exr	; set exr to 0x87
     92      1.1  christos 
     93      1.1  christos 	stc	exr, r0l	; retrieve and check exr value
     94      1.1  christos 	cmp.b	#0x87, r0l
     95      1.1  christos 	beq	.L19
     96      1.1  christos 	fail
     97      1.1  christos .L19:
     98      1.1  christos 	test_h_gr16  0xa587 r0	; Register 0 modified by test procedure.
     99      1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    100      1.1  christos 	test_gr_a5a5 2
    101      1.1  christos 	test_gr_a5a5 3
    102      1.1  christos 	test_gr_a5a5 4
    103      1.1  christos 	test_gr_a5a5 5
    104      1.1  christos 	test_gr_a5a5 6
    105      1.1  christos 	test_gr_a5a5 7
    106      1.1  christos 
    107      1.1  christos ldc_reg8_exr:
    108      1.1  christos 	set_grs_a5a5
    109      1.1  christos 	set_ccr_zero
    110      1.1  christos 
    111      1.1  christos 	ldc	#0, exr
    112      1.1  christos 	mov	#0x87, r0h
    113      1.1  christos 	ldc	r0h, exr	; set exr to 0x87
    114      1.1  christos 
    115      1.1  christos 	stc	exr, r0l	; retrieve and check exr value
    116      1.1  christos 	cmp.b	#0x87, r0l
    117      1.1  christos 	beq	.L21
    118      1.1  christos 	fail
    119      1.1  christos .L21:
    120      1.1  christos 	test_h_gr16  0x8787 r0	; Register 0 modified by test procedure.
    121      1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    122      1.1  christos 	test_gr_a5a5 2
    123      1.1  christos 	test_gr_a5a5 3
    124      1.1  christos 	test_gr_a5a5 4
    125      1.1  christos 	test_gr_a5a5 5
    126      1.1  christos 	test_gr_a5a5 6
    127      1.1  christos 	test_gr_a5a5 7
    128      1.1  christos 
    129      1.1  christos ldc_abs16_ccr:
    130      1.1  christos 	set_grs_a5a5
    131      1.1  christos 	set_ccr_zero
    132      1.1  christos 
    133      1.1  christos 	ldc	@byte_src:16, ccr	; abs16 src
    134      1.1  christos 	stc	ccr, r0l	; copy into general reg
    135      1.1  christos 
    136      1.1  christos 	test_h_gr32 0xa5a5a5ff er0	; ff in r0l, a5 elsewhere.
    137      1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    138      1.1  christos 	test_gr_a5a5 2
    139      1.1  christos 	test_gr_a5a5 3
    140      1.1  christos 	test_gr_a5a5 4
    141      1.1  christos 	test_gr_a5a5 5
    142      1.1  christos 	test_gr_a5a5 6
    143      1.1  christos 	test_gr_a5a5 7
    144      1.1  christos 
    145      1.1  christos ldc_abs16_exr:
    146      1.1  christos 	set_grs_a5a5
    147      1.1  christos 	set_ccr_zero
    148      1.1  christos 
    149      1.1  christos 	ldc	#0, exr
    150      1.1  christos 	ldc	@byte_src:16, exr	; abs16 src
    151      1.1  christos 	stc	exr, r0l	; copy into general reg
    152      1.1  christos 
    153      1.1  christos 	test_h_gr32 0xa5a5a587 er0	; 87 in r0l, a5 elsewhere.
    154      1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    155      1.1  christos 	test_gr_a5a5 2
    156      1.1  christos 	test_gr_a5a5 3
    157      1.1  christos 	test_gr_a5a5 4
    158      1.1  christos 	test_gr_a5a5 5
    159      1.1  christos 	test_gr_a5a5 6
    160      1.1  christos 	test_gr_a5a5 7
    161      1.1  christos 
    162      1.1  christos ldc_abs32_ccr:
    163      1.1  christos 	set_grs_a5a5
    164      1.1  christos 	set_ccr_zero
    165      1.1  christos 
    166      1.1  christos 	ldc	@byte_src:32, ccr	; abs32 src
    167      1.1  christos 	stc	ccr, r0l	; copy into general reg
    168      1.1  christos 
    169      1.1  christos 	test_h_gr32 0xa5a5a5ff er0	; ff in r0l, a5 elsewhere.
    170      1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    171      1.1  christos 	test_gr_a5a5 2
    172      1.1  christos 	test_gr_a5a5 3
    173      1.1  christos 	test_gr_a5a5 4
    174      1.1  christos 	test_gr_a5a5 5
    175      1.1  christos 	test_gr_a5a5 6
    176      1.1  christos 	test_gr_a5a5 7
    177      1.1  christos 
    178      1.1  christos ldc_abs32_exr:
    179      1.1  christos 	set_grs_a5a5
    180      1.1  christos 	set_ccr_zero
    181      1.1  christos 
    182      1.1  christos 	ldc	#0, exr
    183      1.1  christos 	ldc	@byte_src:32, exr	; abs32 src
    184      1.1  christos 	stc	exr, r0l	; copy into general reg
    185      1.1  christos 
    186      1.1  christos 	test_h_gr32 0xa5a5a587 er0	; 87 in r0l, a5 elsewhere.
    187      1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    188      1.1  christos 	test_gr_a5a5 2
    189      1.1  christos 	test_gr_a5a5 3
    190      1.1  christos 	test_gr_a5a5 4
    191      1.1  christos 	test_gr_a5a5 5
    192      1.1  christos 	test_gr_a5a5 6
    193      1.1  christos 	test_gr_a5a5 7
    194      1.1  christos 
    195      1.1  christos ldc_disp16_ccr:
    196      1.1  christos 	set_grs_a5a5
    197      1.1  christos 	set_ccr_zero
    198      1.1  christos 
    199      1.1  christos 	mov	#byte_pre, er1
    200      1.1  christos 	ldc	@(1:16, er1), ccr	; disp16 src
    201      1.1  christos 	stc	ccr, r0l	; copy into general reg
    202      1.1  christos 
    203      1.1  christos 	test_h_gr32 0xa5a5a5ff er0	; ff in r0l, a5 elsewhere.
    204      1.1  christos 	test_h_gr32 byte_pre, er1	; er1 still contains address
    205      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    206      1.1  christos 	test_gr_a5a5 3
    207      1.1  christos 	test_gr_a5a5 4
    208      1.1  christos 	test_gr_a5a5 5
    209      1.1  christos 	test_gr_a5a5 6
    210      1.1  christos 	test_gr_a5a5 7
    211      1.1  christos 
    212      1.1  christos ldc_disp16_exr:
    213      1.1  christos 	set_grs_a5a5
    214      1.1  christos 	set_ccr_zero
    215      1.1  christos 
    216      1.1  christos 	ldc	#0, exr
    217      1.1  christos 	mov	#byte_post, er1
    218      1.1  christos 	ldc	@(-1:16, er1), exr	; disp16 src
    219      1.1  christos 	stc	exr, r0l	; copy into general reg
    220      1.1  christos 
    221      1.1  christos 	test_h_gr32 0xa5a5a587 er0	; 87 in r0l, a5 elsewhere.
    222      1.1  christos 	test_h_gr32 byte_post, er1	; er1 still contains address
    223      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    224      1.1  christos 	test_gr_a5a5 3
    225      1.1  christos 	test_gr_a5a5 4
    226      1.1  christos 	test_gr_a5a5 5
    227      1.1  christos 	test_gr_a5a5 6
    228      1.1  christos 	test_gr_a5a5 7
    229      1.1  christos 
    230      1.1  christos ldc_disp32_ccr:
    231      1.1  christos 	set_grs_a5a5
    232      1.1  christos 	set_ccr_zero
    233      1.1  christos 
    234      1.1  christos 	mov	#byte_pre, er1
    235      1.1  christos 	ldc	@(1:32, er1), ccr	; disp32 src
    236      1.1  christos 	stc	ccr, r0l	; copy into general reg
    237      1.1  christos 
    238      1.1  christos 	test_h_gr32 0xa5a5a5ff er0	; ff in r0l, a5 elsewhere.
    239      1.1  christos 	test_h_gr32 byte_pre, er1	; er1 still contains address
    240      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    241      1.1  christos 	test_gr_a5a5 3
    242      1.1  christos 	test_gr_a5a5 4
    243      1.1  christos 	test_gr_a5a5 5
    244      1.1  christos 	test_gr_a5a5 6
    245      1.1  christos 	test_gr_a5a5 7
    246      1.1  christos 
    247      1.1  christos ldc_disp32_exr:
    248      1.1  christos 	set_grs_a5a5
    249      1.1  christos 	set_ccr_zero
    250      1.1  christos 
    251      1.1  christos 	ldc	#0, exr
    252      1.1  christos 	mov	#byte_post, er1
    253      1.1  christos 	ldc	@(-1:32, er1), exr	; disp16 src
    254      1.1  christos 	stc	exr, r0l	; copy into general reg
    255      1.1  christos 
    256      1.1  christos 	test_h_gr32 0xa5a5a587 er0	; 87 in r0l, a5 elsewhere.
    257      1.1  christos 	test_h_gr32 byte_post, er1	; er1 still contains address
    258      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    259      1.1  christos 	test_gr_a5a5 3
    260      1.1  christos 	test_gr_a5a5 4
    261      1.1  christos 	test_gr_a5a5 5
    262      1.1  christos 	test_gr_a5a5 6
    263      1.1  christos 	test_gr_a5a5 7
    264      1.1  christos 
    265      1.1  christos ldc_postinc_ccr:
    266      1.1  christos 	set_grs_a5a5
    267      1.1  christos 	set_ccr_zero
    268      1.1  christos 
    269      1.1  christos 	mov	#byte_src, er1
    270      1.1  christos 	ldc	@er1+, ccr	; postinc src
    271      1.1  christos 	stc	ccr, r0l	; copy into general reg
    272      1.1  christos 
    273      1.1  christos 	test_h_gr32  0xa5a5a5ff er0	; ff in r0l, a5 elsewhere.
    274      1.1  christos 	test_h_gr32  byte_src+2, er1	; er1 still contains address
    275      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    276      1.1  christos 	test_gr_a5a5 3
    277      1.1  christos 	test_gr_a5a5 4
    278      1.1  christos 	test_gr_a5a5 5
    279      1.1  christos 	test_gr_a5a5 6
    280      1.1  christos 	test_gr_a5a5 7
    281      1.1  christos 
    282      1.1  christos ldc_postinc_exr:
    283      1.1  christos 	set_grs_a5a5
    284      1.1  christos 	set_ccr_zero
    285      1.1  christos 
    286      1.1  christos 	ldc	#0, exr
    287      1.1  christos 	mov	#byte_src, er1
    288      1.1  christos 	ldc	@er1+, exr	; postinc src
    289      1.1  christos 	stc	exr, r0l	; copy into general reg
    290      1.1  christos 
    291      1.1  christos 	test_h_gr32  0xa5a5a587 er0	; 87 in r0l, a5 elsewhere.
    292      1.1  christos 	test_h_gr32  byte_src+2, er1	; er1 still contains address
    293      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    294      1.1  christos 	test_gr_a5a5 3
    295      1.1  christos 	test_gr_a5a5 4
    296      1.1  christos 	test_gr_a5a5 5
    297      1.1  christos 	test_gr_a5a5 6
    298      1.1  christos 	test_gr_a5a5 7
    299      1.1  christos 
    300      1.1  christos ldc_ind_ccr:
    301      1.1  christos 	set_grs_a5a5
    302      1.1  christos 	set_ccr_zero
    303      1.1  christos 
    304      1.1  christos 	mov	#byte_src, er1
    305      1.1  christos 	ldc	@er1, ccr	; postinc src
    306      1.1  christos 	stc	ccr, r0l	; copy into general reg
    307      1.1  christos 
    308      1.1  christos 	test_h_gr32 0xa5a5a5ff er0	; ff in r0l, a5 elsewhere.
    309      1.1  christos 	test_h_gr32 byte_src, er1	; er1 still contains address
    310      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    311      1.1  christos 	test_gr_a5a5 3
    312      1.1  christos 	test_gr_a5a5 4
    313      1.1  christos 	test_gr_a5a5 5
    314      1.1  christos 	test_gr_a5a5 6
    315      1.1  christos 	test_gr_a5a5 7
    316      1.1  christos 
    317      1.1  christos ldc_ind_exr:
    318      1.1  christos 	set_grs_a5a5
    319      1.1  christos 	set_ccr_zero
    320      1.1  christos 
    321      1.1  christos 	ldc	#0, exr
    322      1.1  christos 	mov	#byte_src, er1
    323      1.1  christos 	ldc	@er1, exr	; postinc src
    324      1.1  christos 	stc	exr, r0l	; copy into general reg
    325      1.1  christos 
    326      1.1  christos 	test_h_gr32 0xa5a5a587 er0	; 87 in r0l, a5 elsewhere.
    327      1.1  christos 	test_h_gr32 byte_src, er1	; er1 still contains address
    328      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    329      1.1  christos 	test_gr_a5a5 3
    330      1.1  christos 	test_gr_a5a5 4
    331      1.1  christos 	test_gr_a5a5 5
    332      1.1  christos 	test_gr_a5a5 6
    333      1.1  christos 	test_gr_a5a5 7
    334      1.1  christos 
    335      1.1  christos .endif
    336      1.1  christos 
    337      1.1  christos .if (sim_cpu == h8sx)		; New vbr and sbr registers for h8sx
    338      1.1  christos ldc_reg_sbr:
    339      1.1  christos 	set_grs_a5a5
    340      1.1  christos 	set_ccr_zero
    341      1.1  christos 
    342      1.1  christos 	mov	#0xaaaaaaaa, er0
    343      1.1  christos 	ldc	er0, sbr	; set sbr to 0xaaaaaaaa
    344  1.1.1.2  christos  	stc	sbr, er1	; retrieve and check sbr value
    345      1.1  christos 
    346      1.1  christos 	test_h_gr32 0xaaaaaaaa er1
    347      1.1  christos 	test_h_gr32 0xaaaaaaaa er0 ; Register 0 modified by test procedure.
    348      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    349      1.1  christos 	test_gr_a5a5 3
    350      1.1  christos 	test_gr_a5a5 4
    351      1.1  christos 	test_gr_a5a5 5
    352      1.1  christos 	test_gr_a5a5 6
    353      1.1  christos 	test_gr_a5a5 7
    354      1.1  christos 
    355      1.1  christos ldc_reg_vbr:
    356      1.1  christos 	set_grs_a5a5
    357      1.1  christos 	set_ccr_zero
    358      1.1  christos 
    359      1.1  christos 	mov	#0xaaaaaaaa, er0
    360      1.1  christos 	ldc	er0, vbr	; set sbr to 0xaaaaaaaa
    361  1.1.1.2  christos 	stc	vbr, er1	; retrieve and check sbr value
    362      1.1  christos 
    363      1.1  christos 	test_h_gr32 0xaaaaaaaa er1
    364      1.1  christos 	test_h_gr32 0xaaaaaaaa er0 ; Register 0 modified by test procedure.
    365      1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    366      1.1  christos 	test_gr_a5a5 3
    367      1.1  christos 	test_gr_a5a5 4
    368      1.1  christos 	test_gr_a5a5 5
    369      1.1  christos 	test_gr_a5a5 6
    370      1.1  christos 	test_gr_a5a5 7
    371      1.1  christos 
    372      1.1  christos .endif
    373      1.1  christos 	pass
    374      1.1  christos 
    375      1.1  christos 	exit 0
    376