Compiler projects using llvm
# RUN: llvm-mc --disassemble %s -triple=xcore-xmos-elf | FileCheck %s

# 0r instructions

# CHECK: clre
0xed 0x07

# CHECK: get r11, id
0xee 0x17

# CHECK: get r11, ed
0xfe 0x0f

# CHECK: get r11, et
0xff 0x0f

# CHECK: ssync
0xee 0x07

# CHECK: waiteu
0xec 0x07

# CHECK: dcall
0xfc 0x07

# CHECK: dentsp
0xec 0x17

# CHECK: drestsp
0xed 0x17

# CHECK: dret
0xfe 0x07

# CHECK: freet
0xef 0x07

# CHECK: get r11, kep
0xef 0x17

# CHECK: get r11, ksp
0xfc 0x17

# CHECK: kret
0xfd 0x07

# CHECK: ldw et, sp[4]
0xfe 0x17

# CHECK: ldw sed, sp[3]
0xfd 0x17

# CHECK: ldw spc, sp[1]
0xec 0x0f

# CHECK: ldw ssr, sp[2]
0xee 0x0f

# CHECK: set kep, r11
0xff 0x07

# CHECK: stw et, sp[4]
0xfd 0x0f

# CHECK: stw sed, sp[3]
0xfc 0x0f

# CHECK: stw spc, sp[1]
0xed 0x0f

# CHECK: stw ssr, sp[2]
0xef 0x0f

# 1r instructions

# CHECK: msync res[r0]
0xf0 0x1f

# CHECK: mjoin res[r1]
0xf1 0x17

# CHECK: bau r2
0xf2 0x27

# CHECK: set sp, r3
0xf3 0x2f

# CHECK: ecallt r4
0xf4 0x4f

# CHECK: ecallf r5
0xe5 0x4f

# CHECK: bla r6
0xe6 0x27

# CHECK: bru r8
0xe8 0x2f

# CHECK: syncr res[r7]
0xf7 0x87

# CHECK: freer res[r8]
0xe8 0x17

# CHECK: setv res[r9], r11
0xf9 0x47

# CHECK: setev res[r10], r11
0xfa 0x3f

# CHECK: eeu res[r11]
0xfb 0x07

# CHECK: set dp, r5
0xe5 0x37

# CHECK: set cp, r0
0xf0 0x37

# CHECK: dgetreg r11
0xeb 0x3f

# CHECK: edu res[r8]
0xe8 0x07

# CHECK: kcall r2
0xe2 0x47

# CHECK: waitef r10
0xfa 0x0f

# CHECK: waitet r7
0xe7 0x0f

# CHECK: start t[r4]
0xe4 0x1f

# CHECK: clrpt res[r9]
0xe9 0x87

# 2r instructions

# CHECK: not r1, r8
0x24 0x8f

# CHECK: neg r7, r6
0xce 0x97

# CHECK: andnot r10, r11
0xab 0x2f

# CHECK: mkmsk r11, r0
0x4c 0xa7

# CHECK: getts r8, res[r1]
0x41 0x3f

# CHECK: setpt res[r2], r3
0xde 0x3e

# CHECK: outct res[r1], r2
0xc6 0x4e

# CHECK: outt res[r5], r4
0xd1 0x0f

# CHECK: out res[r9], r10
0xa9 0xaf

# CHECK: outshr res[r0], r2
0xd8 0xae

# CHECK: inct r7, res[r4]
0xdc 0x87

# CHECK: int r8, res[r3]
0x53 0x8f

# CHECK: in r10, res[r0]
0x48 0xb7

# CHECK: inshr r4, res[r2]
0x12 0xb7

# CHECK: chkct res[r6], r0
0x08 0xcf

# CHECK: testct r8, res[r3]
0x53 0xbf

# CHECK: testwct r2, res[r9]
0x39 0xc7

# CHECK: setd res[r3], r4
0x13 0x17

# CHECK: getst r7, res[r1]
0x1d 0x07

# CHECK: init t[r1]:sp, r2
0xc9 0x16

# CHECK: init t[r10]:pc, r1
0x26 0x07

# CHECK: init t[r2]:cp, r10
0x4a 0x1f

# CHECK: init t[r2]:dp, r3
0xce 0x0e

# CHECK: setpsc res[r8], r2
0x28 0xc7

# CHECK: zext r3, r8
0x2c 0x47

# CHECK: sext r9, r1
0x45 0x37

# CHECK: tsetmr r7, r3
0x1f 0x1f

# CHECK: eef r1, res[r6]
0x96 0x2f

# CHECK: eet r11, res[r0]
0x5c 0x27

# rus instructions

# CHECK: chkct res[r1], 8
0x34 0xcf

# CHECK: getr r11, 2
0x4e 0x87

# CHECK: mkmsk r4, 24
0x72 0xa7

# CHECK: outct res[r3], 0
0xdc 0x4e

# CHECK: sext r8, 16
0xb1 0x37

# CHECK: zext r2, 32
0xd8 0x46

# CHECK: peek r0, res[r5]
0x81 0xbf

# CHECK: endin r10, res[r1]
0x59 0x97

# l2r instructions

# CHECK: bitrev r1, r10
0x26 0xff 0xec 0x07

# CHECK: byterev r4, r1
0x11 0xff 0xec 0x07

# CHECK: clz r11, r10
0xae 0xff 0xec 0x0f

# CHECK: get r3, ps[r6]
0x9e 0xff 0xec 0x17

# CHECK: setc res[r5], r9
0x75 0xff 0xec 0x2f

# CHECK: init t[r2]:lr, r1
0xc6 0xfe 0xec 0x17

# CHECK: setclk res[r2], r1
0xd6 0xfe 0xec 0x0f

# CHECK: set ps[r9], r10
0xa9 0xff 0xec 0x1f

# CHECK: setrdy res[r3], r1
0xc7 0xfe 0xec 0x2f

# CHECK: settw res[r7], r2
0x9b 0xff 0xec 0x27

# CHECK: getd r8, res[r3]
0x53 0xff 0xec 0x1f

# CHECK: getn r10, res[r11]
0xbb 0xff 0xec 0x37

# CHECK: testlcl r2, res[r0]
0xc8 0xfe 0xec 0x27

# CHECK: setn res[r9], r7
0x6d 0xff 0xec 0x37

# 3r instructions

# CHECK: add r1, r2, r3
0x1b 0x10

# CHECK: and r11, r10, r9
0xb9 0x3e

# CHECK: eq r6, r1, r2
0x66 0x30

# CHECK: ld16s r8, r3[r4]
0xcc 0x82

# CHECK: ld8u r9, r1[r10]
0x16 0x8d

# CHECK: ldw r9, r4[r5]
0x91 0x4b

# CHECK: lss r7, r3, r0
0x7c 0xc0

# CHECK: lsu r5, r8, r6
0x12 0xcc

# CHECK: or r1, r3, r2
0x1e 0x40

# CHECK: shl r8, r2, r4
0xc8 0x22

# CHECK: shr r9, r7, r1
0x5d 0x29

# CHECK: sub r4, r2, r5
0x89 0x1a

# CHECK: set t[r0]:r1, r2
0x18 0xb8

# 2rus instructions

# CHECK: add r10, r2, 5
0xe9 0x92

# CHECK: eq r2, r1, 0
0x24 0xb0

# CHECK: ldw r5, r6[1]
0x19 0x09

# CHECK: shl r6, r5, 24
0xa6 0xa5

# CHECK: shr r3, r8, 5
0xf1 0xab

# CHECK: stw r3, r2[0]
0x38 0x00

# CHECK: sub r2, r4, 11
0x63 0x9d

# l3r instructions

# CHECK: ashr r5, r1, r11
0xd7 0xfc 0xec 0x17

# CHECK: crc32 r5, r6, r1
0x19 0xf9 0xec 0xaf

# CHECK: divu r9, r1, r3
0x97 0xf8 0xec 0x4f

# CHECK: divs r6, r7, r2
0x2e 0xf9 0xec 0x47

# CHECK: lda16 r11, r2[r1]
0xb9 0xf8 0xec 0x2f

# CHECK: lda16 r9, r3[-r11]
0x1f 0xfd 0xec 0x37

# CHECK: ldaw r9, r1[r2]
0x96 0xf8 0xec 0x1f

# CHECK: ldaw r8, r7[-r11]
0xcf 0xfd 0xec 0x27

# CHECK: mul r0, r4, r2
0xc2 0xf8 0xec 0x3f

# CHECK: remu r1, r2, r3
0x1b 0xf8 0xec 0xcf

# CHECK: rems r11, r10, r9
0xb9 0xfe 0xec 0xc7

# CHECK: st16 r5, r3[r8]
0xdc 0xfc 0xec 0x87

# CHECK: st8 r9, r1[r3]
0x97 0xf8 0xec 0x8f

# CHECK: stw r7, r10[r1]
0xf9 0xf9 0xec 0x07

# CHECK: xor r4, r3, r9
0xcd 0xfc 0xec 0x0f

# l2rus instructions

# CHECK: ashr r5, r1, 3
0x57 0xf8 0xec 0x97

# CHECK: ldaw r11, r10[6]
0x7a 0xfc 0xec 0x9f

# CHECK: ldaw r8, r2[-9]
0x09 0xfd 0xec 0xa7

# CHECK: inpw r6, res[r1], 8
0xe4 0xfc 0xee 0x97

# CHECK: outpw res[r3], r0, 2
0x0e 0xf8 0xed 0x97

# ru6 / lru6 instructions

# CHECK: bt r6, -5
0x85 0x75

# CHECK: bt r10, -451
0x07 0xf0 0x83 0x76

# CHECK: bt r8, 10
0x0a 0x72

# CHECK: bt r1, 6451
0x64 0xf0 0x73 0x70

# CHECK: bf r5, 8
0x48 0x79

# CHECK: bf r6, 65
0x01 0xf0 0x81 0x79

# CHECK: bf r1, 53
0x75 0x78

# CHECK: bf r10, 101
0x01 0xf0 0xa5 0x7a

# CHECK: ldaw r11, dp[63]
0xff 0x62

# CHECK: ldaw r1, dp[456]
0x07 0xf0 0x48 0x60

# CHECK: ldaw cp, dp[5]
0x05 0x63

# CHECK: ldaw sp, dp[9929]
0x9b 0xf0 0x89 0x63

# CHECK: ldaw r3, sp[2]
0xc2 0x64

# CHECK: ldaw r8, sp[65535]
0xff 0xf3 0x3f 0x66

# CHECK: ldaw sp, sp[41]
0xa9 0x67

# CHECK: ldaw sp, sp[13121]
0xcd 0xf0 0x81 0x67

# CHECK: ldc r3, 30
0xde 0x68

# CHECK: ldc r11, 1000
0x0f 0xf0 0xe8 0x6a

# CHECK: ldc sp, 0
0x80 0x6b

# CHECK: ldc lr, 81
0x01 0xf0 0xd1 0x6b

# CHECK: ldw r0, cp[4]
0x04 0x6c

# CHECK: ldw r1, cp[32345]
0xf9 0xf1 0x59 0x6c

# CHECK: ldw cp, cp[8]
0x08 0x6f

# CHECK: ldw sp, cp[10222]
0x9f 0xf0 0xae 0x6f

# CHECK: ldw r10, dp[16]
0x90 0x5a

# CHECK: ldw r10, dp[76]
0x01 0xf0 0x8c 0x5a

# CHECK: ldw lr, dp[8]
0xc8 0x5b

# CHECK: ldw dp, dp[33221]
0x07 0xf2 0x45 0x5b

# CHECK: ldw r8, sp[51]
0x33 0x5e

# CHECK: ldw r8, sp[1225]
0x13 0xf0 0x09 0x5e

# CHECK: ldw cp, sp[31]
0x1f 0x5f

# CHECK: ldw sp, sp[1000]
0x0f 0xf0 0xa8 0x5f

# CHECK: setc res[r5], 36
0x64 0xe9

# CHECK: setc res[r2], 40312
0x75 0xf2 0xb8 0xe8

# CHECK: stw r8, dp[14]
0x0e 0x52

# CHECK: stw r9, dp[654]
0x0a 0xf0 0x4e 0x52

# CHECK: stw lr, dp[23]
0xd7 0x53

# CHECK: stw sp, dp[44442]
0xb6 0xf2 0x9a 0x53

# CHECK: stw r1, sp[32]
0x60 0x54

# CHECK: stw r0, sp[8761]
0x88 0xf0 0x39 0x54

# CHECK: stw cp, sp[63]
0x3f 0x57

# CHECK: stw lr, sp[4391]
0x44 0xf0 0xe7 0x57

# u6 / lu6 instructions

# CHECK: bu -20
0x14 0x77

# CHECK: bu -1000
0x0f 0xf0 0x28 0x77

# CHECK: bu 24
0x18 0x73

# CHECK: bu 2231
0x22 0xf0 0x37 0x73

# CHECK: extsp 9
0x89 0x77

# CHECK: extsp 5721
0x59 0xf0 0x99 0x77

# CHECK: clrsr 60
0x3c 0x7b

# CHECK: clrsr 64391
0xee 0xf3 0x07 0x7b

# CHECK: entsp 1
0x41 0x77

# CHECK: entsp 70
0x01 0xf0 0x46 0x77

# CHECK: ldaw r11, cp[5]
0x45 0x7f

# CHECK: ldaw r11, cp[33000]
0x03 0xf2 0x68 0x7f

# CHECK: retsp 40
0xe8 0x77

# CHECK: retsp 52010
0x2c 0xf3 0xea 0x77

# CHECK: setsr 42
0x6a 0x7b

# CHECK: setsr 21863
0x55 0xf1 0x67 0x7b

# CHECK: extdp 4
0x84 0x73

# CHECK: extdp 554
0x08 0xf0 0xaa 0x73

# CHECK: blat 9
0x49 0x73

# CHECK: blat 61212
0xbc 0xf3 0x5c 0x73

# CHECK: getsr r11, 54
0x36 0x7f

# CHECK: getsr r11, 442
0x06 0xf0 0x3a 0x7f

# CHECK: kcall 11
0xcb 0x73

# CHECK: kcall 4001
0x3e 0xf0 0xe1 0x73

# CHECK: kentsp 22
0x96 0x7b

# CHECK: kentsp 8793
0x89 0xf0 0x99 0x7b

# CHECK: krestsp 0
0xc0 0x7b

# CHECK: krestsp 55312
0x60 0xf3 0xd0 0x7b

# u10 / lu10 instructions

# CHECK: ldap r11, 40
0x28 0xd8

# CHECK: ldap r11, 53112
0x33 0xf0 0x78 0xdb

# CHECK: ldap r11, -22
0x16 0xdc

# CHECK: ldap r11, -9999
0x09 0xf0 0x0f 0xdf

# CHECK: bl 8
0x08 0xd0

# CHECK: bl 38631
0x25 0xf0 0xe7 0xd2

# CHECK: bl -222
0xde 0xd4

# CHECK: bl -55132
0x35 0xf0 0x5c 0xd7

# CHECK: bla cp[500]
0xf4 0xe1

# CHECK: bla cp[413742]
0x94 0xf1 0x2e 0xe0

# CHECK: ldw r11, cp[132]
0x84 0xe4

# CHECK: ldw r11, cp[102741]
0x64 0xf0 0x55 0xe5

# l6r instructions

# CHECK: lmul r11, r0, r2, r5, r8, r10
0xf9 0xfa 0x02 0x06

# l5r instructions

# CHECK: ladd r10, r2, r5, r1, r7
0xe5 0xf8 0xfb 0x06

# CHECK: ldivu r5, r6, r3, r9, r8
0x54 0xfe 0x0b 0x07

# CHECK: lsub r1, r8, r7, r11, r5
0xcf 0xfd 0x85 0x0f

# l4r instructions

# CHECK: crc8 r6, r3, r4, r11
0x73 0xfd 0xe6 0x07

# CHECK: maccs r11, r8, r2, r4
0xf8 0xfa 0xe8 0x0f

# CHECK: maccu r0, r2, r5, r8
0x44 0xfd 0xf2 0x07