Skip to content

Commit

Permalink
[AVR] Add all of the machine code test suite
Browse files Browse the repository at this point in the history
Summary: This adds all of the AVR machine code tests.

Reviewers: arsenm, kparzysz

Subscribers: wdng, japaric

Differential Revision: https://reviews.llvm.org/D26387

llvm-svn: 286417
  • Loading branch information
Dylan McKay committed Nov 9, 2016
1 parent 1bdaf3e commit 3ffc449
Show file tree
Hide file tree
Showing 102 changed files with 2,072 additions and 0 deletions.
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-adc.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

adc r0, r15
adc r15, r0
adc r16, r31
adc r31, r16

; CHECK: adc r0, r15 ; encoding: [0x0f,0x1c]
; CHECK: adc r15, r0 ; encoding: [0xf0,0x1c]
; CHECK: adc r16, r31 ; encoding: [0x0f,0x1f]
; CHECK: adc r31, r16 ; encoding: [0xf0,0x1f]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-add.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

add r0, r15
add r15, r0
add r16, r31
add r31, r16

; CHECK: add r0, r15 ; encoding: [0x0f,0x0c]
; CHECK: add r15, r0 ; encoding: [0xf0,0x0c]
; CHECK: add r16, r31 ; encoding: [0x0f,0x0f]
; CHECK: add r31, r16 ; encoding: [0xf0,0x0f]
27 changes: 27 additions & 0 deletions llvm/test/MC/AVR/inst-adiw.s
@@ -0,0 +1,27 @@
; RUN: llvm-mc -triple avr -mattr=addsubiw -show-encoding < %s | FileCheck %s


foo:

adiw r26, 12
adiw r26, 63

adiw r28, 17
adiw r28, 0

adiw r30, 63
adiw r30, 3

adiw r24, SYMBOL

; CHECK: adiw r26, 12 ; encoding: [0x1c,0x96]
; CHECK: adiw r26, 63 ; encoding: [0xdf,0x96]

; CHECK: adiw r28, 17 ; encoding: [0x61,0x96]
; CHECK: adiw r28, 0 ; encoding: [0x20,0x96]

; CHECK: adiw r30, 63 ; encoding: [0xff,0x96]
; CHECK: adiw r30, 3 ; encoding: [0x33,0x96]

; CHECK: adiw r24, SYMBOL ; encoding: [0b00AAAAAA,0x96]
; fixup A - offset: 0, value: SYMBOL, kind: fixup_6_adiw
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-and.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

and r0, r15
and r15, r0
and r16, r31
and r31, r16

; CHECK: and r0, r15 ; encoding: [0x0f,0x20]
; CHECK: and r15, r0 ; encoding: [0xf0,0x20]
; CHECK: and r16, r31 ; encoding: [0x0f,0x23]
; CHECK: and r31, r16 ; encoding: [0xf0,0x23]
19 changes: 19 additions & 0 deletions llvm/test/MC/AVR/inst-andi.s
@@ -0,0 +1,19 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

andi r16, 255
andi r29, 190
andi r22, 172
andi r27, 92

andi r20, BAR

; CHECK: andi r16, 255 ; encoding: [0x0f,0x7f]
; CHECK: andi r29, 190 ; encoding: [0xde,0x7b]
; CHECK: andi r22, 172 ; encoding: [0x6c,0x7a]
; CHECK: andi r27, 92 ; encoding: [0xbc,0x75]

; CHECK: andi r20, BAR ; encoding: [0x40'A',0x70]
; CHECK: ; fixup A - offset: 0, value: BAR, kind: fixup_ldi
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-asr.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

asr r31
asr r25
asr r5
asr r0

; CHECK: asr r31 ; encoding: [0xf5,0x95]
; CHECK: asr r25 ; encoding: [0x95,0x95]
; CHECK: asr r5 ; encoding: [0x55,0x94]
; CHECK: asr r0 ; encoding: [0x05,0x94]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-bld.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

bld r3, 5
bld r1, 1
bld r0, 0
bld r7, 2

; CHECK: bld r3, 5 ; encoding: [0x35,0xf8]
; CHECK: bld r1, 1 ; encoding: [0x11,0xf8]
; CHECK: bld r0, 0 ; encoding: [0x00,0xf8]
; CHECK: bld r7, 2 ; encoding: [0x72,0xf8]
12 changes: 12 additions & 0 deletions llvm/test/MC/AVR/inst-brbc.s
@@ -0,0 +1,12 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

brbc 3, .+8
brbc 0, .-16

; CHECK: brvc .Ltmp0+8 ; encoding: [0bAAAAA011,0b111101AA]
; CHECK: ; fixup A - offset: 0, value: .Ltmp0+8, kind: fixup_7_pcrel
; CHECK: brcc .Ltmp1-16 ; encoding: [0bAAAAA000,0b111101AA]
; CHECK: ; fixup A - offset: 0, value: .Ltmp1-16, kind: fixup_7_pcrel
12 changes: 12 additions & 0 deletions llvm/test/MC/AVR/inst-brbs.s
@@ -0,0 +1,12 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

brbs 3, .+8
brbs 0, .-12

; CHECK: brvs .Ltmp0+8 ; encoding: [0bAAAAA011,0b111100AA]
; CHECK: ; fixup A - offset: 0, value: .Ltmp0+8, kind: fixup_7_pcrel
; CHECK: brcs .Ltmp1-12 ; encoding: [0bAAAAA000,0b111100AA]
; CHECK: ; fixup A - offset: 0, value: .Ltmp1-12, kind: fixup_7_pcrel
8 changes: 8 additions & 0 deletions llvm/test/MC/AVR/inst-break.s
@@ -0,0 +1,8 @@
; RUN: llvm-mc -triple avr -mattr=break -show-encoding < %s | FileCheck %s


foo:

break

; CHECK: break ; encoding: [0x98,0x95]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-bst.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

bst r3, 5
bst r1, 1
bst r0, 0
bst r7, 2

; CHECK: bst r3, 5 ; encoding: [0x35,0xfa]
; CHECK: bst r1, 1 ; encoding: [0x11,0xfa]
; CHECK: bst r0, 0 ; encoding: [0x00,0xfa]
; CHECK: bst r7, 2 ; encoding: [0x72,0xfa]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-call.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -mattr=jmpcall -show-encoding < %s | FileCheck %s


foo:

call 4096
call -124
call -12
call 0

; CHECK: call 4096 ; encoding: [0x0e,0x94,0x00,0x08]
; CHECK: call -124 ; encoding: [0xff,0x95,0xc2,0xff]
; CHECK: call -12 ; encoding: [0xff,0x95,0xfa,0xff]
; CHECK: call 0 ; encoding: [0x0e,0x94,0x00,0x00]
20 changes: 20 additions & 0 deletions llvm/test/MC/AVR/inst-cbi.s
@@ -0,0 +1,20 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

cbi 3, 5
cbi 1, 1
cbi 0, 0
cbi 7, 2

cbi bar-2, 2

; CHECK: cbi 3, 5 ; encoding: [0x1d,0x98]
; CHECK: cbi 1, 1 ; encoding: [0x09,0x98]
; CHECK: cbi 0, 0 ; encoding: [0x00,0x98]
; CHECK: cbi 7, 2 ; encoding: [0x3a,0x98]

; CHECK: cbi bar-2, 2 ; encoding: [0bAAAAA010,0x98]
; CHECK: ; fixup A - offset: 0, value: bar-2, kind: fixup_port5

14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-cbr.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

cbr r17, 208
cbr r24, 190
cbr r20, 173
cbr r31, 0

; CHECK: cbr r17, 208 ; encoding: [0x1f,0x72]
; CHECK: cbr r24, 190 ; encoding: [0x81,0x74]
; CHECK: cbr r20, 173 ; encoding: [0x42,0x75]
; CHECK: cbr r31, 0 ; encoding: [0xff,0x7f]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-clr.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

clr r2
clr r12
clr r5
clr r0

; CHECK: eor r2, r2 ; encoding: [0x22,0x24]
; CHECK: eor r12, r12 ; encoding: [0xcc,0x24]
; CHECK: eor r5, r5 ; encoding: [0x55,0x24]
; CHECK: eor r0, r0 ; encoding: [0x00,0x24]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-com.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

com r30
com r17
com r4
com r0

; CHECK: com r30 ; encoding: [0xe0,0x95]
; CHECK: com r17 ; encoding: [0x10,0x95]
; CHECK: com r4 ; encoding: [0x40,0x94]
; CHECK: com r0 ; encoding: [0x00,0x94]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-cp.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

cp r12, r2
cp r19, r0
cp r15, r31
cp r0, r0

; CHECK: cp r12, r2 ; encoding: [0xc2,0x14]
; CHECK: cp r19, r0 ; encoding: [0x30,0x15]
; CHECK: cp r15, r31 ; encoding: [0xff,0x16]
; CHECK: cp r0, r0 ; encoding: [0x00,0x14]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-cpc.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

cp r13, r12
cp r20, r0
cp r10, r31
cp r0, r0

; CHECK: cp r13, r12 ; encoding: [0xdc,0x14]
; CHECK: cp r20, r0 ; encoding: [0x40,0x15]
; CHECK: cp r10, r31 ; encoding: [0xaf,0x16]
; CHECK: cp r0, r0 ; encoding: [0x00,0x14]
20 changes: 20 additions & 0 deletions llvm/test/MC/AVR/inst-cpi.s
@@ -0,0 +1,20 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

cpi r16, 241
cpi r29, 190
cpi r22, 172
cpi r27, 92

cpi r21, ear

; CHECK: cpi r16, 241 ; encoding: [0x01,0x3f]
; CHECK: cpi r29, 190 ; encoding: [0xde,0x3b]
; CHECK: cpi r22, 172 ; encoding: [0x6c,0x3a]
; CHECK: cpi r27, 92 ; encoding: [0xbc,0x35]

; CHECK: cpi r21, ear ; encoding: [0x50'A',0x30]
; CHECK: ; fixup A - offset: 0, value: ear, kind: fixup_ldi

14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-cpse.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

cpse r2, r13
cpse r9, r0
cpse r5, r31
cpse r3, r3

; CHECK: cpse r2, r13 ; encoding: [0x2d,0x10]
; CHECK: cpse r9, r0 ; encoding: [0x90,0x10]
; CHECK: cpse r5, r31 ; encoding: [0x5f,0x12]
; CHECK: cpse r3, r3 ; encoding: [0x33,0x10]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-dec.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s


foo:

dec r26
dec r3
dec r24
dec r20

; CHECK: dec r26 ; encoding: [0xaa,0x95]
; CHECK: dec r3 ; encoding: [0x3a,0x94]
; CHECK: dec r24 ; encoding: [0x8a,0x95]
; CHECK: dec r20 ; encoding: [0x4a,0x95]
14 changes: 14 additions & 0 deletions llvm/test/MC/AVR/inst-des.s
@@ -0,0 +1,14 @@
; RUN: llvm-mc -triple avr -mattr=des -show-encoding < %s | FileCheck %s


foo:

des 0
des 6
des 1
des 8

; CHECK: des 0 ; encoding: [0x0b,0x94]
; CHECK: des 6 ; encoding: [0x6b,0x94]
; CHECK: des 1 ; encoding: [0x1b,0x94]
; CHECK: des 8 ; encoding: [0x8b,0x94]
8 changes: 8 additions & 0 deletions llvm/test/MC/AVR/inst-eicall.s
@@ -0,0 +1,8 @@
; RUN: llvm-mc -triple avr -mattr=eijmpcall -show-encoding < %s | FileCheck %s


foo:

eicall

; CHECK: eicall ; encoding: [0x19,0x95]
8 changes: 8 additions & 0 deletions llvm/test/MC/AVR/inst-eijmp.s
@@ -0,0 +1,8 @@
; RUN: llvm-mc -triple avr -mattr=eijmpcall -show-encoding < %s | FileCheck %s


foo:

eijmp

; CHECK: eijmp ; encoding: [0x19,0x94]
20 changes: 20 additions & 0 deletions llvm/test/MC/AVR/inst-elpm.s
@@ -0,0 +1,20 @@
; RUN: llvm-mc -triple avr -mattr=elpm,elpmx -show-encoding < %s | FileCheck %s


foo:

elpm

elpm r3, Z
elpm r23, Z

elpm r8, Z+
elpm r0, Z+

; CHECK: elpm ; encoding: [0xd8,0x95]

; CHECK: elpm r3, Z ; encoding: [0x36,0x90]
; CHECK: elpm r23, Z ; encoding: [0x76,0x91]

; CHECK: elpm r8, Z+ ; encoding: [0x87,0x90]
; CHECK: elpm r0, Z+ ; encoding: [0x07,0x90]

0 comments on commit 3ffc449

Please sign in to comment.