* addb.s: Add special case reg,<@reg+ / @reg- / @+reg / @-reg>.
* andb.s: Likewise.
* cmpb.s: Likewise.
* orb.s: Likewise.
* subb.s: Likewise.
* xorb.s: Likewise.
* movb.s: Add special case reg,<@reg+ / @reg- / @+reg / @-reg>
          @reg+,@reg+ / @-reg,@-reg.
* movw.s: Likewise.
* movl.s: Likewise.
+2021-05-28  Yoshinori Sato  <ysato@users.sourceforge.jp>
+
+       * addb.s: Add special case reg,<@reg+ / @reg- / @+reg / @-reg>.
+       * andb.s: Likewise.
+       * cmpb.s: Likewise.
+       * orb.s: Likewise.
+       * subb.s: Likewise.
+       * xorb.s: Likewise.
+       * movb.s: Add special case reg,<@reg+ / @reg- / @+reg / @-reg>
+                 @reg+,@reg+ / @-reg,@-reg.
+       @ movw.s: Likewise.
+       @ movl.s: Likewise.
+
 2021-05-04  Yoshinori Sato  <ysato@users.sourceforge.jp>
 
        * movb.s: Add special case predec test.
 
 post_byte:     .byte 0
 
        start
-       
+
 add_b_imm8_reg:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        ;;  fixme set ccr
        beq     .L12
        fail
 .L12:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   @er0, r1h
+       mov.b   r0l, r1l
+       add.b   r0l, @er0+
+       inc.b   r1l
+       add.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L22
+       fail
+.L22:
+       ;; restore previous value
+       mov.b   r1h, @byte_dest
 
 add_b_reg8_rdpostdec:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        beq     .L13
        fail
 .L13:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   @er0, r1h
+       mov.b   r0l, r1l
+       add.b   r0l, @er0-
+       dec.b   r1l
+       add.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L23
+       fail
+.L23:
+       ;; restore previous value
+       mov.b   r1h, @byte_dest
 
 add_b_reg8_rdpreinc:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        beq     .L14
        fail
 .L14:
+       ;; special case same register
+       mov.b   @byte_dest, r1h
+       mov.l   #pre_byte, er0
+       mov.b   r0l, r1l
+       add.b   r0l, @+er0
+       inc.b   r1l
+       add.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L24
+       fail
+.L24:
+       ;; restore previous value
+       mov.b   r1h, @byte_dest
 
 add_b_reg8_rdpredec:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        beq     .L15
        fail
 .L15:
+       ;; special case same register
+       mov.l   #post_byte, er0
+       mov.b   @byte_dest, r1h
+       mov.b   r0l, r1l
+       add.b   r0l, @-er0
+       dec.b   r1l
+       add.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L25
+       fail
+.L25:
+       ;; restore previous value
+       mov.b   r1h, @byte_dest
 
 add_b_reg8_disp16:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
 
        beq     .L2
        fail
 .L2:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   @er0, r1h
+       mov.b   r0l, r1l
+       and.b   r0l, @er0+
+       inc.b   r1l
+       and.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L22
+       fail
+.L22:
 
 and_b_imm8_rdpostdec:
        mov     #byte_dest, er0
        beq     .L3
        fail
 .L3:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   @er0, r1h
+       mov.b   r0l, r1l
+       and.b   r0l, @er0-
+       dec.b   r1l
+       and.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L23
+       fail
+.L23:
 
 and_b_imm8_rdpreinc:
        mov     #byte_dest, er0
        beq     .L4
        fail
 .L4:
+       ;; special case same register
+       mov.l   #pre_byte, er0
+       mov.b   @byte_dest, r1h
+       mov.b   r0l, r1l
+       and.b   r0l, @+er0
+       inc.b   r1l
+       and.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L24
+       fail
+.L24:
 
 and_b_imm8_rdpredec:
        mov     #byte_dest, er0
        beq     .L5
        fail
 .L5:
+       ;; special case same register
+       mov.l   #post_byte, er0
+       mov.b   @byte_dest, r1h
+       mov.b   r0l, r1l
+       and.b   r0l, @-er0
+       dec.b   r1l
+       and.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L25
+       fail
+.L25:
 
 .endif                         ; h8sx
 
 
        beq     .L9
        fail
 .L9:
+       ;; special case same register
+       mov.l   #byte_dst, er0
+       mov.b   @er0, r1h
+       mov.b   r0l, r1l
+       inc.b   r1l
+       mov.b   r1l,@er0
+       cmp.b   r0l,@er0+
+       beq     .L19
+       fail
+.L19:
+       mov.b   r1h, @byte_dst
 
 cmp_b_reg8_rdpostdec:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        beq     .L10
        fail
 .L10:
+       ;; special case same register
+       mov.l   #byte_dst, er0
+       mov.b   @er0, r1h
+       mov.b   r0l, r1l
+       dec.b   r1l
+       mov.b   r1l,@er0
+       cmp.b   r0l,@er0-
+       beq     .L20
+       fail
+.L20:
+       mov.b   r1h, @byte_dst
 
 cmp_b_reg8_rdpreinc:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        beq     .L11
        fail
 .L11:
+       ;; special case same register
+       mov.l   #pre_byte, er0
+       mov.b   @byte_dst, r1h
+       mov.b   r0l, r1l
+       inc.b   r1l
+       mov.b   r1l,@(1,er0)
+       cmp.b   r0l,@+er0
+       beq     .L21
+       fail
+.L21:
+       mov.b   r1h, @byte_dst
 
 cmp_b_reg8_rdpredec:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        beq     .L12
        fail
 .L12:
+       ;; special case same register
+       mov.l   #post_byte, er0
+       mov.b   @byte_dst, r1h
+       mov.b   r0l, r1l
+       dec.b   r1l
+       mov.b   r1l,@(-1,er0)
+       cmp.b   r0l,@-er0
+       beq     .L22
+       fail
+.L22:
+       mov.b   r1h, @byte_dst
 
 cmp_b_rsind_rdind:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
 
 
        .data
        .align  4
+byte_dst_dec:
+       .byte   0
 byte_src:
        .byte   0x77
 byte_dst:
        beq     .Lnext49
        fail
 .Lnext49:
+       ;; special case same register
+       mov.l   #byte_dst, er0
+       mov.b   r0l, r1l
+       inc.b   r1l
+       mov.b   r0l, @er0+
+       mov.b   @byte_dst, r0l
+       cmp.b   r0l, r1l
+       beq     .Lnext53
+       fail
+.Lnext53:
        mov.b   #0, @byte_dst   ; zero it again for the next use.
 
 mov_b_reg8_to_postdec:         ; post-decrement from register to mem
        beq     .Lnext50
        fail
 .Lnext50:
+       ;; special case same register
+       mov.l   #byte_dst, er0
+       mov.b   r0l, r1l
+       dec.b   r1l
+       mov.b   r0l, @er0-
+       mov.b   @byte_dst, r0l
+       cmp.b   r0l, r1l
+       beq     .Lnext54
+       fail
+.Lnext54:
        mov.b   #0, @byte_dst   ; zero it again for the next use.
 
 mov_b_reg8_to_preinc:          ; pre-increment from register to mem
        beq     .Lnext51
        fail
 .Lnext51:
+       ;; special case same register
+       mov.l   #byte_dst-1, er0
+       mov.b   r0l, r1l
+       inc.b   r1l
+       mov.b   r0l, @+er0
+       mov.b   @byte_dst, r0l
+       cmp.b   r0l, r1l
+       beq     .Lnext55
+       fail
+.Lnext55:
        mov.b   #0, @byte_dst   ; zero it again for the next use.
 .endif
 
        ;; CCR confirmation omitted
        mov.l   #byte_dst+1, er1
        mov.l   er1, er0
+       dec.b   r1l
        mov.b   r0l, @-er0
        mov.b   @byte_dst, r0l
        cmp.b   r1l, r0l
 
        ;; Now check the result of the move to memory.
        cmp.b   @byte_src, @byte_dst
-       beq     .Lnext55
+       beq     .Lnext56
        fail
-.Lnext55:
+.Lnext56:
        ;; Now clear the destination location, and verify that.
        mov.b   #0, @byte_dst
        cmp.b   @byte_src, @byte_dst
-       bne     .Lnext56
+       bne     .Lnext57
        fail
-.Lnext56:                      ; OK, pass on.
+.Lnext57:                      ; OK, pass on.
 
 mov_b_postinc_to_postinc:      ; reg post-increment, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext66
        fail
 .Lnext66:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #byte_src, er0
+       mov.b   @er0+, @er0+    ; copying byte_src to byte_dst
+       test_h_gr32  byte_src+2 er0
+       cmp.b   @byte_src, @byte_dst
+       beq     .Lnext67
+       fail
+.Lnext67:
+       ;; Now clear the destination location, and verify that.
+       mov.b   #0, @byte_dst
+       cmp.b   @byte_src, @byte_dst
+       bne     .Lnext68
+       fail
+.Lnext68:
 
 mov_b_postdec_to_postdec:      ; reg post-decrement, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext76
        fail
 .Lnext76:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #byte_src, er0
+       mov.b   @er0-, @er0-    ; copying byte_src to byte_dst_dec
+       test_h_gr32  byte_src-2 er0
+       cmp.b   @byte_src, @byte_dst_dec
+       beq     .Lnext77
+       fail
+.Lnext77:
+       ;; Now clear the destination location, and verify that.
+       mov.b   #0, @byte_dst_dec
+       cmp.b   @byte_src, @byte_dst_dec
+       bne     .Lnext78
+       fail
+.Lnext78:
 
 mov_b_preinc_to_preinc:                ; reg pre-increment, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext86
        fail
 .Lnext86:                              ; OK, pass on.
+       ;; special case same register
+       mov.l   #byte_src-1, er0
+       mov.b   @+er0, @+er0    ; copying byte_src to byte_dst
+       test_h_gr32  byte_src+1 er0
+       cmp.b   @byte_src, @byte_dst
+       beq     .Lnext87
+       fail
+.Lnext87:
+       ;; Now clear the destination location, and verify that.
+       mov.b   #0, @byte_dst
+       cmp.b   @byte_src, @byte_dst
+       bne     .Lnext88
+       fail
+.Lnext88:
 
 mov_b_predec_to_predec:                ; reg pre-decrement, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext96
        fail
 .Lnext96:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #byte_src+1, er0
+       mov.b   @-er0, @-er0    ; copying byte_src to byte_dst_dec
+       test_h_gr32  byte_src-1 er0
+       cmp.b   @byte_src, @byte_dst_dec
+       beq     .Lnext97
+       fail
+.Lnext97:
+       ;; Now clear the destination location, and verify that.
+       mov.b   #0, @byte_dst_dec
+       cmp.b   @byte_src, @byte_dst_dec
+       bne     .Lnext98
+       fail
+.Lnext98:
 
 mov_b_disp2_to_disp2:          ; reg 2-bit disp, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
 
 
        .data
        .align  4
+long_dst_dec:
+       .long   0
 long_src:
        .long   0x77777777
 long_dst:
        beq     .Lnext50
        fail
 .Lnext50:
+       ;; special case same register
+       mov.l   #long_dst, er0
+       mov.l   er0, er1
+       subs    #4, er1
+       mov.l   er0, @er0-
+       mov.l   @long_dst, er0
+       cmp.l   er0, er1
+       beq     .Lnext54
+       fail
+.Lnext54:
        mov.l   #0, @long_dst   ; zero it again for the next use.
 
 mov_l_reg32_to_preinc:         ; pre-increment from register to mem
        ;; CCR confirmation omitted
        mov.l   #long_dst+4, er1
        mov.l   er1, er0
+       subs    #4, er1
        mov.l   er0, @-er0
        mov.l   @long_dst, er0
        cmp.l   er1, er0
 
        ;; Now check the result of the move to memory.
        cmp.l   @long_src, @long_dst
-       beq     .Lnext55
+       beq     .Lnext56
        fail
-.Lnext55:
+.Lnext56:
        ;; Now clear the destination location, and verify that.
        mov.l   #0, @long_dst
        cmp.l   @long_src, @long_dst
-       bne     .Lnext56
+       bne     .Lnext57
        fail
-.Lnext56:                      ; OK, pass on.
+.Lnext57:                      ; OK, pass on.
 
 mov_l_postinc_to_postinc:      ; reg post-increment, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext66
        fail
 .Lnext66:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #long_src, er0
+       mov.l   @er0+, @er0+    ; copying long_src to long_dst
+       test_h_gr32  long_src+8 er0
+       cmp.b   @long_src, @long_dst
+       beq     .Lnext67
+       fail
+.Lnext67:
+       ;; Now clear the destination location, and verify that.
+       mov.l   #0, @long_dst
+       cmp.l   @long_src, @long_dst
+       bne     .Lnext68
+       fail
+.Lnext68:
 
 mov_l_postdec_to_postdec:      ; reg post-decrement, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext76
        fail
 .Lnext76:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #long_src, er0
+       mov.l   @er0-, @er0-    ; copying long_src to long_dst_dec
+       test_h_gr32  long_src-8 er0
+       cmp.l   @long_src, @long_dst_dec
+       beq     .Lnext77
+       fail
+.Lnext77:
+       ;; Now clear the destination location, and verify that.
+       mov.l   #0, @long_dst_dec
+       cmp.l   @long_src, @long_dst_dec
+       bne     .Lnext78
+       fail
+.Lnext78:
 
 mov_l_preinc_to_preinc:                ; reg pre-increment, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext86
        fail
 .Lnext86:                              ; OK, pass on.
+       ;; special case same register
+       mov.l   #long_src-4, er0
+       mov.l   @+er0, @+er0    ; copying long_src to long_dst
+       test_h_gr32  long_src+4 er0
+       cmp.b   @long_src, @long_dst
+       beq     .Lnext87
+       fail
+.Lnext87:
+       ;; Now clear the destination location, and verify that.
+       mov.b   #0, @long_dst
+       cmp.b   @long_src, @long_dst
+       bne     .Lnext88
+       fail
+.Lnext88:
 
 mov_l_predec_to_predec:                ; reg pre-decrement, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext96
        fail
 .Lnext96:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #long_src+4, er0
+       mov.l   @-er0, @-er0    ; copying long_src to long_dst_dec
+       test_h_gr32  long_src-4 er0
+       cmp.l   @long_src, @long_dst_dec
+       beq     .Lnext97
+       fail
+.Lnext97:
+       ;; Now clear the destination location, and verify that.
+       mov.l   #0, @long_dst_dec
+       cmp.l   @long_src, @long_dst_dec
+       bne     .Lnext98
+       fail
+.Lnext98:
 
 mov_l_disp2_to_disp2:          ; reg 2-bit disp, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
 
 
        .data
        .align  2
+word_dst_dec:
+       .word   0
 word_src:
        .word   0x7777
 word_dst:
        beq     .Lnext49
        fail
 .Lnext49:
+       ;; special case same register
+       mov.l   #word_dst, er0
+       mov.w   r0, r1
+       inc.w   #2,r1
+       mov.w   r0, @er0+
+       mov.w   @word_dst, r0
+       cmp.w   r0, r1
+       beq     .Lnext53
+       fail
+.Lnext53:
        mov.w   #0, @word_dst   ; zero it again for the next use.
 
 mov_w_reg16_to_postdec:                ; post-decrement from register to mem
        beq     .Lnext50
        fail
 .Lnext50:
+       ;; special case same register
+       mov.l   #word_dst, er0
+       mov.w   r0, r1
+       dec.w   #2, r1
+       mov.w   r0, @er0-
+       mov.w   @word_dst, r0
+       cmp.w   r0, r1
+       beq     .Lnext54
+       fail
+.Lnext54:
        mov.w   #0, @word_dst   ; zero it again for the next use.
 
 mov_w_reg16_to_preinc:         ; pre-increment from register to mem
        beq     .Lnext51
        fail
 .Lnext51:
+       ;; special case same register
+       mov.l   #word_dst-2, er0
+       mov.w   r0, r1
+       inc.w   #2, r1
+       mov.w   r0, @+er0
+       mov.w   @word_dst, r0
+       cmp.w   r0, r1
+       beq     .Lnext55
+       fail
+.Lnext55:
        mov.w   #0, @word_dst   ; zero it again for the next use.
 .endif
 
        ;; CCR confirmation omitted
        mov.l   #word_dst+2, er1
        mov.l   er1, er0
+       dec.w   #2, r1
        mov.w   r0, @-er0
        mov.w   @word_dst, r0
        cmp.w   r1, r0
 
        ;; Now check the result of the move to memory.
        cmp.w   @word_src, @word_dst
-       beq     .Lnext55
+       beq     .Lnext56
        fail
-.Lnext55:
+.Lnext56:
        ;; Now clear the destination location, and verify that.
        mov.w   #0, @word_dst
        cmp.w   @word_src, @word_dst
-       bne     .Lnext56
+       bne     .Lnext57
        fail
-.Lnext56:                      ; OK, pass on.
+.Lnext57:                      ; OK, pass on.
 
 mov_w_postinc_to_postinc:      ; reg post-increment, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext66
        fail
 .Lnext66:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #word_src, er0
+       mov.w   @er0+, @er0+    ; copying word_src to word_dst
+       test_h_gr32  word_src+4 er0
+       cmp.w   @word_src, @word_dst
+       beq     .Lnext67
+       fail
+.Lnext67:
+       ;; Now clear the destination location, and verify that.
+       mov.w   #0, @word_dst
+       cmp.b   @word_src, @word_dst
+       bne     .Lnext68
+       fail
+.Lnext68:
 
 mov_w_postdec_to_postdec:      ; reg post-decrement, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext76
        fail
 .Lnext76:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #word_src, er0
+       mov.w   @er0-, @er0-    ; copying word_src to word_dst_dec
+       test_h_gr32  word_src-4 er0
+       cmp.w   @word_src, @word_dst_dec
+       beq     .Lnext77
+       fail
+.Lnext77:
+       ;; Now clear the destination location, and verify that.
+       mov.w   #0, @word_dst_dec
+       cmp.w   @word_src, @word_dst_dec
+       bne     .Lnext78
+       fail
+.Lnext78:
 
 mov_w_preinc_to_preinc:                ; reg pre-increment, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext86
        fail
 .Lnext86:                              ; OK, pass on.
+       ;; special case same register
+       mov.l   #word_src-2, er0
+       mov.w   @+er0, @+er0    ; copying word_src to word_dst
+       test_h_gr32  word_src+2 er0
+       cmp.w   @word_src, @word_dst
+       beq     .Lnext87
+       fail
+.Lnext87:
+       ;; Now clear the destination location, and verify that.
+       mov.w   #0, @word_dst
+       cmp.w   @word_src, @word_dst
+       bne     .Lnext88
+       fail
+.Lnext88:
 
 mov_w_predec_to_predec:                ; reg pre-decrement, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        bne     .Lnext96
        fail
 .Lnext96:                      ; OK, pass on.
+       ;; special case same register
+       mov.l   #word_src+2, er0
+       mov.w   @-er0, @-er0    ; copying word_src to word_dst_dec
+       test_h_gr32  word_src-2 er0
+       cmp.w   @word_src, @word_dst_dec
+       beq     .Lnext97
+       fail
+.Lnext97:
+       ;; Now clear the destination location, and verify that.
+       mov.w   #0, @word_dst_dec
+       cmp.w   @word_src, @word_dst_dec
+       bne     .Lnext98
+       fail
+.Lnext98:
 
 mov_w_disp2_to_disp2:          ; reg 2-bit disp, memory to memory
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
 
        fail
 .L5:
 
-
 .endif
 
 or_b_reg8_reg8:
        beq     .L7
        fail
 .L7:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   r0l, r1l
+       mov.b   @er0, r1h
+       or.b    r0l, @er0+
+       inc.b   r1l
+       or.b    r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L27
+       fail
+.L27:
 
 or_b_reg8_rdpostdec:
        mov     #byte_dest, er0
        beq     .L8
        fail
 .L8:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   r0l, r1l
+       mov.b   @er0, r1h
+       or.b    r0l, @er0-
+       dec.b   r1l
+       or.b    r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L28
+       fail
+.L28:
 
 or_b_reg8_rdpreinc:
        mov     #byte_dest, er0
        beq     .L9
        fail
 .L9:
+       ;; special case same register
+       mov.l   #pre_byte, er0
+       mov.b   r0l, r1l
+       mov.b   @byte_dest, r1h
+       or.b    r0l, @+er0
+       inc.b   r1l
+       or.b    r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L29
+       fail
+.L29:
 
 or_b_reg8_rdpredec:
        mov     #byte_dest, er0
        beq     .L10
        fail
 .L10:
+       ;; special case same register
+       mov.l   #post_byte, er0
+       mov.b   r0l, r1l
+       mov.b   @byte_dest, r1h
+       or.b    r0l, @-er0
+       dec.b   r1l
+       or.b    r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L30
+       fail
+.L30:
 
 .endif
 
 
        beq     .L5
        fail
 .L5:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   @er0, r1h
+       mov.b   r1h, r2l
+       mov.b   r0l, r1l
+       sub.b   r0l, @er0+
+       inc.b   r1l
+       sub.b   r1l, r1h
+       mov.b   @byte_dest, r0l
+       cmp.b   r1h, r0l
+       beq     .L25
+       fail
+.L25:
+       mov.b   r2l, @byte_dest
 
 sub_b_reg8_rdpostdec:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        beq     .L6
        fail
 .L6:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   @er0, r1h
+       mov.b   r0l, r1l
+       sub.b   r0l, @er0-
+       dec.b   r1l
+       sub.b   r1l, r1h
+       mov.b   @byte_dest, r0l
+       cmp.b   r1h, r0l
+       beq     .L26
+       fail
+.L26:
 
 .endif
 
 
        beq     .L3
        fail
 .L3:
-
-
 .endif
 
 xor_b_reg8_reg8:
        beq     .L5
        fail
 .L5:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   r0l, r1l
+       mov.b   @er0, r1h
+       xor.b   r0l, @er0+
+       inc.b   r1l
+       xor.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L25
+       fail
+.L25:
+       mov.b   r1h, @byte_dest
 
 xor_b_reg8_rdpostdec:
        set_grs_a5a5            ; Fill all general regs with a fixed pattern
        beq     .L6
        fail
 .L6:
+       ;; special case same register
+       mov.l   #byte_dest, er0
+       mov.b   r0l, r1l
+       mov.b   @er0, r1h
+       xor.b   r0l, @er0-
+       dec.b   r1l
+       xor.b   r1h, r1l
+       mov.b   @byte_dest, r0l
+       cmp.b   r1l, r0l
+       beq     .L26
+       fail
+.L26:
 
 .endif                         ; h8sx