NAME=arc: [B]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
e cfg.bigendian=false
s 0x40
wx 00e80320
ao~jump
EOF
EXPECT=<<EOF
jump: 0x00001f84
EOF
RUN

NAME=arcompact: [Bcc]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 2a000300
ao~type,jump,fail,delay,cond
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x0000006a
fail: 0x00000044
cond: pl
EOF
RUN

NAME=arcompact: [Bcc.D]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 2a002300
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x0000006a
fail: 0x00000044
delay: 1
EOF
RUN

NAME=arcompact: [B]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 57048091
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: jmp
jump: 0x00123496
fail: 0x00000044
EOF
RUN

NAME=arcompact: [B.D]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 5704a091
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: jmp
jump: 0x00123496
fail: 0x00000044
delay: 1
EOF
RUN

NAME=arcompact: [BRcc limm,reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 410e4271 65872143
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x00000080
fail: 0x00000048
EOF
RUN

NAME=arcompact: [BRcc.D limm,reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 410e6271 65872143
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x00000080
fail: 0x00000048
delay: 1
EOF
RUN

NAME=arcompact: [BRcc limm,reg] Cond Code and imm val
FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx 410e4271 65872143 @ 0x0
ao~cond
ao~val
EOF
EXPECT=<<EOF
cond: lt
val: 0x87654321
EOF
RUN

NAME=arcompact: [BRcc reg,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 430ed371
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x00000082
fail: 0x00000044
EOF
RUN

NAME=arcompact: [BRcc.D reg,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 430ef371
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x00000082
fail: 0x00000044
delay: 1
EOF
RUN

NAME=arcompact: [BRcc reg,imm] Cond Code and imm val
FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx 430ed371 @ 0x40
s 0x40
ao~cond
ao~val
EOF
EXPECT=<<EOF
cond: ge
val: 0x00000007
EOF
RUN

NAME=arcompact: [BLcc imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 00080404
ao~type,jump,fail,delay,cond
EOF
EXPECT=<<EOF
type: ccall
jump: 0x00008040
fail: 0x00000044
cond: mi
EOF
RUN

NAME=arcompact: [BLcc.D imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 00082404
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: ccall
jump: 0x00008040
fail: 0x00000044
delay: 1
EOF
RUN

NAME=arcompact: [BL imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx 02080001 @ 0x40
s 0x40
ao~type
ao~jump
ao~fail
EOF
EXPECT=<<EOF
type: call
jump: 0x00002040
fail: 0x00000044
EOF
RUN

NAME=arcompact: [LDw reg,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx 08170071 @ 0x40
s 0x40
ao~type
ao~ptr
EOF
EXPECT=<<EOF
type: load
ptr: 0x00000048
refptr: 2
EOF
RUN

NAME=arcompact: [LD limm,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx 08160070 34127856 @ 0x40
s 0x40
ao~type
ao~ptr
EOF
EXPECT=<<EOF
type: load
ptr: 0x12345680
refptr: 4
EOF
RUN

NAME=arcompact: [ST reg,limm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx 001e0070 00aa5500 @ 0x40
s 0x40
ao~type
ao~ptr
EOF
EXPECT=<<EOF
type: store
ptr: 0xaa000055
refptr: 4
EOF
RUN

NAME=arcompact: [ST limm,reg+imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx 0418801f 00aa5500 @ 0x40
s 0x40
ao~type
ao~val
EOF
EXPECT=<<EOF
type: store
val: 0xaa000055
EOF
RUN

NAME=arcompact: [ST reg,PCL+imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx f21fc0f0 @ 0x40
s 0x40
ao~type
ao~ptr
EOF
EXPECT=<<EOF
type: store
ptr: 0x00000032
refptr: 4
EOF
RUN

NAME=arcompact: [J blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 2020c007
ao~type,delay
EOF
EXPECT=<<EOF
type: ret
EOF
RUN

NAME=arcompact: [J imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 60200004
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: jmp
jump: 0x00000010
fail: 0x00000044
EOF
RUN

NAME=arcompact: [J.D imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 61200004
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: jmp
jump: 0x00000010
fail: 0x00000044
delay: 1
EOF
RUN

NAME=arcompact: [J reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 20208000
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: ujmp
EOF
RUN

NAME=arcompact: [J limm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 2020800f 34127856
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: jmp
jump: 0x12345678
fail: 0x00000048
EOF
RUN

NAME=arcompact: [Jcc reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e0208700
ao~type,jump,fail,cond
EOF
EXPECT=<<EOF
type: ucjmp
cond: vs
EOF
RUN

NAME=arcompact: [Jcc limm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e020840f 34127856
ao~type,fail,cond
EOF
EXPECT=<<EOF
type: cjmp
fail: 0x00000044
cond: mi
EOF
RUN

NAME=arcompact: [Jcc limm] limm val
FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e020840f 34127856
ao~jump
EOF
EXPECT=<<EOF
jump: 0x12345678
EOF
RUN

NAME=arcompact: [Jcc blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e020c207
ao~type,cond
EOF
EXPECT=<<EOF
type: cret
cond: ne
EOF
RUN

NAME=arcompact: [JL imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 62200004
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: call
jump: 0x00000010
fail: 0x00000044
EOF
RUN

NAME=arcompact: [JL.D imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 63200004
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: call
jump: 0x00000010
fail: 0x00000044
delay: 1
EOF
RUN

NAME=arcompact: [JLcc imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e2202804
ao~type,jump,fail,cond,delay
EOF
EXPECT=<<EOF
type: ccall
jump: 0x00000010
fail: 0x00000044
cond: vc
EOF
RUN

NAME=arcompact: [MOV imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 8a270001
ao~val,type
EOF
EXPECT=<<EOF
val: 0x00000004
type: mov
EOF
RUN

NAME=arcompact: [MOV.cc imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx ca272901
ao~val,type,cond
EOF
EXPECT=<<EOF
val: 0x00000004
type: cmov
cond: gt
EOF
RUN

NAME=arcompact: [LP]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx a8200004
ao~type,jump,fail
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x00000060
fail: 0x00000044
EOF
RUN

NAME=arcompact: [LPcc]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e8202a04
ao~type,jump,fail,cond
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x00000060
fail: 0x00000044
cond: ge
EOF
RUN

NAME=arcompact: [SUB_S.NE reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx c079
ao~type
EOF
EXPECT=<<EOF
type: sub
EOF
RUN

NAME=arcompact: [SUB_S.NE reg] Cond Code
FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx c079
ao~cond
EOF
EXPECT=<<EOF
cond: ne
EOF
RUN

NAME=arcompact: [J_S reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 0079
ao~type,delay
EOF
EXPECT=<<EOF
type: ujmp
EOF
RUN

NAME=arcompact: [J_S.D reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 2079
ao~type,delay
EOF
EXPECT=<<EOF
type: ujmp
delay: 1
EOF
RUN

NAME=arcompact: [JEQ_S blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e07c
ao~type,cond,delay
EOF
EXPECT=<<EOF
type: cret
cond: eq
EOF
RUN

NAME=arcompact: [JNE_S blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e07d
ao~type,cond,delay
EOF
EXPECT=<<EOF
type: cret
cond: ne
EOF
RUN

NAME=arcompact: [J_S blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e07e
ao~type,delay
EOF
EXPECT=<<EOF
type: ret
EOF
RUN

NAME=arcompact: [J_S.D blink]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx e07f
ao~type,delay
EOF
EXPECT=<<EOF
type: ret
delay: 1
EOF
RUN

NAME=arcompact: [JL_S reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 4079
ao~type,delay
EOF
EXPECT=<<EOF
type: ucall
EOF
RUN

NAME=arcompact: [JL_S.D reg]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 6079
ao~type,delay
EOF
EXPECT=<<EOF
type: ucall
delay: 1
EOF
RUN

NAME=arcompact: [BREQ_S reg,0,imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 04ea
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x00000048
fail: 0x00000042
EOF
RUN

NAME=arcompact: [B_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 06f0
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: jmp
jump: 0x0000004c
fail: 0x00000042
EOF
RUN

NAME=arcompact: [BEQ_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 06f2
ao~type,jump,fail,cond,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x0000004c
fail: 0x00000042
cond: eq
EOF
RUN

NAME=arcompact: [BNE_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 06f4
ao~type,jump,fail,cond,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x0000004c
fail: 0x00000042
cond: ne
EOF
RUN

NAME=arcompact: [Bcc_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 06f6
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: cjmp
jump: 0x0000004c
fail: 0x00000042
EOF
RUN

NAME=arcompact: [Bcc_S imm] Cond Code
FILE=malloc://512
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 06f6
ao~cond
EOF
EXPECT=<<EOF
cond: gt
EOF
RUN

NAME=arcompact: [BL_S imm]
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
s 0x40
wx 10f8
ao~type,jump,fail,delay
EOF
EXPECT=<<EOF
type: call
jump: 0x00000080
fail: 0x00000042
EOF
RUN

NAME=arcompact: [BL]] - jump check
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx a60fcfff @ 0x160
s 0x160
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x00000104
EOF
RUN

NAME=arcompact: [LPNZ] - jump check
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx e820a201 @ 0x138
s 0x138
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x00000144
EOF
RUN

NAME=ARCompact ISA instruction length
FILE=malloc://512
CMDS=<<EOF
e asm.arch=arc
e asm.bits=16
wx 0a22803f00002839 @ 0
wx cf7200003439 @ 8
wx 422bbc80 @ 8+6
wx 00db @ 8+6+4
ao 4~size
EOF
EXPECT=<<EOF
size: 8
size: 6
size: 4
size: 2
EOF
RUN

NAME=arc4: [B.D] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx 20040020 @ 0x207c
s 0x207c
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x000020a0
EOF
RUN

NAME=arc4: [BNZ.D] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx 22030020 @ 0x2100
s 0x2100
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x0000211c
EOF
RUN

NAME=arc4: [BNZ.JD] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx c2100020 @ 0x1f68
s 0x1f68
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x00001ff0
EOF
RUN

NAME=arc4: [BGT] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx 89040020 @ 0x1b18
s 0x1b18
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x00001b40
EOF
RUN

NAME=arc4: [BL.D] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx a0270228 @ 0x208c
s 0x208c
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x000031cc
EOF
RUN

NAME=arc4: [BLHI] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx ad130628 @ 0x1148
s 0x1148
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x000041e8
EOF
RUN

NAME=arc4: [LP] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx 00020030 @ 0x1558
s 0x1558
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x0000156c
EOF
RUN

NAME=arc4: [LPNZ] - jump check
FILE=malloc://16384
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx 02020030 @ 0x1580
s 0x1580
ao 1~jump
EOF
EXPECT=<<EOF
jump: 0x00001594
EOF
RUN

NAME=ARC4 ISA instruction length
FILE=malloc://64
BROKEN=1
CMDS=<<EOF
e asm.arch=arc
e asm.bits=32
wx 017e1f102f420401 @ 0
wx 0afe5f60 @ 8
ao 2~size
EOF
EXPECT=<<EOF
size: 8
size: 4
EOF
RUN
