NAME=add Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr r1=0xF2
dr r2=0x2
wx 0x312C
aes
dr? r1
EOF
EXPECT=<<EOF
0x000000f4
EOF
RUN

NAME=add #imm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr r1=0xF2
wx 0x712C
aes
dr? r1

aeip
dr r1=0xF2
wx 0x71FE
aes
dr? r1
EOF
EXPECT=<<EOF
0x0000011e
0x000000f0
EOF
RUN

NAME=addc Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr r2=0xF2
dr r3=0x4
dr sr=1
wx 0x323E
aes
dr? r2
dr? r3
dr? sr

aeip
dr r2=0xFFFF0000
dr r3=0x10000000
dr sr=0
wx 0x323E
aes
dr? r2
dr? sr

aeip
dr r2=0xFFFF0000
dr r3=0x0000FFFF
dr sr=1
wx 0x323E
aes
dr? r2
dr? sr
EOF
EXPECT=<<EOF
0x000000f7
0x00000004
0x00000000
0x0fff0000
0x00000001
0x00000000
0x00000001
EOF
RUN

NAME=addv Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr r2=0xF2
dr r3=0x4
dr sr=1
wx 0x323F
aes
dr? r2
dr? sr

aeip
dr r2=0x8FFF0000
dr r3=0x800A0000
dr sr=0
wx 0x323F
aes
dr? r2
dr? sr

aeip
dr r2=0x4FFF0000
dr r3=0x6F0F0000
dr sr=0
wx 0x323F
aes
dr? r2
dr? sr
EOF
EXPECT=<<EOF
0x000000f6
0x00000000
0x10090000
0x00000001
0xbf0e0000
0x00000001
EOF
RUN

NAME=and Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr r1=0x123456F3
dr r2=0xcada4532
wx 0x2129
aes
dr? r1
EOF
EXPECT=<<EOF
0x02104432
EOF
RUN

NAME=and #imm,@(R0+GBR)
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr r0=0x15
dr gbr=0x10
wx 0xcd26
s 0x24
wx 0x12345678
aes
s 0x24
px0 4
EOF
EXPECT=<<EOF
12245678
EOF
RUN

NAME=BF
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=0
s 0x10
aeip
wx 0x8b26
aes
dr? pc
s 0x10
aeip
wx 0x8bfc
aes
dr? pc
dr sr=1
s 0x10
aeip
aes
dr? pc
EOF
EXPECT=<<EOF
0x00000060
0x0000000c
0x00000012
EOF
RUN

NAME=BF/S
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=0
s 0x10
aeip
dr r1=0;
wx 0x8f26e102
aes
dr? pc
dr? r1
s 0x10
aeip
dr r1=0;
wx 0x8ffce102
aes
dr? pc
dr? r1
dr sr=1
s 0x10
aeip
aes
dr? pc
EOF
EXPECT=<<EOF
0x00000060
0x00000002
0x0000000c
0x00000002
0x00000012
EOF
RUN

NAME=BRA
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
s 0x10
aeip
dr r1=0
wx 0xa026e102
aes
dr? pc
dr? r1
s 0x10
aeip
dr r1=0
wx 0xaffce102
aes
dr? pc
dr? r1
EOF
EXPECT=<<EOF
0x00000060
0x00000002
0x0000000c
0x00000002
EOF
RUN

NAME=BRAF
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
s 0x10
aeip
dr r1=0
dr r2=0x4c
wx 0x0223e102
aes
dr? pc
dr? r1
EOF
EXPECT=<<EOF
0x00000060
0x00000002
EOF
RUN

NAME=BSR
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
s 0x10
aeip
dr r1=0
wx 0xb026e102
aes
dr? pc
dr? pr
dr? r1
EOF
EXPECT=<<EOF
0x00000060
0x00000014
0x00000002
EOF
RUN

NAME=BSRF
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
s 0x10
aeip
dr r1=0
dr r2=0x4c
wx 0x0203e102
aes
dr? pc
dr? pr
dr? r1
EOF
EXPECT=<<EOF
0x00000060
0x00000014
0x00000002
EOF
RUN

NAME=BT
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=1
s 0x10
aeip
wx 0x8926
aes
dr? pc
s 0x10
aeip
wx 0x89fc
aes
dr? pc
dr sr=0
s 0x10
aeip
aes
dr? pc
EOF
EXPECT=<<EOF
0x00000060
0x0000000c
0x00000012
EOF
RUN

NAME=BT/S
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=1
s 0x10
aeip
dr r1=0;
wx 0x8d26e102
aes
dr? pc
dr? r1
s 0x10
aeip
dr r1=0;
wx 0x8dfce102
aes
dr? pc
dr? r1
dr sr=0
s 0x10
aeip
aes
dr? pc
EOF
EXPECT=<<EOF
0x00000060
0x00000002
0x0000000c
0x00000002
0x00000012
EOF
RUN

NAME=CLRMAC
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr mach=0xa
dr macl=0xa
wx 0x0028
aes
dr? mach
dr? macl
EOF
EXPECT=<<EOF
0x00000000
0x00000000
EOF
RUN

NAME=CLRT
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=3
wx 0x0008
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000002
EOF
RUN

NAME=CMP/EQ Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=0
dr r1=0xa
dr r2=0xa
wx 0x3120
aes
dr? sr
s 0
aeip
dr sr=1
dr r1=0xa
dr r2=0xb
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000001
0x00000000
EOF
RUN

NAME=CMP/GE Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=1
dr r1=0xFFFFFFFF
dr r2=1
wx 0x3123
aes
dr? sr
s 0 
aeip
dr sr=0x0
dr r1=0x5
aes
dr? sr
s 0 
aeip
dr r1=0x1
dr sr=0
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000000
0x00000001
0x00000001
EOF
RUN

NAME=CMP/GT Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=1
dr r1=0xFFFFFFFF
dr r2=1
wx 0x3127
aes
dr? sr
s 0 
aeip
dr sr=0x0
dr r1=0x5
aes
dr? sr
s 0 
aeip
dr sr=0x1
dr r1=0x1
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000000
0x00000001
0x00000000
EOF
RUN

NAME=CMP/HI Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=0
dr r1=0xFFFFFFFF
dr r2=1
wx 0x3126
aes
dr? sr
s 0 
aeip
dr r2=0xFFFFFFFF
dr sr=0x1
dr r1=0x5
aes
dr? sr
s 0 
aeip
dr sr=0x1
dr r2=0x1
dr r1=0x1
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000001
0x00000000
0x00000000
EOF
RUN

NAME=CMP/HS Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=0
dr r1=0xFFFFFFFF
dr r2=1
wx 0x3122
aes
dr? sr
s 0 
aeip
dr sr=0x1
dr r2=0xFFFFFFFF
dr r1=0x5
aes
dr? sr
s 0 
aeip
dr sr=0x0
dr r2=0x1
dr r1=0x1
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000001
0x00000000
0x00000001
EOF
RUN

NAME=CMP/PL Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=1
dr r1=0xFFFFFFFF
wx 0x4115
aes
dr? sr
s 0 
aeip
dr r1=0x5
dr sr=0x0
aes
dr? sr
s 0 
aeip
dr r1=0x0
dr sr=0x1
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000000
0x00000001
0x00000000
EOF
RUN

NAME=CMP/PZ Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=1
dr r1=0xFFFFFFFF
wx 0x4111
aes
dr? sr
s 0 
aeip
dr r1=0x5
dr sr=0x0
aes
dr? sr
s 0 
aeip
dr r1=0x0
dr sr=0x1
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000000
0x00000001
0x00000001
EOF
RUN

NAME=CMP/STR Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x212C
dr sr=0
dr r1=0x01234567
dr r2=0x12344578
aes
dr? sr
s 0 
aeip
dr sr=1
dr r1=0x01234567
dr r2=0x12345678
aes
dr? sr
s 0 
aeip
dr sr=0
dr r1=0x01234567
dr r2=0x01235678
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000001
0x00000000
0x00000001
EOF
RUN

NAME=CMP/EQ #imm,R0
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x8816
dr sr=0
dr r0=0x16
aes
dr? sr
s 0 
aeip
wx 0x88FE
dr sr=0
dr r0=0xFFFFFFFE
aes
dr? sr
s 0 
aeip
wx 0x88FE
dr sr=1
dr r0=0xFFeFFFFE
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000001
0x00000001
0x00000000
EOF
RUN

NAME=DIV0S Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x2127
dr sr=0
dr r1=0xF0000000
dr r2=0xF0000000
aes
dr? sr
s 0
aeip
dr sr=0
dr r1=0xF0000000
dr r2=0x00000000
aes
dr? sr
s 0
aeip
dr sr=0
dr r1=0x00000000
dr r2=0xF0000000
aes
dr? sr
s 0
aeip
dr sr=0xffffffff
dr r1=0x5
dr r2=0x5
aes
dr? sr
EOF
EXPECT=<<EOF
0x00000300
0x00000101
0x00000201
0xfffffcfe
EOF
RUN

NAME=DIV0U
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x0019
dr sr=0xFFFFFFFF
aes
dr? sr
EOF
EXPECT=<<EOF
0xfffffcfe
EOF
RUN

NAME=DIV1
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x3124
dr sr=0x0
dr r1=02345678
dr r2=00120000
aes
dr? sr
dr? r1
EOF
EXPECT=<<EOF
0x00000001
0x0001d2ee
EOF
RUN

NAME=DMULS.W Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x312D
dr r1=0x12345678
dr r2=0x76543210
aes
dr? mach
dr? macl
s 0
aeip
dr r1=0xFFFFFF78
dr r2=0x00043210
aes
dr? mach
dr? macl
EOF
EXPECT=<<EOF
0x086a1c97
0x0b88d780
0xffffffff
0xfdc56780
EOF
RUN

NAME=DMULU.L Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x3125
dr r1=0x12345678
dr r2=0x76543210
aes
dr? mach
dr? macl
s 0
aeip
dr r1=0xFFFFFF78
dr r2=0x00043210
aes
dr? mach
dr? macl
EOF
EXPECT=<<EOF
0x086a1c97
0x0b88d780
0x0004320f
0xfdc56780
EOF
RUN

NAME=DT Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
dr sr=0xffffffff
wx 0x4110
dr r1=0x12345678
aes
dr? sr
s 0
aeip
dr sr=0
dr r1=0x1
aes
dr? sr
EOF
EXPECT=<<EOF
0xfffffffe
0x00000001
EOF
RUN

NAME=EXT.S Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x612e
dr r2=0x12345678
dr r1=0x00000123
aes
dr? r1
s 0
aeip
dr r2=0x12345688
dr r1=0x00000123
aes
dr? r1
EOF
EXPECT=<<EOF
0x00000078
0xffffff88
EOF
RUN

NAME=EXT.W Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x612f
dr r2=0x12345678
dr r1=0x00000123
aes
dr? r1
s 0
aeip
dr r2=0x12348688
dr r1=0x00000123
aes
dr? r1
EOF
EXPECT=<<EOF
0x00005678
0xffff8688
EOF
RUN

NAME=EXTU.B Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x612c
dr r2=0xffffff78
dr r1=0x00000123
aes
dr? r1
EOF
EXPECT=<<EOF
0x00000078
EOF
RUN

NAME=EXTU.W Rm,Rn
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x612d
dr r2=0xffffff78
dr r1=0x00000123
aes
dr? r1
EOF
EXPECT=<<EOF
0x0000ff78
EOF
RUN

NAME=JMP @Rm
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
s 0x10
aeip
wx 0x412be202
dr r2=0x5
dr r1=0x00000123
aes
dr? pc
dr? r2
EOF
EXPECT=<<EOF
0x00000122
0x00000002
EOF
RUN

NAME=JSR @Rm
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
s 0x10
aeip
wx 0x410be202
dr r2=0x5
dr pr=0x1
dr r1=0x00000123
aes
dr? pc
dr? r2
dr? pr
EOF
EXPECT=<<EOF
0x00000122
0x00000002
0x00000014
EOF
RUN

NAME=LDC Rm,SR
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x410e
dr sr=0x5
dr r1=0x12345
aes
dr? sr
EOF
EXPECT=<<EOF
0x00010345
EOF
RUN

NAME=LDC Rm,GBR
FILE=malloc://0x200
CMDS=<<EOF
e asm.arch=sh
e cfg.bigendian=true
aei
wx 0x411e
dr gbr=0x5
dr r1=0x12345
aes
dr? gbr
EOF
EXPECT=<<EOF
0x00012345
EOF
RUN
