OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [sim/] [testsuite/] [sim/] [h8300/] [shar.s] - Diff between revs 157 and 223

Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
# Hitachi H8 testcase 'shar'
# Hitachi H8 testcase 'shar'
# mach(): all
# mach(): all
# as(h8300):    --defsym sim_cpu=0
# as(h8300):    --defsym sim_cpu=0
# as(h8300h):   --defsym sim_cpu=1
# as(h8300h):   --defsym sim_cpu=1
# as(h8300s):   --defsym sim_cpu=2
# as(h8300s):   --defsym sim_cpu=2
# as(h8sx):     --defsym sim_cpu=3
# as(h8sx):     --defsym sim_cpu=3
# ld(h8300h):   -m h8300helf
# ld(h8300h):   -m h8300helf
# ld(h8300s):   -m h8300self
# ld(h8300s):   -m h8300self
# ld(h8sx):     -m h8300sxelf
# ld(h8sx):     -m h8300sxelf
 
 
        .include "testutils.inc"
        .include "testutils.inc"
 
 
        start
        start
 
 
        .data
        .data
byte_dest:      .byte   0xa5
byte_dest:      .byte   0xa5
        .align 2
        .align 2
word_dest:      .word   0xa5a5
word_dest:      .word   0xa5a5
        .align 4
        .align 4
long_dest:      .long   0xa5a5a5a5
long_dest:      .long   0xa5a5a5a5
 
 
        .text
        .text
 
 
shar_b_reg8_1:
shar_b_reg8_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.b  r0l             ; shift right arithmetic by one
        shar.b  r0l             ; shift right arithmetic by one
;;;     .word   0x1188
;;;     .word   0x1188
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr16 0xa5d2 r0   ; 1010 0101 -> 1101 0010
        test_h_gr16 0xa5d2 r0   ; 1010 0101 -> 1101 0010
.if (sim_cpu)
.if (sim_cpu)
        test_h_gr32 0xa5a5a5d2 er0
        test_h_gr32 0xa5a5a5d2 er0
.endif
.endif
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
 
 
.if (sim_cpu == h8sx)
.if (sim_cpu == h8sx)
shar_b_ind_1:
shar_b_ind_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest, er0
        mov     #byte_dest, er0
        shar.b  @er0    ; shift right arithmetic by one, indirect
        shar.b  @er0    ; shift right arithmetic by one, indirect
;;;     .word   0x7d00
;;;     .word   0x7d00
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest er0
        test_h_gr32  byte_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbind1
        beq     .Lbind1
        fail
        fail
.Lbind1:
.Lbind1:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_postinc_1:
shar_b_postinc_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest, er0
        mov     #byte_dest, er0
        shar.b  @er0+   ; shift right arithmetic by one, postinc
        shar.b  @er0+   ; shift right arithmetic by one, postinc
;;;     .word   0x0174
;;;     .word   0x0174
;;;     .word   0x6c08
;;;     .word   0x6c08
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest+1 er0
        test_h_gr32  byte_dest+1 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbpostinc1
        beq     .Lbpostinc1
        fail
        fail
.Lbpostinc1:
.Lbpostinc1:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_postdec_1:
shar_b_postdec_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest, er0
        mov     #byte_dest, er0
        shar.b  @er0-   ; shift right arithmetic by one, postdec
        shar.b  @er0-   ; shift right arithmetic by one, postdec
;;;     .word   0x0176
;;;     .word   0x0176
;;;     .word   0x6c08
;;;     .word   0x6c08
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest-1 er0
        test_h_gr32  byte_dest-1 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbpostdec1
        beq     .Lbpostdec1
        fail
        fail
.Lbpostdec1:
.Lbpostdec1:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_preinc_1:
shar_b_preinc_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest-1, er0
        mov     #byte_dest-1, er0
        shar.b  @+er0   ; shift right arithmetic by one, preinc
        shar.b  @+er0   ; shift right arithmetic by one, preinc
;;;     .word   0x0175
;;;     .word   0x0175
;;;     .word   0x6c08
;;;     .word   0x6c08
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest er0
        test_h_gr32  byte_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbpreinc1
        beq     .Lbpreinc1
        fail
        fail
.Lbpreinc1:
.Lbpreinc1:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_predec_1:
shar_b_predec_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest+1, er0
        mov     #byte_dest+1, er0
        shar.b  @-er0   ; shift right arithmetic by one, predec
        shar.b  @-er0   ; shift right arithmetic by one, predec
;;;     .word   0x0177
;;;     .word   0x0177
;;;     .word   0x6c08
;;;     .word   0x6c08
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest er0
        test_h_gr32  byte_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbpredec1
        beq     .Lbpredec1
        fail
        fail
.Lbpredec1:
.Lbpredec1:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_disp2_1:
shar_b_disp2_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest-2, er0
        mov     #byte_dest-2, er0
        shar.b  @(2:2, er0)     ; shift right arithmetic by one, disp2
        shar.b  @(2:2, er0)     ; shift right arithmetic by one, disp2
;;;     .word   0x0176
;;;     .word   0x0176
;;;     .word   0x6808
;;;     .word   0x6808
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest-2 er0
        test_h_gr32  byte_dest-2 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbdisp21
        beq     .Lbdisp21
        fail
        fail
.Lbdisp21:
.Lbdisp21:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_disp16_1:
shar_b_disp16_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest-44, er0
        mov     #byte_dest-44, er0
        shar.b  @(44:16, er0)   ; shift right arithmetic by one, disp16
        shar.b  @(44:16, er0)   ; shift right arithmetic by one, disp16
;;;     .word   0x0174
;;;     .word   0x0174
;;;     .word   0x6e08
;;;     .word   0x6e08
;;;     .word   44
;;;     .word   44
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest-44 er0
        test_h_gr32  byte_dest-44 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbdisp161
        beq     .Lbdisp161
        fail
        fail
.Lbdisp161:
.Lbdisp161:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_disp32_1:
shar_b_disp32_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest-666, er0
        mov     #byte_dest-666, er0
        shar.b  @(666:32, er0)  ; shift right arithmetic by one, disp32
        shar.b  @(666:32, er0)  ; shift right arithmetic by one, disp32
;;;     .word   0x7884
;;;     .word   0x7884
;;;     .word   0x6a28
;;;     .word   0x6a28
;;;     .long   666
;;;     .long   666
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest-666 er0
        test_h_gr32  byte_dest-666 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbdisp321
        beq     .Lbdisp321
        fail
        fail
.Lbdisp321:
.Lbdisp321:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_abs16_1:
shar_b_abs16_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.b  @byte_dest:16   ; shift right arithmetic by one, abs16
        shar.b  @byte_dest:16   ; shift right arithmetic by one, abs16
;;;     .word   0x6a18
;;;     .word   0x6a18
;;;     .word   byte_dest
;;;     .word   byte_dest
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbabs161
        beq     .Lbabs161
        fail
        fail
.Lbabs161:
.Lbabs161:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_abs32_1:
shar_b_abs32_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.b  @byte_dest:32   ; shift right arithmetic by one, abs32
        shar.b  @byte_dest:32   ; shift right arithmetic by one, abs32
;;;     .word   0x6a38
;;;     .word   0x6a38
;;;     .long   byte_dest
;;;     .long   byte_dest
;;;     .word   0x1180
;;;     .word   0x1180
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1101 0010
        ; 1010 0101 -> 1101 0010
        cmp.b   #0xd2, @byte_dest
        cmp.b   #0xd2, @byte_dest
        beq     .Lbabs321
        beq     .Lbabs321
        fail
        fail
.Lbabs321:
.Lbabs321:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
.endif
.endif
 
 
shar_b_reg8_2:
shar_b_reg8_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.b  #2, r0l         ; shift right arithmetic by two
        shar.b  #2, r0l         ; shift right arithmetic by two
;;;     .word   0x11c8
;;;     .word   0x11c8
 
 
        test_carry_clear        ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear        ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
        test_h_gr16 0xa5e9 r0   ; 1010 0101 -> 1110 1001
        test_h_gr16 0xa5e9 r0   ; 1010 0101 -> 1110 1001
.if (sim_cpu)
.if (sim_cpu)
        test_h_gr32 0xa5a5a5e9 er0
        test_h_gr32 0xa5a5a5e9 er0
.endif
.endif
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
 
 
.if (sim_cpu == h8sx)
.if (sim_cpu == h8sx)
shar_b_ind_2:
shar_b_ind_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest, er0
        mov     #byte_dest, er0
        shar.b  #2, @er0        ; shift right arithmetic by two, indirect
        shar.b  #2, @er0        ; shift right arithmetic by two, indirect
;;;     .word   0x7d00
;;;     .word   0x7d00
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest er0
        test_h_gr32  byte_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbind2
        beq     .Lbind2
        fail
        fail
.Lbind2:
.Lbind2:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_postinc_2:
shar_b_postinc_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest, er0
        mov     #byte_dest, er0
        shar.b  #2, @er0+       ; shift right arithmetic by two, postinc
        shar.b  #2, @er0+       ; shift right arithmetic by two, postinc
;;;     .word   0x0174
;;;     .word   0x0174
;;;     .word   0x6c08
;;;     .word   0x6c08
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest+1 er0
        test_h_gr32  byte_dest+1 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbpostinc2
        beq     .Lbpostinc2
        fail
        fail
.Lbpostinc2:
.Lbpostinc2:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_postdec_2:
shar_b_postdec_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest, er0
        mov     #byte_dest, er0
        shar.b  #2, @er0-       ; shift right arithmetic by two, postdec
        shar.b  #2, @er0-       ; shift right arithmetic by two, postdec
;;;     .word   0x0176
;;;     .word   0x0176
;;;     .word   0x6c08
;;;     .word   0x6c08
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest-1 er0
        test_h_gr32  byte_dest-1 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbpostdec2
        beq     .Lbpostdec2
        fail
        fail
.Lbpostdec2:
.Lbpostdec2:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_preinc_2:
shar_b_preinc_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest-1, er0
        mov     #byte_dest-1, er0
        shar.b  #2, @+er0       ; shift right arithmetic by two, preinc
        shar.b  #2, @+er0       ; shift right arithmetic by two, preinc
;;;     .word   0x0175
;;;     .word   0x0175
;;;     .word   0x6c08
;;;     .word   0x6c08
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest er0
        test_h_gr32  byte_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbpreinc2
        beq     .Lbpreinc2
        fail
        fail
.Lbpreinc2:
.Lbpreinc2:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_predec_2:
shar_b_predec_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest+1, er0
        mov     #byte_dest+1, er0
        shar.b  #2, @-er0       ; shift right arithmetic by two, predec
        shar.b  #2, @-er0       ; shift right arithmetic by two, predec
;;;     .word   0x0177
;;;     .word   0x0177
;;;     .word   0x6c08
;;;     .word   0x6c08
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest er0
        test_h_gr32  byte_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbpredec2
        beq     .Lbpredec2
        fail
        fail
.Lbpredec2:
.Lbpredec2:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_disp2_2:
shar_b_disp2_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest-2, er0
        mov     #byte_dest-2, er0
        shar.b  #2, @(2:2, er0) ; shift right arithmetic by two, disp2
        shar.b  #2, @(2:2, er0) ; shift right arithmetic by two, disp2
;;;     .word   0x0176
;;;     .word   0x0176
;;;     .word   0x6808
;;;     .word   0x6808
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest-2 er0
        test_h_gr32  byte_dest-2 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbdisp22
        beq     .Lbdisp22
        fail
        fail
.Lbdisp22:
.Lbdisp22:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_disp16_2:
shar_b_disp16_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest-44, er0
        mov     #byte_dest-44, er0
        shar.b  #2, @(44:16, er0)       ; shift right arithmetic by two, disp16
        shar.b  #2, @(44:16, er0)       ; shift right arithmetic by two, disp16
;;;     .word   0x0174
;;;     .word   0x0174
;;;     .word   0x6e08
;;;     .word   0x6e08
;;;     .word   44
;;;     .word   44
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest-44 er0
        test_h_gr32  byte_dest-44 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbdisp162
        beq     .Lbdisp162
        fail
        fail
.Lbdisp162:
.Lbdisp162:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_disp32_2:
shar_b_disp32_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #byte_dest-666, er0
        mov     #byte_dest-666, er0
        shar.b  #2, @(666:32, er0)      ; shift right arithmetic by two, disp32
        shar.b  #2, @(666:32, er0)      ; shift right arithmetic by two, disp32
;;;     .word   0x7884
;;;     .word   0x7884
;;;     .word   0x6a28
;;;     .word   0x6a28
;;;     .long   666
;;;     .long   666
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  byte_dest-666 er0
        test_h_gr32  byte_dest-666 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbdisp322
        beq     .Lbdisp322
        fail
        fail
.Lbdisp322:
.Lbdisp322:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_abs16_2:
shar_b_abs16_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.b  #2, @byte_dest:16       ; shift right arithmetic by two, abs16
        shar.b  #2, @byte_dest:16       ; shift right arithmetic by two, abs16
;;;     .word   0x6a18
;;;     .word   0x6a18
;;;     .word   byte_dest
;;;     .word   byte_dest
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbabs162
        beq     .Lbabs162
        fail
        fail
.Lbabs162:
.Lbabs162:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
 
 
shar_b_abs32_2:
shar_b_abs32_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.b  #2, @byte_dest:32       ; shift right arithmetic by two, abs32
        shar.b  #2, @byte_dest:32       ; shift right arithmetic by two, abs32
;;;     .word   0x6a38
;;;     .word   0x6a38
;;;     .long   byte_dest
;;;     .long   byte_dest
;;;     .word   0x11c0
;;;     .word   0x11c0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 -> 1110 1001
        ; 1010 0101 -> 1110 1001
        cmp.b   #0xe9, @byte_dest
        cmp.b   #0xe9, @byte_dest
        beq     .Lbabs322
        beq     .Lbabs322
        fail
        fail
.Lbabs322:
.Lbabs322:
        mov.b   #0xa5, @byte_dest
        mov.b   #0xa5, @byte_dest
.endif
.endif
 
 
.if (sim_cpu)                   ; Not available in h8300 mode
.if (sim_cpu)                   ; Not available in h8300 mode
shar_w_reg16_1:
shar_w_reg16_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.w  r0              ; shift right arithmetic by one
        shar.w  r0              ; shift right arithmetic by one
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
        test_h_gr16 0xd2d2 r0   ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
        test_h_gr16 0xd2d2 r0   ; 1010 0101 1010 0101 -> 1101 0010 1101 0010
        test_h_gr32 0xa5a5d2d2 er0
        test_h_gr32 0xa5a5d2d2 er0
 
 
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
 
 
.if (sim_cpu == h8sx)
.if (sim_cpu == h8sx)
shar_w_ind_1:
shar_w_ind_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest, er0
        mov     #word_dest, er0
        shar.w  @er0    ; shift right arithmetic by one, indirect
        shar.w  @er0    ; shift right arithmetic by one, indirect
;;;     .word   0x7d80
;;;     .word   0x7d80
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest er0
        test_h_gr32  word_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwind1
        beq     .Lwind1
        fail
        fail
.Lwind1:
.Lwind1:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_postinc_1:
shar_w_postinc_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest, er0
        mov     #word_dest, er0
        shar.w  @er0+   ; shift right arithmetic by one, postinc
        shar.w  @er0+   ; shift right arithmetic by one, postinc
;;;     .word   0x0154
;;;     .word   0x0154
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest+2 er0
        test_h_gr32  word_dest+2 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwpostinc1
        beq     .Lwpostinc1
        fail
        fail
.Lwpostinc1:
.Lwpostinc1:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_postdec_1:
shar_w_postdec_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest, er0
        mov     #word_dest, er0
        shar.w  @er0-   ; shift right arithmetic by one, postdec
        shar.w  @er0-   ; shift right arithmetic by one, postdec
;;;     .word   0x0156
;;;     .word   0x0156
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest-2 er0
        test_h_gr32  word_dest-2 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwpostdec1
        beq     .Lwpostdec1
        fail
        fail
.Lwpostdec1:
.Lwpostdec1:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_preinc_1:
shar_w_preinc_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest-2, er0
        mov     #word_dest-2, er0
        shar.w  @+er0   ; shift right arithmetic by one, preinc
        shar.w  @+er0   ; shift right arithmetic by one, preinc
;;;     .word   0x0155
;;;     .word   0x0155
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest er0
        test_h_gr32  word_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwpreinc1
        beq     .Lwpreinc1
        fail
        fail
.Lwpreinc1:
.Lwpreinc1:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_predec_1:
shar_w_predec_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest+2, er0
        mov     #word_dest+2, er0
        shar.w  @-er0   ; shift right arithmetic by one, predec
        shar.w  @-er0   ; shift right arithmetic by one, predec
;;;     .word   0x0157
;;;     .word   0x0157
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest er0
        test_h_gr32  word_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwpredec1
        beq     .Lwpredec1
        fail
        fail
.Lwpredec1:
.Lwpredec1:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_disp2_1:
shar_w_disp2_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest-4, er0
        mov     #word_dest-4, er0
        shar.w  @(4:2, er0)     ; shift right arithmetic by one, disp2
        shar.w  @(4:2, er0)     ; shift right arithmetic by one, disp2
;;;     .word   0x0156
;;;     .word   0x0156
;;;     .word   0x6908
;;;     .word   0x6908
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest-4 er0
        test_h_gr32  word_dest-4 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwdisp21
        beq     .Lwdisp21
        fail
        fail
.Lwdisp21:
.Lwdisp21:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_disp16_1:
shar_w_disp16_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest-44, er0
        mov     #word_dest-44, er0
        shar.w  @(44:16, er0)   ; shift right arithmetic by one, disp16
        shar.w  @(44:16, er0)   ; shift right arithmetic by one, disp16
;;;     .word   0x0154
;;;     .word   0x0154
;;;     .word   0x6f08
;;;     .word   0x6f08
;;;     .word   44
;;;     .word   44
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest-44 er0
        test_h_gr32  word_dest-44 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwdisp161
        beq     .Lwdisp161
        fail
        fail
.Lwdisp161:
.Lwdisp161:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_disp32_1:
shar_w_disp32_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest-666, er0
        mov     #word_dest-666, er0
        shar.w  @(666:32, er0)  ; shift right arithmetic by one, disp32
        shar.w  @(666:32, er0)  ; shift right arithmetic by one, disp32
;;;     .word   0x7884
;;;     .word   0x7884
;;;     .word   0x6b28
;;;     .word   0x6b28
;;;     .long   666
;;;     .long   666
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest-666 er0
        test_h_gr32  word_dest-666 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwdisp321
        beq     .Lwdisp321
        fail
        fail
.Lwdisp321:
.Lwdisp321:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_abs16_1:
shar_w_abs16_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.w  @word_dest:16   ; shift right arithmetic by one, abs16
        shar.w  @word_dest:16   ; shift right arithmetic by one, abs16
;;;     .word   0x6b18
;;;     .word   0x6b18
;;;     .word   word_dest
;;;     .word   word_dest
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 1
        test_gr_a5a5 1
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwabs161
        beq     .Lwabs161
        fail
        fail
.Lwabs161:
.Lwabs161:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_abs32_1:
shar_w_abs32_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.w  @word_dest:32   ; shift right arithmetic by one, abs32
        shar.w  @word_dest:32   ; shift right arithmetic by one, abs32
;;;     .word   0x6b38
;;;     .word   0x6b38
;;;     .long   word_dest
;;;     .long   word_dest
;;;     .word   0x1190
;;;     .word   0x1190
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 1
        test_gr_a5a5 1
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        ; 1010 0101 1010 0101 -> 1101 0010 1101 0010 
        cmp.w   #0xd2d2, @word_dest
        cmp.w   #0xd2d2, @word_dest
        beq     .Lwabs321
        beq     .Lwabs321
        fail
        fail
.Lwabs321:
.Lwabs321:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
.endif
.endif
 
 
shar_w_reg16_2:
shar_w_reg16_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.w  #2, r0          ; shift right arithmetic by two
        shar.w  #2, r0          ; shift right arithmetic by two
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear        ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear        ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr16 0xe969 r0   ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
        test_h_gr16 0xe969 r0   ; 1010 0101 1010 0101 -> 1110 1001 0110 1001
        test_h_gr32 0xa5a5e969 er0
        test_h_gr32 0xa5a5e969 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
 
 
.if (sim_cpu == h8sx)
.if (sim_cpu == h8sx)
shar_w_ind_2:
shar_w_ind_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest, er0
        mov     #word_dest, er0
        shar.w  #2, @er0        ; shift right arithmetic by two, indirect
        shar.w  #2, @er0        ; shift right arithmetic by two, indirect
;;;     .word   0x7d80
;;;     .word   0x7d80
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest er0
        test_h_gr32  word_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwind2
        beq     .Lwind2
        fail
        fail
.Lwind2:
.Lwind2:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_postinc_2:
shar_w_postinc_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest, er0
        mov     #word_dest, er0
        shar.w  #2, @er0+       ; shift right arithmetic by two, postinc
        shar.w  #2, @er0+       ; shift right arithmetic by two, postinc
;;;     .word   0x0154
;;;     .word   0x0154
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest+2 er0
        test_h_gr32  word_dest+2 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwpostinc2
        beq     .Lwpostinc2
        fail
        fail
.Lwpostinc2:
.Lwpostinc2:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_postdec_2:
shar_w_postdec_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest, er0
        mov     #word_dest, er0
        shar.w  #2, @er0-       ; shift right arithmetic by two, postdec
        shar.w  #2, @er0-       ; shift right arithmetic by two, postdec
;;;     .word   0x0156
;;;     .word   0x0156
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest-2 er0
        test_h_gr32  word_dest-2 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwpostdec2
        beq     .Lwpostdec2
        fail
        fail
.Lwpostdec2:
.Lwpostdec2:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_preinc_2:
shar_w_preinc_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest-2, er0
        mov     #word_dest-2, er0
        shar.w  #2, @+er0       ; shift right arithmetic by two, preinc
        shar.w  #2, @+er0       ; shift right arithmetic by two, preinc
;;;     .word   0x0155
;;;     .word   0x0155
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest er0
        test_h_gr32  word_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwpreinc2
        beq     .Lwpreinc2
        fail
        fail
.Lwpreinc2:
.Lwpreinc2:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_predec_2:
shar_w_predec_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest+2, er0
        mov     #word_dest+2, er0
        shar.w  #2, @-er0       ; shift right arithmetic by two, predec
        shar.w  #2, @-er0       ; shift right arithmetic by two, predec
;;;     .word   0x0157
;;;     .word   0x0157
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest er0
        test_h_gr32  word_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwpredec2
        beq     .Lwpredec2
        fail
        fail
.Lwpredec2:
.Lwpredec2:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_disp2_2:
shar_w_disp2_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest-4, er0
        mov     #word_dest-4, er0
        shar.w  #2, @(4:2, er0) ; shift right arithmetic by two, disp2
        shar.w  #2, @(4:2, er0) ; shift right arithmetic by two, disp2
;;;     .word   0x0156
;;;     .word   0x0156
;;;     .word   0x6908
;;;     .word   0x6908
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest-4 er0
        test_h_gr32  word_dest-4 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwdisp22
        beq     .Lwdisp22
        fail
        fail
.Lwdisp22:
.Lwdisp22:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_disp16_2:
shar_w_disp16_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest-44, er0
        mov     #word_dest-44, er0
        shar.w  #2, @(44:16, er0)       ; shift right arithmetic by two, disp16
        shar.w  #2, @(44:16, er0)       ; shift right arithmetic by two, disp16
;;;     .word   0x0154
;;;     .word   0x0154
;;;     .word   0x6f08
;;;     .word   0x6f08
;;;     .word   44
;;;     .word   44
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest-44 er0
        test_h_gr32  word_dest-44 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwdisp162
        beq     .Lwdisp162
        fail
        fail
.Lwdisp162:
.Lwdisp162:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_disp32_2:
shar_w_disp32_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #word_dest-666, er0
        mov     #word_dest-666, er0
        shar.w  #2, @(666:32, er0)      ; shift right arithmetic by two, disp32
        shar.w  #2, @(666:32, er0)      ; shift right arithmetic by two, disp32
;;;     .word   0x7884
;;;     .word   0x7884
;;;     .word   0x6b28
;;;     .word   0x6b28
;;;     .long   666
;;;     .long   666
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  word_dest-666 er0
        test_h_gr32  word_dest-666 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwdisp322
        beq     .Lwdisp322
        fail
        fail
.Lwdisp322:
.Lwdisp322:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_abs16_2:
shar_w_abs16_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.w  #2, @word_dest:16       ; shift right arithmetic by two, abs16
        shar.w  #2, @word_dest:16       ; shift right arithmetic by two, abs16
;;;     .word   0x6b18
;;;     .word   0x6b18
;;;     .word   word_dest
;;;     .word   word_dest
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwabs162
        beq     .Lwabs162
        fail
        fail
.Lwabs162:
.Lwabs162:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
 
 
shar_w_abs32_2:
shar_w_abs32_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.w  #2, @word_dest:32       ; shift right arithmetic by two, abs32
        shar.w  #2, @word_dest:32       ; shift right arithmetic by two, abs32
;;;     .word   0x6b38
;;;     .word   0x6b38
;;;     .long   word_dest
;;;     .long   word_dest
;;;     .word   0x11d0
;;;     .word   0x11d0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        ; 1010 0101 1010 0101 -> 1110 1001 0110 1001  
        cmp.w   #0xe969, @word_dest
        cmp.w   #0xe969, @word_dest
        beq     .Lwabs322
        beq     .Lwabs322
        fail
        fail
.Lwabs322:
.Lwabs322:
        mov.w   #0xa5a5, @word_dest
        mov.w   #0xa5a5, @word_dest
.endif
.endif
 
 
shar_l_reg32_1:
shar_l_reg32_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.l  er0             ; shift right arithmetic by one, register
        shar.l  er0             ; shift right arithmetic by one, register
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        ; 1010 0101 1010 0101 1010 0101 1010 0101 
        ; 1010 0101 1010 0101 1010 0101 1010 0101 
        ; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ; -> 1101 0010 1101 0010 1101 0010 1101 0010
        test_h_gr32  0xd2d2d2d2 er0
        test_h_gr32  0xd2d2d2d2 er0
 
 
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
 
 
.if (sim_cpu == h8sx)
.if (sim_cpu == h8sx)
shar_l_ind_1:
shar_l_ind_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest, er0
        mov     #long_dest, er0
        shar.l  @er0    ; shift right arithmetic by one, indirect
        shar.l  @er0    ; shift right arithmetic by one, indirect
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6908
;;;     .word   0x6908
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest er0
        test_h_gr32  long_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Llind1
        beq     .Llind1
        fail
        fail
.Llind1:
.Llind1:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_postinc_1:
shar_l_postinc_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest, er0
        mov     #long_dest, er0
        shar.l  @er0+   ; shift right arithmetic by one, postinc
        shar.l  @er0+   ; shift right arithmetic by one, postinc
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest+4 er0
        test_h_gr32  long_dest+4 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Llpostinc1
        beq     .Llpostinc1
        fail
        fail
.Llpostinc1:
.Llpostinc1:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_postdec_1:
shar_l_postdec_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest, er0
        mov     #long_dest, er0
        shar.l  @er0-   ; shift right arithmetic by one, postdec
        shar.l  @er0-   ; shift right arithmetic by one, postdec
;;;     .word   0x0106
;;;     .word   0x0106
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest-4 er0
        test_h_gr32  long_dest-4 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Llpostdec1
        beq     .Llpostdec1
        fail
        fail
.Llpostdec1:
.Llpostdec1:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_preinc_1:
shar_l_preinc_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest-4, er0
        mov     #long_dest-4, er0
        shar.l  @+er0   ; shift right arithmetic by one, preinc
        shar.l  @+er0   ; shift right arithmetic by one, preinc
;;;     .word   0x0105
;;;     .word   0x0105
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest er0
        test_h_gr32  long_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Llpreinc1
        beq     .Llpreinc1
        fail
        fail
.Llpreinc1:
.Llpreinc1:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_predec_1:
shar_l_predec_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest+4, er0
        mov     #long_dest+4, er0
        shar.l  @-er0   ; shift right arithmetic by one, predec
        shar.l  @-er0   ; shift right arithmetic by one, predec
;;;     .word   0x0107
;;;     .word   0x0107
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest er0
        test_h_gr32  long_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Llpredec1
        beq     .Llpredec1
        fail
        fail
.Llpredec1:
.Llpredec1:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_disp2_1:
shar_l_disp2_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest-8, er0
        mov     #long_dest-8, er0
        shar.l  @(8:2, er0)     ; shift right arithmetic by one, disp2
        shar.l  @(8:2, er0)     ; shift right arithmetic by one, disp2
;;;     .word   0x0106
;;;     .word   0x0106
;;;     .word   0x6908
;;;     .word   0x6908
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest-8 er0
        test_h_gr32  long_dest-8 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Lldisp21
        beq     .Lldisp21
        fail
        fail
.Lldisp21:
.Lldisp21:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_disp16_1:
shar_l_disp16_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest-44, er0
        mov     #long_dest-44, er0
        shar.l  @(44:16, er0)   ; shift right arithmetic by one, disp16
        shar.l  @(44:16, er0)   ; shift right arithmetic by one, disp16
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6f08
;;;     .word   0x6f08
;;;     .word   44
;;;     .word   44
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest-44 er0
        test_h_gr32  long_dest-44 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Lldisp161
        beq     .Lldisp161
        fail
        fail
.Lldisp161:
.Lldisp161:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_disp32_1:
shar_l_disp32_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest-666, er0
        mov     #long_dest-666, er0
        shar.l  @(666:32, er0)  ; shift right arithmetic by one, disp32
        shar.l  @(666:32, er0)  ; shift right arithmetic by one, disp32
;;;     .word   0x7884
;;;     .word   0x7884
;;;     .word   0x6b28
;;;     .word   0x6b28
;;;     .long   666
;;;     .long   666
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest-666 er0
        test_h_gr32  long_dest-666 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Lldisp321
        beq     .Lldisp321
        fail
        fail
.Lldisp321:
.Lldisp321:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_abs16_1:
shar_l_abs16_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.l  @long_dest:16   ; shift right arithmetic by one, abs16
        shar.l  @long_dest:16   ; shift right arithmetic by one, abs16
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6b08
;;;     .word   0x6b08
;;;     .word   long_dest
;;;     .word   long_dest
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 1
        test_gr_a5a5 1
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Llabs161
        beq     .Llabs161
        fail
        fail
.Llabs161:
.Llabs161:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_abs32_1:
shar_l_abs32_1:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.l  @long_dest:32   ; shift right arithmetic by one, abs32
        shar.l  @long_dest:32   ; shift right arithmetic by one, abs32
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6b28
;;;     .word   0x6b28
;;;     .long   long_dest
;;;     .long   long_dest
;;;     .word   0x11b0
;;;     .word   0x11b0
 
 
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_carry_set          ; H=0 N=1 Z=0 V=0 C=1
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 1
        test_gr_a5a5 1
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        ;; -> 1101 0010 1101 0010 1101 0010 1101 0010
        cmp.l   #0xd2d2d2d2, @long_dest
        cmp.l   #0xd2d2d2d2, @long_dest
        beq     .Llabs321
        beq     .Llabs321
        fail
        fail
.Llabs321:
.Llabs321:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
.endif
.endif
 
 
shar_l_reg32_2:
shar_l_reg32_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.l  #2, er0         ; shift right arithmetic by two, register
        shar.l  #2, er0         ; shift right arithmetic by two, register
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear        ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear        ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ; -> 1110 1001 0110 1001 0110 1001 0110 1001
        test_h_gr32  0xe9696969 er0
        test_h_gr32  0xe9696969 er0
 
 
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
 
 
.if (sim_cpu == h8sx)
.if (sim_cpu == h8sx)
 
 
shar_l_ind_2:
shar_l_ind_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest, er0
        mov     #long_dest, er0
        shar.l  #2, @er0        ; shift right arithmetic by two, indirect
        shar.l  #2, @er0        ; shift right arithmetic by two, indirect
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6908
;;;     .word   0x6908
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest er0
        test_h_gr32  long_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Llind2
        beq     .Llind2
        fail
        fail
.Llind2:
.Llind2:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_postinc_2:
shar_l_postinc_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest, er0
        mov     #long_dest, er0
        shar.l  #2, @er0+       ; shift right arithmetic by two, postinc
        shar.l  #2, @er0+       ; shift right arithmetic by two, postinc
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest+4 er0
        test_h_gr32  long_dest+4 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Llpostinc2
        beq     .Llpostinc2
        fail
        fail
.Llpostinc2:
.Llpostinc2:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_postdec_2:
shar_l_postdec_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest, er0
        mov     #long_dest, er0
        shar.l  #2, @er0-       ; shift right arithmetic by two, postdec
        shar.l  #2, @er0-       ; shift right arithmetic by two, postdec
;;;     .word   0x0106
;;;     .word   0x0106
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest-4 er0
        test_h_gr32  long_dest-4 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Llpostdec2
        beq     .Llpostdec2
        fail
        fail
.Llpostdec2:
.Llpostdec2:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_preinc_2:
shar_l_preinc_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest-4, er0
        mov     #long_dest-4, er0
        shar.l  #2, @+er0       ; shift right arithmetic by two, preinc
        shar.l  #2, @+er0       ; shift right arithmetic by two, preinc
;;;     .word   0x0105
;;;     .word   0x0105
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest er0
        test_h_gr32  long_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Llpreinc2
        beq     .Llpreinc2
        fail
        fail
.Llpreinc2:
.Llpreinc2:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_predec_2:
shar_l_predec_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest+4, er0
        mov     #long_dest+4, er0
        shar.l  #2, @-er0       ; shift right arithmetic by two, predec
        shar.l  #2, @-er0       ; shift right arithmetic by two, predec
;;;     .word   0x0107
;;;     .word   0x0107
;;;     .word   0x6d08
;;;     .word   0x6d08
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest er0
        test_h_gr32  long_dest er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Llpredec2
        beq     .Llpredec2
        fail
        fail
.Llpredec2:
.Llpredec2:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_disp2_2:
shar_l_disp2_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest-8, er0
        mov     #long_dest-8, er0
        shar.l  #2, @(8:2, er0) ; shift right arithmetic by two, disp2
        shar.l  #2, @(8:2, er0) ; shift right arithmetic by two, disp2
;;;     .word   0x0106
;;;     .word   0x0106
;;;     .word   0x6908
;;;     .word   0x6908
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest-8 er0
        test_h_gr32  long_dest-8 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Lldisp22
        beq     .Lldisp22
        fail
        fail
.Lldisp22:
.Lldisp22:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_disp16_2:
shar_l_disp16_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest-44, er0
        mov     #long_dest-44, er0
        shar.l  #2, @(44:16, er0)       ; shift right arithmetic by two, disp16
        shar.l  #2, @(44:16, er0)       ; shift right arithmetic by two, disp16
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6f08
;;;     .word   0x6f08
;;;     .word   44
;;;     .word   44
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest-44 er0
        test_h_gr32  long_dest-44 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Lldisp162
        beq     .Lldisp162
        fail
        fail
.Lldisp162:
.Lldisp162:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_disp32_2:
shar_l_disp32_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        mov     #long_dest-666, er0
        mov     #long_dest-666, er0
        shar.l  #2, @(666:32, er0)      ; shift right arithmetic by two, disp32
        shar.l  #2, @(666:32, er0)      ; shift right arithmetic by two, disp32
;;;     .word   0x7884
;;;     .word   0x7884
;;;     .word   0x6b28
;;;     .word   0x6b28
;;;     .long   666
;;;     .long   666
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_h_gr32  long_dest-666 er0
        test_h_gr32  long_dest-666 er0
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 1          ; Make sure other general regs not disturbed
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Lldisp322
        beq     .Lldisp322
        fail
        fail
.Lldisp322:
.Lldisp322:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_abs16_2:
shar_l_abs16_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.l  #2, @long_dest:16       ; shift right arithmetic by two, abs16
        shar.l  #2, @long_dest:16       ; shift right arithmetic by two, abs16
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6b08
;;;     .word   0x6b08
;;;     .word   long_dest
;;;     .word   long_dest
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 1
        test_gr_a5a5 1
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Llabs162
        beq     .Llabs162
        fail
        fail
.Llabs162:
.Llabs162:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
shar_l_abs32_2:
shar_l_abs32_2:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        set_ccr_zero
        set_ccr_zero
 
 
        shar.l  #2, @long_dest:32       ; shift right arithmetic by two, abs32
        shar.l  #2, @long_dest:32       ; shift right arithmetic by two, abs32
;;;     .word   0x0104
;;;     .word   0x0104
;;;     .word   0x6b28
;;;     .word   0x6b28
;;;     .long   long_dest
;;;     .long   long_dest
;;;     .word   0x11f0
;;;     .word   0x11f0
 
 
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_carry_clear                ; H=0 N=1 Z=0 V=0 C=0
        test_zero_clear
        test_zero_clear
        test_ovf_clear
        test_ovf_clear
        test_neg_set
        test_neg_set
 
 
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 0           ; Make sure ALL general regs not disturbed
        test_gr_a5a5 1
        test_gr_a5a5 1
        test_gr_a5a5 2
        test_gr_a5a5 2
        test_gr_a5a5 3
        test_gr_a5a5 3
        test_gr_a5a5 4
        test_gr_a5a5 4
        test_gr_a5a5 5
        test_gr_a5a5 5
        test_gr_a5a5 6
        test_gr_a5a5 6
        test_gr_a5a5 7
        test_gr_a5a5 7
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ; 1010 0101 1010 0101 1010 0101 1010 0101
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        ;; -> 1110 1001 0110 1001 0110 1001 0110 1001
        cmp.l   #0xe9696969, @long_dest
        cmp.l   #0xe9696969, @long_dest
        beq     .Llabs322
        beq     .Llabs322
        fail
        fail
.Llabs322:
.Llabs322:
        mov     #0xa5a5a5a5, @long_dest
        mov     #0xa5a5a5a5, @long_dest
 
 
.endif
.endif
.endif
.endif
        pass
        pass
 
 
        exit 0
        exit 0
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.