Home | History | Annotate | Line # | Download | only in h8300
      1  1.1  christos # Hitachi H8 testcase 'addx'
      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 
     13  1.1  christos 	# Instructions tested:
     14  1.1  christos 	# addx.b #xx:8, rd8	; 9 rd8 xxxxxxxx
     15  1.1  christos 	# addx.b #xx:8, @erd	; 7 d erd ???? 9 ???? xxxxxxxx
     16  1.1  christos 	# addx.b #xx:8, @erd-	; 0 1 7 6 6 c erd 1??? 9 ???? xxxxxxxx
     17  1.1  christos 	# addx.b rs8, rd8	; 0 e rs8 rd8
     18  1.1  christos 	# addx.b rs8, @erd	; 7 d erd ???? 0 e rs8 ????
     19  1.1  christos 	# addx.b rs8, @erd-	; 0 1 7 6 6 c erd 1??? 0 e rs8 ????
     20  1.1  christos 	# addx.b @ers, rd8	; 7 c ers ???? 0 e ???? rd8
     21  1.1  christos 	# addx.b @ers-, rd8	; 0 1 7 6 6 c ers 00?? 0 e ???? rd8
     22  1.1  christos 	# addx.b @ers, @erd	; 0 1 7 4 6 8 ers d 0 erd 1 ????
     23  1.1  christos 	# addx.b @ers-, @erd-	; 0 1 7 6 6 c ers d a erd 1 ????
     24  1.1  christos 	#
     25  1.1  christos 	# word ops
     26  1.1  christos 	# long ops
     27  1.1  christos 
     28  1.1  christos .data
     29  1.1  christos byte_src:	.byte 0x5
     30  1.1  christos byte_dest:	.byte 0
     31  1.1  christos 
     32  1.1  christos 	.align 2
     33  1.1  christos word_src:	.word 0x505
     34  1.1  christos word_dest:	.word 0
     35  1.1  christos 
     36  1.1  christos 	.align 4
     37  1.1  christos long_src:	.long 0x50505
     38  1.1  christos long_dest:	.long 0
     39  1.1  christos 
     40  1.1  christos 
     41  1.1  christos 	start
     42  1.1  christos 
     43  1.1  christos addx_b_imm8_0:
     44  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
     45  1.1  christos 	set_ccr_zero
     46  1.1  christos 
     47  1.1  christos 	;;  addx.b #xx:8,Rd	; Addx with carry initially zero.
     48  1.1  christos 	addx.b	#5, r0l		; Immediate 8-bit operand
     49  1.1  christos 
     50  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
     51  1.1  christos 	test_ovf_clear
     52  1.1  christos 	test_zero_clear
     53  1.1  christos 	test_neg_set
     54  1.1  christos 
     55  1.1  christos 	test_h_gr16 0xa5aa r0	; add result:	a5 + 5
     56  1.1  christos .if (sim_cpu)			; non-zero means h8300h, s, or sx
     57  1.1  christos 	test_h_gr32 0xa5a5a5aa er0	; add result:	 a5 + 5
     58  1.1  christos .endif
     59  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
     60  1.1  christos 	test_gr_a5a5 2
     61  1.1  christos 	test_gr_a5a5 3
     62  1.1  christos 	test_gr_a5a5 4
     63  1.1  christos 	test_gr_a5a5 5
     64  1.1  christos 	test_gr_a5a5 6
     65  1.1  christos 	test_gr_a5a5 7
     66  1.1  christos 
     67  1.1  christos addx_b_imm8_1:
     68  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
     69  1.1  christos 	set_ccr_zero
     70  1.1  christos 
     71  1.1  christos 	;;  addx.b #xx:8,Rd	; Addx with carry initially one.
     72  1.1  christos 	set_carry_flag
     73  1.1  christos 	addx.b	#5, r0l		; Immediate 8-bit operand
     74  1.1  christos 
     75  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
     76  1.1  christos 	test_ovf_clear
     77  1.1  christos 	test_zero_clear
     78  1.1  christos 	test_neg_set
     79  1.1  christos 
     80  1.1  christos 	test_h_gr16 0xa5ab r0	; add result:	a5 + 5 + 1
     81  1.1  christos .if (sim_cpu)			; non-zero means h8300h, s, or sx
     82  1.1  christos 	test_h_gr32 0xa5a5a5ab er0	; add result:	 a5 + 5 + 1
     83  1.1  christos .endif
     84  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
     85  1.1  christos 	test_gr_a5a5 2
     86  1.1  christos 	test_gr_a5a5 3
     87  1.1  christos 	test_gr_a5a5 4
     88  1.1  christos 	test_gr_a5a5 5
     89  1.1  christos 	test_gr_a5a5 6
     90  1.1  christos 	test_gr_a5a5 7
     91  1.1  christos 
     92  1.1  christos .if (sim_cpu == h8sx)
     93  1.1  christos addx_b_imm8_rdind:
     94  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
     95  1.1  christos 	set_ccr_zero
     96  1.1  christos 
     97  1.1  christos 	;;  addx.b #xx:8,@eRd	; Addx to register indirect
     98  1.1  christos 	mov	#byte_dest, er0
     99  1.1  christos 	addx.b	#5, @er0
    100  1.1  christos 
    101  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    102  1.1  christos 	test_ovf_clear
    103  1.1  christos 	test_zero_clear
    104  1.1  christos 	test_neg_clear
    105  1.1  christos 
    106  1.1  christos 	test_h_gr32 byte_dest er0	; er0 still contains address
    107  1.1  christos 
    108  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    109  1.1  christos 	test_gr_a5a5 2
    110  1.1  christos 	test_gr_a5a5 3
    111  1.1  christos 	test_gr_a5a5 4
    112  1.1  christos 	test_gr_a5a5 5
    113  1.1  christos 	test_gr_a5a5 6
    114  1.1  christos 	test_gr_a5a5 7
    115  1.1  christos 
    116  1.1  christos 	;; Now check the result of the add to memory.
    117  1.1  christos 	cmp.b	#5, @byte_dest
    118  1.1  christos 	beq	.Lb1
    119  1.1  christos 	fail
    120  1.1  christos .Lb1:
    121  1.1  christos 
    122  1.1  christos addx_b_imm8_rdpostdec:
    123  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    124  1.1  christos 	set_ccr_zero
    125  1.1  christos 
    126  1.1  christos 	;;  addx.b #xx:8,@eRd-	; Addx to register post-decrement
    127  1.1  christos 	mov	#byte_dest, er0
    128  1.1  christos 	addx.b	#5, @er0-
    129  1.1  christos 
    130  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    131  1.1  christos 	test_ovf_clear
    132  1.1  christos 	test_zero_clear
    133  1.1  christos 	test_neg_clear
    134  1.1  christos 
    135  1.1  christos 	test_h_gr32 byte_dest-1 er0	; er0 contains address minus one
    136  1.1  christos 
    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 	;; Now check the result of the add to memory.
    146  1.1  christos 	cmp.b	#10, @byte_dest
    147  1.1  christos 	beq	.Lb2
    148  1.1  christos 	fail
    149  1.1  christos .Lb2:
    150  1.1  christos .endif
    151  1.1  christos 
    152  1.1  christos addx_b_reg8_0:
    153  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    154  1.1  christos 	set_ccr_zero
    155  1.1  christos 
    156  1.1  christos 	;;  addx.b Rs,Rd	; addx with carry initially zero
    157  1.1  christos 	mov.b	#5, r0h
    158  1.1  christos 	addx.b	r0h, r0l	; Register operand
    159  1.1  christos 
    160  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    161  1.1  christos 	test_ovf_clear
    162  1.1  christos 	test_zero_clear
    163  1.1  christos 	test_neg_set
    164  1.1  christos 
    165  1.1  christos 	test_h_gr16 0x05aa r0	; add result:	a5 + 5
    166  1.1  christos .if (sim_cpu)			; non-zero means h8300h, s, or sx
    167  1.1  christos 	test_h_gr32 0xa5a505aa er0	; add result:	a5 + 5
    168  1.1  christos .endif
    169  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    170  1.1  christos 	test_gr_a5a5 2
    171  1.1  christos 	test_gr_a5a5 3
    172  1.1  christos 	test_gr_a5a5 4
    173  1.1  christos 	test_gr_a5a5 5
    174  1.1  christos 	test_gr_a5a5 6
    175  1.1  christos 	test_gr_a5a5 7
    176  1.1  christos 
    177  1.1  christos addx_b_reg8_1:
    178  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    179  1.1  christos 	set_ccr_zero
    180  1.1  christos 
    181  1.1  christos 	;;  addx.b Rs,Rd	; addx with carry initially one
    182  1.1  christos 	mov.b	#5, r0h
    183  1.1  christos 	set_carry_flag
    184  1.1  christos 	addx.b	r0h, r0l	; Register operand
    185  1.1  christos 
    186  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    187  1.1  christos 	test_ovf_clear
    188  1.1  christos 	test_zero_clear
    189  1.1  christos 	test_neg_set
    190  1.1  christos 
    191  1.1  christos 	test_h_gr16 0x05ab r0	; add result:	a5 + 5 + 1
    192  1.1  christos .if (sim_cpu)			; non-zero means h8300h, s, or sx
    193  1.1  christos 	test_h_gr32 0xa5a505ab er0	; add result:	a5 + 5 + 1
    194  1.1  christos .endif
    195  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    196  1.1  christos 	test_gr_a5a5 2
    197  1.1  christos 	test_gr_a5a5 3
    198  1.1  christos 	test_gr_a5a5 4
    199  1.1  christos 	test_gr_a5a5 5
    200  1.1  christos 	test_gr_a5a5 6
    201  1.1  christos 	test_gr_a5a5 7
    202  1.1  christos 
    203  1.1  christos .if (sim_cpu == h8sx)
    204  1.1  christos addx_b_reg8_rdind:
    205  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    206  1.1  christos 	set_ccr_zero
    207  1.1  christos 
    208  1.1  christos 	;;  addx.b rs8,@eRd	; Addx to register indirect
    209  1.1  christos 	mov	#byte_dest, er0
    210  1.1  christos 	mov.b	#5, r1l
    211  1.1  christos 	addx.b	r1l, @er0
    212  1.1  christos 
    213  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    214  1.1  christos 	test_ovf_clear
    215  1.1  christos 	test_zero_clear
    216  1.1  christos 	test_neg_clear
    217  1.1  christos 
    218  1.1  christos 	test_h_gr32 byte_dest er0	; er0 still contains address
    219  1.1  christos 	test_h_gr32 0xa5a5a505 er1	; er1 has the test load
    220  1.1  christos 
    221  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    222  1.1  christos 	test_gr_a5a5 3
    223  1.1  christos 	test_gr_a5a5 4
    224  1.1  christos 	test_gr_a5a5 5
    225  1.1  christos 	test_gr_a5a5 6
    226  1.1  christos 	test_gr_a5a5 7
    227  1.1  christos 
    228  1.1  christos 	;; Now check the result of the add to memory.
    229  1.1  christos 	cmp.b	#15, @byte_dest
    230  1.1  christos 	beq	.Lb3
    231  1.1  christos 	fail
    232  1.1  christos .Lb3:
    233  1.1  christos 
    234  1.1  christos addx_b_reg8_rdpostdec:
    235  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    236  1.1  christos 	set_ccr_zero
    237  1.1  christos 
    238  1.1  christos 	;;  addx.b rs8,@eRd-	; Addx to register post-decrement
    239  1.1  christos 	mov	#byte_dest, er0
    240  1.1  christos 	mov.b	#5, r1l
    241  1.1  christos 	addx.b	r1l, @er0-
    242  1.1  christos 
    243  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    244  1.1  christos 	test_ovf_clear
    245  1.1  christos 	test_zero_clear
    246  1.1  christos 	test_neg_clear
    247  1.1  christos 
    248  1.1  christos 	test_h_gr32 byte_dest-1 er0	; er0 contains address minus one
    249  1.1  christos 	test_h_gr32 0xa5a5a505 er1	; er1 contains the test load
    250  1.1  christos 
    251  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    252  1.1  christos 	test_gr_a5a5 3
    253  1.1  christos 	test_gr_a5a5 4
    254  1.1  christos 	test_gr_a5a5 5
    255  1.1  christos 	test_gr_a5a5 6
    256  1.1  christos 	test_gr_a5a5 7
    257  1.1  christos 
    258  1.1  christos 	;; Now check the result of the add to memory.
    259  1.1  christos 	cmp.b	#20, @byte_dest
    260  1.1  christos 	beq	.Lb4
    261  1.1  christos 	fail
    262  1.1  christos .Lb4:
    263  1.1  christos 
    264  1.1  christos addx_b_rsind_reg8:
    265  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    266  1.1  christos 	set_ccr_zero
    267  1.1  christos 
    268  1.1  christos 	;;  addx.b @eRs,rd8	; Addx from reg indirect to reg
    269  1.1  christos 	mov	#byte_src, er0
    270  1.1  christos 	addx.b	@er0, r1l
    271  1.1  christos 
    272  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    273  1.1  christos 	test_ovf_clear
    274  1.1  christos 	test_zero_clear
    275  1.1  christos 	test_neg_set
    276  1.1  christos 
    277  1.1  christos 	test_h_gr32 byte_src er0	; er0 still contains address
    278  1.1  christos 	test_h_gr32 0xa5a5a5aa er1	; er1 contains the sum
    279  1.1  christos 
    280  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    281  1.1  christos 	test_gr_a5a5 3
    282  1.1  christos 	test_gr_a5a5 4
    283  1.1  christos 	test_gr_a5a5 5
    284  1.1  christos 	test_gr_a5a5 6
    285  1.1  christos 	test_gr_a5a5 7
    286  1.1  christos 
    287  1.1  christos addx_b_rspostdec_reg8:
    288  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    289  1.1  christos 	set_ccr_zero
    290  1.1  christos 
    291  1.1  christos 	;;  addx.b @eRs-,rd8	; Addx to register post-decrement
    292  1.1  christos 	mov	#byte_src, er0
    293  1.1  christos 	addx.b	@er0-, r1l
    294  1.1  christos 
    295  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    296  1.1  christos 	test_ovf_clear
    297  1.1  christos 	test_zero_clear
    298  1.1  christos 	test_neg_set
    299  1.1  christos 
    300  1.1  christos 	test_h_gr32 byte_src-1 er0	; er0 contains address minus one
    301  1.1  christos 	test_h_gr32 0xa5a5a5aa er1	; er1 contains the sum
    302  1.1  christos 
    303  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    304  1.1  christos 	test_gr_a5a5 3
    305  1.1  christos 	test_gr_a5a5 4
    306  1.1  christos 	test_gr_a5a5 5
    307  1.1  christos 	test_gr_a5a5 6
    308  1.1  christos 	test_gr_a5a5 7
    309  1.1  christos 
    310  1.1  christos addx_b_rsind_rsind:
    311  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    312  1.1  christos 	set_ccr_zero
    313  1.1  christos 
    314  1.1  christos 	;;  addx.b @eRs,rd8	; Addx from reg indirect to reg
    315  1.1  christos 	mov	#byte_src, er0
    316  1.1  christos 	mov	#byte_dest, er1
    317  1.1  christos 	addx.b	@er0, @er1
    318  1.1  christos 
    319  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    320  1.1  christos 	test_ovf_clear
    321  1.1  christos 	test_zero_clear
    322  1.1  christos 	test_neg_clear
    323  1.1  christos 
    324  1.1  christos 	test_h_gr32 byte_src er0	; er0 still contains src address
    325  1.1  christos 	test_h_gr32 byte_dest er1	; er1 still contains dst address
    326  1.1  christos 
    327  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    328  1.1  christos 	test_gr_a5a5 3
    329  1.1  christos 	test_gr_a5a5 4
    330  1.1  christos 	test_gr_a5a5 5
    331  1.1  christos 	test_gr_a5a5 6
    332  1.1  christos 	test_gr_a5a5 7
    333  1.1  christos 	;; Now check the result of the add to memory.
    334  1.1  christos 	cmp.b	#25, @byte_dest
    335  1.1  christos 	beq	.Lb5
    336  1.1  christos 	fail
    337  1.1  christos .Lb5:
    338  1.1  christos 
    339  1.1  christos addx_b_rspostdec_rspostdec:
    340  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    341  1.1  christos 	set_ccr_zero
    342  1.1  christos 
    343  1.1  christos 	;;  addx.b @eRs-,rd8	; Addx to register post-decrement
    344  1.1  christos 	mov	#byte_src, er0
    345  1.1  christos 	mov	#byte_dest, er1
    346  1.1  christos 	addx.b	@er0-, @er1-
    347  1.1  christos 
    348  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    349  1.1  christos 	test_ovf_clear
    350  1.1  christos 	test_zero_clear
    351  1.1  christos 	test_neg_clear
    352  1.1  christos 
    353  1.1  christos 	test_h_gr32 byte_src-1 er0	; er0 contains src address minus one
    354  1.1  christos 	test_h_gr32 byte_dest-1 er1	; er1 contains dst address minus one
    355  1.1  christos 
    356  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    357  1.1  christos 	test_gr_a5a5 3
    358  1.1  christos 	test_gr_a5a5 4
    359  1.1  christos 	test_gr_a5a5 5
    360  1.1  christos 	test_gr_a5a5 6
    361  1.1  christos 	test_gr_a5a5 7
    362  1.1  christos 	;; Now check the result of the add to memory.
    363  1.1  christos 	cmp.b	#30, @byte_dest
    364  1.1  christos 	beq	.Lb6
    365  1.1  christos 	fail
    366  1.1  christos .Lb6:
    367  1.1  christos 
    368  1.1  christos addx_w_imm16_0:
    369  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    370  1.1  christos 	set_ccr_zero
    371  1.1  christos 
    372  1.1  christos 	;;  addx.w #xx:16,Rd	; Addx with carry initially zero.
    373  1.1  christos 	addx.w	#0x505, r0	; Immediate 16-bit operand
    374  1.1  christos 
    375  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    376  1.1  christos 	test_ovf_clear
    377  1.1  christos 	test_zero_clear
    378  1.1  christos 	test_neg_set
    379  1.1  christos 
    380  1.1  christos 	test_h_gr16 0xaaaa r0	; add result:	0xa5a5 + 0x505
    381  1.1  christos 	test_h_gr32 0xa5a5aaaa er0	; add result:	 0xa5a5 + 0x505
    382  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    383  1.1  christos 	test_gr_a5a5 2
    384  1.1  christos 	test_gr_a5a5 3
    385  1.1  christos 	test_gr_a5a5 4
    386  1.1  christos 	test_gr_a5a5 5
    387  1.1  christos 	test_gr_a5a5 6
    388  1.1  christos 	test_gr_a5a5 7
    389  1.1  christos 
    390  1.1  christos addx_w_imm16_1:
    391  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    392  1.1  christos 	set_ccr_zero
    393  1.1  christos 
    394  1.1  christos 	;;  addx.w #xx:16,Rd	; Addx with carry initially one.
    395  1.1  christos 	set_carry_flag
    396  1.1  christos 	addx.w	#0x505, r0	; Immediate 16-bit operand
    397  1.1  christos 
    398  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    399  1.1  christos 	test_ovf_clear
    400  1.1  christos 	test_zero_clear
    401  1.1  christos 	test_neg_set
    402  1.1  christos 
    403  1.1  christos 	test_h_gr16 0xaaab r0	; add result:	0xa5a5 + 0x505 + 1
    404  1.1  christos 	test_h_gr32 0xa5a5aaab er0	; add result:	 0xa5a5 + 0x505 + 1
    405  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    406  1.1  christos 	test_gr_a5a5 2
    407  1.1  christos 	test_gr_a5a5 3
    408  1.1  christos 	test_gr_a5a5 4
    409  1.1  christos 	test_gr_a5a5 5
    410  1.1  christos 	test_gr_a5a5 6
    411  1.1  christos 	test_gr_a5a5 7
    412  1.1  christos 
    413  1.1  christos addx_w_imm16_rdind:
    414  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    415  1.1  christos 	set_ccr_zero
    416  1.1  christos 
    417  1.1  christos 	;;  addx.w #xx:16,@eRd	; Addx to register indirect
    418  1.1  christos 	mov	#word_dest, er0
    419  1.1  christos 	addx.w	#0x505, @er0
    420  1.1  christos 
    421  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    422  1.1  christos 	test_ovf_clear
    423  1.1  christos 	test_zero_clear
    424  1.1  christos 	test_neg_clear
    425  1.1  christos 
    426  1.1  christos 	test_h_gr32 word_dest er0	; er0 still contains address
    427  1.1  christos 
    428  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    429  1.1  christos 	test_gr_a5a5 2
    430  1.1  christos 	test_gr_a5a5 3
    431  1.1  christos 	test_gr_a5a5 4
    432  1.1  christos 	test_gr_a5a5 5
    433  1.1  christos 	test_gr_a5a5 6
    434  1.1  christos 	test_gr_a5a5 7
    435  1.1  christos 
    436  1.1  christos 	;; Now check the result of the add to memory.
    437  1.1  christos 	cmp.w	#0x505, @word_dest
    438  1.1  christos 	beq	.Lw1
    439  1.1  christos 	fail
    440  1.1  christos .Lw1:
    441  1.1  christos 
    442  1.1  christos addx_w_imm16_rdpostdec:
    443  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    444  1.1  christos 	set_ccr_zero
    445  1.1  christos 
    446  1.1  christos 	;;  addx.w #xx:16,@eRd-	; Addx to register post-decrement
    447  1.1  christos 	mov	#word_dest, er0
    448  1.1  christos 	addx.w	#0x505, @er0-
    449  1.1  christos 
    450  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    451  1.1  christos 	test_ovf_clear
    452  1.1  christos 	test_zero_clear
    453  1.1  christos 	test_neg_clear
    454  1.1  christos 
    455  1.1  christos 	test_h_gr32 word_dest-2 er0	; er0 contains address minus one
    456  1.1  christos 
    457  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    458  1.1  christos 	test_gr_a5a5 2
    459  1.1  christos 	test_gr_a5a5 3
    460  1.1  christos 	test_gr_a5a5 4
    461  1.1  christos 	test_gr_a5a5 5
    462  1.1  christos 	test_gr_a5a5 6
    463  1.1  christos 	test_gr_a5a5 7
    464  1.1  christos 
    465  1.1  christos 	;; Now check the result of the add to memory.
    466  1.1  christos 	cmp.w	#0xa0a, @word_dest
    467  1.1  christos 	beq	.Lw2
    468  1.1  christos 	fail
    469  1.1  christos .Lw2:
    470  1.1  christos 
    471  1.1  christos addx_w_reg16_0:
    472  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    473  1.1  christos 	set_ccr_zero
    474  1.1  christos 
    475  1.1  christos 	;;  addx.w Rs,Rd	; addx with carry initially zero
    476  1.1  christos 	mov.w	#0x505, e0
    477  1.1  christos 	addx.w	e0, r0		; Register operand
    478  1.1  christos 
    479  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    480  1.1  christos 	test_ovf_clear
    481  1.1  christos 	test_zero_clear
    482  1.1  christos 	test_neg_set
    483  1.1  christos 
    484  1.1  christos 	test_h_gr32 0x0505aaaa er0	; add result:
    485  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    486  1.1  christos 	test_gr_a5a5 2
    487  1.1  christos 	test_gr_a5a5 3
    488  1.1  christos 	test_gr_a5a5 4
    489  1.1  christos 	test_gr_a5a5 5
    490  1.1  christos 	test_gr_a5a5 6
    491  1.1  christos 	test_gr_a5a5 7
    492  1.1  christos 
    493  1.1  christos addx_w_reg16_1:
    494  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    495  1.1  christos 	set_ccr_zero
    496  1.1  christos 
    497  1.1  christos 	;;  addx.w Rs,Rd	; addx with carry initially one
    498  1.1  christos 	mov.w	#0x505, e0
    499  1.1  christos 	set_carry_flag
    500  1.1  christos 	addx.w	e0, r0		; Register operand
    501  1.1  christos 
    502  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    503  1.1  christos 	test_ovf_clear
    504  1.1  christos 	test_zero_clear
    505  1.1  christos 	test_neg_set
    506  1.1  christos 
    507  1.1  christos 	test_h_gr32 0x0505aaab er0	; add result:
    508  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    509  1.1  christos 	test_gr_a5a5 2
    510  1.1  christos 	test_gr_a5a5 3
    511  1.1  christos 	test_gr_a5a5 4
    512  1.1  christos 	test_gr_a5a5 5
    513  1.1  christos 	test_gr_a5a5 6
    514  1.1  christos 	test_gr_a5a5 7
    515  1.1  christos 
    516  1.1  christos addx_w_reg16_rdind:
    517  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    518  1.1  christos 	set_ccr_zero
    519  1.1  christos 
    520  1.1  christos 	;;  addx.w rs8,@eRd	; Addx to register indirect
    521  1.1  christos 	mov	#word_dest, er0
    522  1.1  christos 	mov.w	#0x505, r1
    523  1.1  christos 	addx.w	r1, @er0
    524  1.1  christos 
    525  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    526  1.1  christos 	test_ovf_clear
    527  1.1  christos 	test_zero_clear
    528  1.1  christos 	test_neg_clear
    529  1.1  christos 
    530  1.1  christos 	test_h_gr32 word_dest er0	; er0 still contains address
    531  1.1  christos 	test_h_gr32 0xa5a50505 er1	; er1 has the test load
    532  1.1  christos 
    533  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    534  1.1  christos 	test_gr_a5a5 3
    535  1.1  christos 	test_gr_a5a5 4
    536  1.1  christos 	test_gr_a5a5 5
    537  1.1  christos 	test_gr_a5a5 6
    538  1.1  christos 	test_gr_a5a5 7
    539  1.1  christos 
    540  1.1  christos 	;; Now check the result of the add to memory.
    541  1.1  christos 	cmp.w	#0xf0f, @word_dest
    542  1.1  christos 	beq	.Lw3
    543  1.1  christos 	fail
    544  1.1  christos .Lw3:
    545  1.1  christos 
    546  1.1  christos addx_w_reg16_rdpostdec:
    547  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    548  1.1  christos 	set_ccr_zero
    549  1.1  christos 
    550  1.1  christos 	;;  addx.w rs8,@eRd-	; Addx to register post-decrement
    551  1.1  christos 	mov	#word_dest, er0
    552  1.1  christos 	mov.w	#0x505, r1
    553  1.1  christos 	addx.w	r1, @er0-
    554  1.1  christos 
    555  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    556  1.1  christos 	test_ovf_clear
    557  1.1  christos 	test_zero_clear
    558  1.1  christos 	test_neg_clear
    559  1.1  christos 
    560  1.1  christos 	test_h_gr32 word_dest-2 er0	; er0 contains address minus one
    561  1.1  christos 	test_h_gr32 0xa5a50505  er1	; er1 contains the test load
    562  1.1  christos 
    563  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    564  1.1  christos 	test_gr_a5a5 3
    565  1.1  christos 	test_gr_a5a5 4
    566  1.1  christos 	test_gr_a5a5 5
    567  1.1  christos 	test_gr_a5a5 6
    568  1.1  christos 	test_gr_a5a5 7
    569  1.1  christos 
    570  1.1  christos 	;; Now check the result of the add to memory.
    571  1.1  christos 	cmp.w	#0x1414, @word_dest
    572  1.1  christos 	beq	.Lw4
    573  1.1  christos 	fail
    574  1.1  christos .Lw4:
    575  1.1  christos 
    576  1.1  christos addx_w_rsind_reg16:
    577  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    578  1.1  christos 	set_ccr_zero
    579  1.1  christos 
    580  1.1  christos 	;;  addx.w @eRs,rd8	; Addx from reg indirect to reg
    581  1.1  christos 	mov	#word_src, er0
    582  1.1  christos 	addx.w	@er0, r1
    583  1.1  christos 
    584  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    585  1.1  christos 	test_ovf_clear
    586  1.1  christos 	test_zero_clear
    587  1.1  christos 	test_neg_set
    588  1.1  christos 
    589  1.1  christos 	test_h_gr32 word_src er0	; er0 still contains address
    590  1.1  christos 	test_h_gr32 0xa5a5aaaa er1	; er1 contains the sum
    591  1.1  christos 
    592  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    593  1.1  christos 	test_gr_a5a5 3
    594  1.1  christos 	test_gr_a5a5 4
    595  1.1  christos 	test_gr_a5a5 5
    596  1.1  christos 	test_gr_a5a5 6
    597  1.1  christos 	test_gr_a5a5 7
    598  1.1  christos 
    599  1.1  christos addx_w_rspostdec_reg16:
    600  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    601  1.1  christos 	set_ccr_zero
    602  1.1  christos 
    603  1.1  christos 	;;  addx.w @eRs-,rd8	; Addx to register post-decrement
    604  1.1  christos 	mov	#word_src, er0
    605  1.1  christos 	addx.w	@er0-, r1
    606  1.1  christos 
    607  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    608  1.1  christos 	test_ovf_clear
    609  1.1  christos 	test_zero_clear
    610  1.1  christos 	test_neg_set
    611  1.1  christos 
    612  1.1  christos 	test_h_gr32 word_src-2 er0	; er0 contains address minus one
    613  1.1  christos 	test_h_gr32 0xa5a5aaaa er1	; er1 contains the sum
    614  1.1  christos 
    615  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    616  1.1  christos 	test_gr_a5a5 3
    617  1.1  christos 	test_gr_a5a5 4
    618  1.1  christos 	test_gr_a5a5 5
    619  1.1  christos 	test_gr_a5a5 6
    620  1.1  christos 	test_gr_a5a5 7
    621  1.1  christos 
    622  1.1  christos addx_w_rsind_rdind:
    623  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    624  1.1  christos 	set_ccr_zero
    625  1.1  christos 
    626  1.1  christos 	;;  addx.w @eRs,rd8	; Addx from reg indirect to reg
    627  1.1  christos 	mov	#word_src, er0
    628  1.1  christos 	mov	#word_dest, er1
    629  1.1  christos 	addx.w	@er0, @er1
    630  1.1  christos 
    631  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    632  1.1  christos 	test_ovf_clear
    633  1.1  christos 	test_zero_clear
    634  1.1  christos 	test_neg_clear
    635  1.1  christos 
    636  1.1  christos 	test_h_gr32 word_src er0	; er0 still contains src address
    637  1.1  christos 	test_h_gr32 word_dest er1	; er1 still contains dst address
    638  1.1  christos 
    639  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    640  1.1  christos 	test_gr_a5a5 3
    641  1.1  christos 	test_gr_a5a5 4
    642  1.1  christos 	test_gr_a5a5 5
    643  1.1  christos 	test_gr_a5a5 6
    644  1.1  christos 	test_gr_a5a5 7
    645  1.1  christos 	;; Now check the result of the add to memory.
    646  1.1  christos 	cmp.w	#0x1919, @word_dest
    647  1.1  christos 	beq	.Lw5
    648  1.1  christos 	fail
    649  1.1  christos .Lw5:
    650  1.1  christos 
    651  1.1  christos addx_w_rspostdec_rdpostdec:
    652  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    653  1.1  christos 	set_ccr_zero
    654  1.1  christos 
    655  1.1  christos 	;;  addx.w @eRs-,rd8	; Addx to register post-decrement
    656  1.1  christos 	mov	#word_src, er0
    657  1.1  christos 	mov	#word_dest, er1
    658  1.1  christos 	addx.w	@er0-, @er1-
    659  1.1  christos 
    660  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    661  1.1  christos 	test_ovf_clear
    662  1.1  christos 	test_zero_clear
    663  1.1  christos 	test_neg_clear
    664  1.1  christos 
    665  1.1  christos 	test_h_gr32 word_src-2 er0	; er0 contains src address minus one
    666  1.1  christos 	test_h_gr32 word_dest-2 er1	; er1 contains dst address minus one
    667  1.1  christos 
    668  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    669  1.1  christos 	test_gr_a5a5 3
    670  1.1  christos 	test_gr_a5a5 4
    671  1.1  christos 	test_gr_a5a5 5
    672  1.1  christos 	test_gr_a5a5 6
    673  1.1  christos 	test_gr_a5a5 7
    674  1.1  christos 	;; Now check the result of the add to memory.
    675  1.1  christos 	cmp.w	#0x1e1e, @word_dest
    676  1.1  christos 	beq	.Lw6
    677  1.1  christos 	fail
    678  1.1  christos .Lw6:
    679  1.1  christos 
    680  1.1  christos addx_l_imm32_0:
    681  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    682  1.1  christos 	set_ccr_zero
    683  1.1  christos 
    684  1.1  christos 	;;  addx.l #xx:32,Rd	; Addx with carry initially zero.
    685  1.1  christos 	addx.l	#0x50505, er0	; Immediate 32-bit operand
    686  1.1  christos 
    687  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    688  1.1  christos 	test_ovf_clear
    689  1.1  christos 	test_zero_clear
    690  1.1  christos 	test_neg_set
    691  1.1  christos 
    692  1.1  christos 	test_h_gr32 0xa5aaaaaa er0	; add result:
    693  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    694  1.1  christos 	test_gr_a5a5 2
    695  1.1  christos 	test_gr_a5a5 3
    696  1.1  christos 	test_gr_a5a5 4
    697  1.1  christos 	test_gr_a5a5 5
    698  1.1  christos 	test_gr_a5a5 6
    699  1.1  christos 	test_gr_a5a5 7
    700  1.1  christos 
    701  1.1  christos addx_l_imm32_1:
    702  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    703  1.1  christos 	set_ccr_zero
    704  1.1  christos 
    705  1.1  christos 	;;  addx.l #xx:32,Rd	; Addx with carry initially one.
    706  1.1  christos 	set_carry_flag
    707  1.1  christos 	addx.l	#0x50505, er0	; Immediate 32-bit operand
    708  1.1  christos 
    709  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    710  1.1  christos 	test_ovf_clear
    711  1.1  christos 	test_zero_clear
    712  1.1  christos 	test_neg_set
    713  1.1  christos 
    714  1.1  christos 	test_h_gr32 0xa5aaaaab er0	; add result:
    715  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    716  1.1  christos 	test_gr_a5a5 2
    717  1.1  christos 	test_gr_a5a5 3
    718  1.1  christos 	test_gr_a5a5 4
    719  1.1  christos 	test_gr_a5a5 5
    720  1.1  christos 	test_gr_a5a5 6
    721  1.1  christos 	test_gr_a5a5 7
    722  1.1  christos 
    723  1.1  christos addx_l_imm32_rdind:
    724  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    725  1.1  christos 	set_ccr_zero
    726  1.1  christos 
    727  1.1  christos 	;;  addx.l #xx:32,@eRd	; Addx to register indirect
    728  1.1  christos 	mov	#long_dest, er0
    729  1.1  christos 	addx.l	#0x50505, @er0
    730  1.1  christos 
    731  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    732  1.1  christos 	test_ovf_clear
    733  1.1  christos 	test_zero_clear
    734  1.1  christos 	test_neg_clear
    735  1.1  christos 
    736  1.1  christos 	test_h_gr32 long_dest er0	; er0 still contains address
    737  1.1  christos 
    738  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    739  1.1  christos 	test_gr_a5a5 2
    740  1.1  christos 	test_gr_a5a5 3
    741  1.1  christos 	test_gr_a5a5 4
    742  1.1  christos 	test_gr_a5a5 5
    743  1.1  christos 	test_gr_a5a5 6
    744  1.1  christos 	test_gr_a5a5 7
    745  1.1  christos 
    746  1.1  christos 	;; Now check the result of the add to memory.
    747  1.1  christos 	cmp.l	#0x50505, @long_dest
    748  1.1  christos 	beq	.Ll1
    749  1.1  christos 	fail
    750  1.1  christos .Ll1:
    751  1.1  christos 
    752  1.1  christos addx_l_imm32_rdpostdec:
    753  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    754  1.1  christos 	set_ccr_zero
    755  1.1  christos 
    756  1.1  christos 	;;  addx.l #xx:32,@eRd-	; Addx to register post-decrement
    757  1.1  christos 	mov	#long_dest, er0
    758  1.1  christos 	addx.l	#0x50505, @er0-
    759  1.1  christos 
    760  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    761  1.1  christos 	test_ovf_clear
    762  1.1  christos 	test_zero_clear
    763  1.1  christos 	test_neg_clear
    764  1.1  christos 
    765  1.1  christos 	test_h_gr32 long_dest-4 er0	; er0 contains address minus one
    766  1.1  christos 
    767  1.1  christos 	test_gr_a5a5 1		; Make sure other general regs not disturbed
    768  1.1  christos 	test_gr_a5a5 2
    769  1.1  christos 	test_gr_a5a5 3
    770  1.1  christos 	test_gr_a5a5 4
    771  1.1  christos 	test_gr_a5a5 5
    772  1.1  christos 	test_gr_a5a5 6
    773  1.1  christos 	test_gr_a5a5 7
    774  1.1  christos 
    775  1.1  christos 	;; Now check the result of the add to memory.
    776  1.1  christos 	cmp.l	#0xa0a0a, @long_dest
    777  1.1  christos 	beq	.Ll2
    778  1.1  christos 	fail
    779  1.1  christos .Ll2:
    780  1.1  christos 
    781  1.1  christos addx_l_reg32_0:
    782  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    783  1.1  christos 	set_ccr_zero
    784  1.1  christos 
    785  1.1  christos 	;;  addx.l Rs,Rd	; addx with carry initially zero
    786  1.1  christos 	mov.l	#0x50505, er0
    787  1.1  christos 	addx.l	er0, er1	; Register operand
    788  1.1  christos 
    789  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    790  1.1  christos 	test_ovf_clear
    791  1.1  christos 	test_zero_clear
    792  1.1  christos 	test_neg_set
    793  1.1  christos 
    794  1.1  christos 	test_h_gr32 0x50505    er0	; add load
    795  1.1  christos 	test_h_gr32 0xa5aaaaaa er1	; add result:
    796  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    797  1.1  christos 	test_gr_a5a5 3
    798  1.1  christos 	test_gr_a5a5 4
    799  1.1  christos 	test_gr_a5a5 5
    800  1.1  christos 	test_gr_a5a5 6
    801  1.1  christos 	test_gr_a5a5 7
    802  1.1  christos 
    803  1.1  christos addx_l_reg32_1:
    804  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    805  1.1  christos 	set_ccr_zero
    806  1.1  christos 
    807  1.1  christos 	;;  addx.l Rs,Rd	; addx with carry initially one
    808  1.1  christos 	mov.l	#0x50505, er0
    809  1.1  christos 	set_carry_flag
    810  1.1  christos 	addx.l	er0, er1	; Register operand
    811  1.1  christos 
    812  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    813  1.1  christos 	test_ovf_clear
    814  1.1  christos 	test_zero_clear
    815  1.1  christos 	test_neg_set
    816  1.1  christos 
    817  1.1  christos 	test_h_gr32 0x50505    er0	; add result:
    818  1.1  christos 	test_h_gr32 0xa5aaaaab er1	; add result:
    819  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    820  1.1  christos 	test_gr_a5a5 3
    821  1.1  christos 	test_gr_a5a5 4
    822  1.1  christos 	test_gr_a5a5 5
    823  1.1  christos 	test_gr_a5a5 6
    824  1.1  christos 	test_gr_a5a5 7
    825  1.1  christos 
    826  1.1  christos addx_l_reg32_rdind:
    827  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    828  1.1  christos 	set_ccr_zero
    829  1.1  christos 
    830  1.1  christos 	;;  addx.l rs8,@eRd	; Addx to register indirect
    831  1.1  christos 	mov	#long_dest, er0
    832  1.1  christos 	mov.l	#0x50505, er1
    833  1.1  christos 	addx.l	er1, @er0
    834  1.1  christos 
    835  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    836  1.1  christos 	test_ovf_clear
    837  1.1  christos 	test_zero_clear
    838  1.1  christos 	test_neg_clear
    839  1.1  christos 
    840  1.1  christos 	test_h_gr32 long_dest er0	; er0 still contains address
    841  1.1  christos 	test_h_gr32 0x50505   er1	; er1 has the test load
    842  1.1  christos 
    843  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    844  1.1  christos 	test_gr_a5a5 3
    845  1.1  christos 	test_gr_a5a5 4
    846  1.1  christos 	test_gr_a5a5 5
    847  1.1  christos 	test_gr_a5a5 6
    848  1.1  christos 	test_gr_a5a5 7
    849  1.1  christos 
    850  1.1  christos 	;; Now check the result of the add to memory.
    851  1.1  christos 	cmp.l	#0xf0f0f, @long_dest
    852  1.1  christos 	beq	.Ll3
    853  1.1  christos 	fail
    854  1.1  christos .Ll3:
    855  1.1  christos 
    856  1.1  christos addx_l_reg32_rdpostdec:
    857  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    858  1.1  christos 	set_ccr_zero
    859  1.1  christos 
    860  1.1  christos 	;;  addx.l rs8,@eRd-	; Addx to register post-decrement
    861  1.1  christos 	mov	#long_dest, er0
    862  1.1  christos 	mov.l	#0x50505, er1
    863  1.1  christos 	addx.l	er1, @er0-
    864  1.1  christos 
    865  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    866  1.1  christos 	test_ovf_clear
    867  1.1  christos 	test_zero_clear
    868  1.1  christos 	test_neg_clear
    869  1.1  christos 
    870  1.1  christos 	test_h_gr32 long_dest-4 er0	; er0 contains address minus one
    871  1.1  christos 	test_h_gr32 0x50505     er1	; er1 contains the test load
    872  1.1  christos 
    873  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    874  1.1  christos 	test_gr_a5a5 3
    875  1.1  christos 	test_gr_a5a5 4
    876  1.1  christos 	test_gr_a5a5 5
    877  1.1  christos 	test_gr_a5a5 6
    878  1.1  christos 	test_gr_a5a5 7
    879  1.1  christos 
    880  1.1  christos 	;; Now check the result of the add to memory.
    881  1.1  christos 	cmp.l	#0x141414, @long_dest
    882  1.1  christos 	beq	.Ll4
    883  1.1  christos 	fail
    884  1.1  christos .Ll4:
    885  1.1  christos 
    886  1.1  christos addx_l_rsind_reg32:
    887  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    888  1.1  christos 	set_ccr_zero
    889  1.1  christos 
    890  1.1  christos 	;;  addx.l @eRs,rd8	; Addx from reg indirect to reg
    891  1.1  christos 	mov	#long_src, er0
    892  1.1  christos 	addx.l	@er0, er1
    893  1.1  christos 
    894  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    895  1.1  christos 	test_ovf_clear
    896  1.1  christos 	test_zero_clear
    897  1.1  christos 	test_neg_set
    898  1.1  christos 
    899  1.1  christos 	test_h_gr32 long_src er0	; er0 still contains address
    900  1.1  christos 	test_h_gr32 0xa5aaaaaa er1	; er1 contains the sum
    901  1.1  christos 
    902  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    903  1.1  christos 	test_gr_a5a5 3
    904  1.1  christos 	test_gr_a5a5 4
    905  1.1  christos 	test_gr_a5a5 5
    906  1.1  christos 	test_gr_a5a5 6
    907  1.1  christos 	test_gr_a5a5 7
    908  1.1  christos 
    909  1.1  christos addx_l_rspostdec_reg32:
    910  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    911  1.1  christos 	set_ccr_zero
    912  1.1  christos 
    913  1.1  christos 	;;  addx.l @eRs-,rd8	; Addx to register post-decrement
    914  1.1  christos 	mov	#long_src, er0
    915  1.1  christos 	addx.l	@er0-, er1
    916  1.1  christos 
    917  1.1  christos 	test_carry_clear	; H=0 N=1 Z=0 V=0 C=0
    918  1.1  christos 	test_ovf_clear
    919  1.1  christos 	test_zero_clear
    920  1.1  christos 	test_neg_set
    921  1.1  christos 
    922  1.1  christos 	test_h_gr32 long_src-4 er0	; er0 contains address minus one
    923  1.1  christos 	test_h_gr32 0xa5aaaaaa er1	; er1 contains the sum
    924  1.1  christos 
    925  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    926  1.1  christos 	test_gr_a5a5 3
    927  1.1  christos 	test_gr_a5a5 4
    928  1.1  christos 	test_gr_a5a5 5
    929  1.1  christos 	test_gr_a5a5 6
    930  1.1  christos 	test_gr_a5a5 7
    931  1.1  christos 
    932  1.1  christos addx_l_rsind_rdind:
    933  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    934  1.1  christos 	set_ccr_zero
    935  1.1  christos 
    936  1.1  christos 	;;  addx.l @eRs,rd8	; Addx from reg indirect to reg
    937  1.1  christos 	mov	#long_src, er0
    938  1.1  christos 	mov	#long_dest, er1
    939  1.1  christos 	addx.l	@er0, @er1
    940  1.1  christos 
    941  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    942  1.1  christos 	test_ovf_clear
    943  1.1  christos 	test_zero_clear
    944  1.1  christos 	test_neg_clear
    945  1.1  christos 
    946  1.1  christos 	test_h_gr32 long_src er0	; er0 still contains src address
    947  1.1  christos 	test_h_gr32 long_dest er1	; er1 still contains dst address
    948  1.1  christos 
    949  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    950  1.1  christos 	test_gr_a5a5 3
    951  1.1  christos 	test_gr_a5a5 4
    952  1.1  christos 	test_gr_a5a5 5
    953  1.1  christos 	test_gr_a5a5 6
    954  1.1  christos 	test_gr_a5a5 7
    955  1.1  christos 	;; Now check the result of the add to memory.
    956  1.1  christos 	cmp.l	#0x191919, @long_dest
    957  1.1  christos 	beq	.Ll5
    958  1.1  christos 	fail
    959  1.1  christos .Ll5:
    960  1.1  christos 
    961  1.1  christos addx_l_rspostdec_rdpostdec:
    962  1.1  christos 	set_grs_a5a5		; Fill all general regs with a fixed pattern
    963  1.1  christos 	set_ccr_zero
    964  1.1  christos 
    965  1.1  christos 	;;  addx.l @eRs-,rd8	; Addx to register post-decrement
    966  1.1  christos 	mov	#long_src, er0
    967  1.1  christos 	mov	#long_dest, er1
    968  1.1  christos 	addx.l	@er0-, @er1-
    969  1.1  christos 
    970  1.1  christos 	test_carry_clear	; H=0 N=0 Z=0 V=0 C=0
    971  1.1  christos 	test_ovf_clear
    972  1.1  christos 	test_zero_clear
    973  1.1  christos 	test_neg_clear
    974  1.1  christos 
    975  1.1  christos 	test_h_gr32 long_src-4 er0	; er0 contains src address minus one
    976  1.1  christos 	test_h_gr32 long_dest-4 er1	; er1 contains dst address minus one
    977  1.1  christos 
    978  1.1  christos 	test_gr_a5a5 2		; Make sure other general regs not disturbed
    979  1.1  christos 	test_gr_a5a5 3
    980  1.1  christos 	test_gr_a5a5 4
    981  1.1  christos 	test_gr_a5a5 5
    982  1.1  christos 	test_gr_a5a5 6
    983  1.1  christos 	test_gr_a5a5 7
    984  1.1  christos 	;; Now check the result of the add to memory.
    985  1.1  christos 	cmp.l	#0x1e1e1e, @long_dest
    986  1.1  christos 	beq	.Ll6
    987  1.1  christos 	fail
    988  1.1  christos .Ll6:
    989  1.1  christos .endif
    990  1.1  christos 	pass
    991  1.1  christos 
    992  1.1  christos 	exit 0
    993