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