Index: test/MC/AVR/inst-adc.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-add.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-adiw.s =================================================================== --- /dev/null +++ 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 Index: test/MC/AVR/inst-and.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-andi.s =================================================================== --- /dev/null +++ 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 Index: test/MC/AVR/inst-asr.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-bld.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-brbc.s =================================================================== --- /dev/null +++ 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 Index: test/MC/AVR/inst-brbs.s =================================================================== --- /dev/null +++ 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 Index: test/MC/AVR/inst-break.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-bst.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-call.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-cbi.s =================================================================== --- /dev/null +++ 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 + Index: test/MC/AVR/inst-cbr.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-clr.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-com.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-cp.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-cpc.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-cpi.s =================================================================== --- /dev/null +++ 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 + Index: test/MC/AVR/inst-cpse.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-dec.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-des.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-eicall.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-eijmp.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-elpm.s =================================================================== --- /dev/null +++ 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] Index: test/MC/AVR/inst-eor.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-eor.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + eor r0, r15 + eor r15, r0 + eor r16, r31 + eor r31, r16 + +; CHECK: eor r0, r15 ; encoding: [0x0f,0x24] +; CHECK: eor r15, r0 ; encoding: [0xf0,0x24] +; CHECK: eor r16, r31 ; encoding: [0x0f,0x27] +; CHECK: eor r31, r16 ; encoding: [0xf0,0x27] Index: test/MC/AVR/inst-family-cond-branch.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-family-cond-branch.s @@ -0,0 +1,238 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + ; BREQ + breq .-18 + breq .-12 + brbs 1, .-18 + brbs 1, baz + +; CHECK: breq .Ltmp0-18 ; encoding: [0bAAAAA001,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp0-18, kind: fixup_7_pcrel +; CHECK: breq .Ltmp1-12 ; encoding: [0bAAAAA001,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp1-12, kind: fixup_7_pcrel +; CHECK: brbs 1, .Ltmp2-18 ; encoding: [0bAAAAA001,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp2-18, kind: fixup_7_pcrel +; CHECK: brbs 1, baz ; encoding: [0bAAAAA001,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: baz, kind: fixup_7_pcrel + + ; BRNE + brne .+10 + brne .+2 + brbc 1, .+10 + brbc 1, bar + +; CHECK: brne .Ltmp3+10 ; encoding: [0bAAAAA001,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp3+10, kind: fixup_7_pcrel +; CHECK: brne .Ltmp4+2 ; encoding: [0bAAAAA001,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp4+2, kind: fixup_7_pcrel +; CHECK: brbc 1, .Ltmp5+10 ; encoding: [0bAAAAA001,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp5+10, kind: fixup_7_pcrel +; CHECK: brbc 1, bar ; encoding: [0bAAAAA001,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: bar, kind: fixup_7_pcrel + +bar: + ; BRCS + brcs .+8 + brcs .+4 + brbs 0, .+8 + brbs 0, end + +; CHECK: brcs .Ltmp6+8 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp6+8, kind: fixup_7_pcrel +; CHECK: brcs .Ltmp7+4 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp7+4, kind: fixup_7_pcrel +; CHECK: brcs .Ltmp8+8 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp8+8, kind: fixup_7_pcrel +; CHECK: brcs end ; encoding: [0bAAAAA000,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel + + ; BRCC + brcc .+66 + brcc .-22 + brbc 0, .+66 + brbc 0, baz + +; CHECK: brcc .Ltmp9+66 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp9+66, kind: fixup_7_pcrel +; CHECK: brcc .Ltmp10-22 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp10-22, kind: fixup_7_pcrel +; CHECK: brcc .Ltmp11+66 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp11+66, kind: fixup_7_pcrel +; CHECK: brcc baz ; encoding: [0bAAAAA000,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: baz, kind: fixup_7_pcrel + + ; BRSH + brsh .+32 + brsh .+70 + brsh car + +; CHECK: brsh .Ltmp12+32 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp12+32, kind: fixup_7_pcrel +; CHECK: brsh .Ltmp13+70 ; encoding: [0bAAAAA000,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp13+70, kind: fixup_7_pcrel +; CHECK: brsh car ; encoding: [0bAAAAA000,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel + +baz: + + ; BRLO + brlo .+12 + brlo .+28 + brlo car + +; CHECK: brlo .Ltmp14+12 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp14+12, kind: fixup_7_pcrel +; CHECK: brlo .Ltmp15+28 ; encoding: [0bAAAAA000,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp15+28, kind: fixup_7_pcrel +; CHECK: brlo car ; encoding: [0bAAAAA000,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel + + ; BRMI + brmi .+66 + brmi .+58 + brmi car + +; CHECK: brmi .Ltmp16+66 ; encoding: [0bAAAAA010,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp16+66, kind: fixup_7_pcrel +; CHECK: brmi .Ltmp17+58 ; encoding: [0bAAAAA010,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp17+58, kind: fixup_7_pcrel +; CHECK: brmi car ; encoding: [0bAAAAA010,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel + + ; BRPL + brpl .-12 + brpl .+18 + brpl car + +; CHECK: brpl .Ltmp18-12 ; encoding: [0bAAAAA010,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp18-12, kind: fixup_7_pcrel +; CHECK: brpl .Ltmp19+18 ; encoding: [0bAAAAA010,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp19+18, kind: fixup_7_pcrel +; CHECK: brpl car ; encoding: [0bAAAAA010,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel + + ; BRGE + brge .+50 + brge .+42 + brge car + +; CHECK: brge .Ltmp20+50 ; encoding: [0bAAAAA100,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp20+50, kind: fixup_7_pcrel +; CHECK: brge .Ltmp21+42 ; encoding: [0bAAAAA100,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp21+42, kind: fixup_7_pcrel +; CHECK: brge car ; encoding: [0bAAAAA100,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: car, kind: fixup_7_pcrel + +car: + ; BRLT + brlt .+16 + brlt .+2 + brlt end + +; CHECK: brlt .Ltmp22+16 ; encoding: [0bAAAAA100,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp22+16, kind: fixup_7_pcrel +; CHECK: brlt .Ltmp23+2 ; encoding: [0bAAAAA100,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp23+2, kind: fixup_7_pcrel +; CHECK: brlt end ; encoding: [0bAAAAA100,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel + + ; BRHS + brhs .-66 + brhs .+14 + brhs just_another_label + +; CHECK: brhs .Ltmp24-66 ; encoding: [0bAAAAA101,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp24-66, kind: fixup_7_pcrel +; CHECK: brhs .Ltmp25+14 ; encoding: [0bAAAAA101,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp25+14, kind: fixup_7_pcrel +; CHECK: brhs just_another_label ; encoding: [0bAAAAA101,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel + + ; BRHC + brhc .+12 + brhc .+14 + brhc just_another_label + +; CHECK: brhc .Ltmp26+12 ; encoding: [0bAAAAA101,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp26+12, kind: fixup_7_pcrel +; CHECK: brhc .Ltmp27+14 ; encoding: [0bAAAAA101,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp27+14, kind: fixup_7_pcrel +; CHECK: brhc just_another_label ; encoding: [0bAAAAA101,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel + + ; BRTS + brts .+18 + brts .+22 + brts just_another_label + +; CHECK: brts .Ltmp28+18 ; encoding: [0bAAAAA110,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp28+18, kind: fixup_7_pcrel +; CHECK: brts .Ltmp29+22 ; encoding: [0bAAAAA110,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp29+22, kind: fixup_7_pcrel +; CHECK: brts just_another_label ; encoding: [0bAAAAA110,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: just_another_label, kind: fixup_7_pcrel + +just_another_label: + ; BRTC + brtc .+52 + brtc .+50 + brtc end + +; CHECK: brtc .Ltmp30+52 ; encoding: [0bAAAAA110,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp30+52, kind: fixup_7_pcrel +; CHECK: brtc .Ltmp31+50 ; encoding: [0bAAAAA110,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp31+50, kind: fixup_7_pcrel +; CHECK: brtc end ; encoding: [0bAAAAA110,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel + + ; BRVS + brvs .+18 + brvs .+32 + brvs end + +; CHECK: brvs .Ltmp32+18 ; encoding: [0bAAAAA011,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp32+18, kind: fixup_7_pcrel +; CHECK: brvs .Ltmp33+32 ; encoding: [0bAAAAA011,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp33+32, kind: fixup_7_pcrel +; CHECK: brvs end ; encoding: [0bAAAAA011,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel + + ; BRVC + brvc .-28 + brvc .-62 + brvc end + +; CHECK: brvc .Ltmp34-28 ; encoding: [0bAAAAA011,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp34-28, kind: fixup_7_pcrel +; CHECK: brvc .Ltmp35-62 ; encoding: [0bAAAAA011,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp35-62, kind: fixup_7_pcrel +; CHECK: brvc end ; encoding: [0bAAAAA011,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel + + ; BRIE + brie .+20 + brie .+40 + brie end + +; CHECK: brie .Ltmp36+20 ; encoding: [0bAAAAA111,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp36+20, kind: fixup_7_pcrel +; CHECK: brie .Ltmp37+40 ; encoding: [0bAAAAA111,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp37+40, kind: fixup_7_pcrel +; CHECK: brie end ; encoding: [0bAAAAA111,0b111100AA] +; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel + + ; BRID + brid .+42 + brid .+62 + brid end + +; CHECK: brid .Ltmp38+42 ; encoding: [0bAAAAA111,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp38+42, kind: fixup_7_pcrel +; CHECK: brid .Ltmp39+62 ; encoding: [0bAAAAA111,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp39+62, kind: fixup_7_pcrel +; CHECK: brid end ; encoding: [0bAAAAA111,0b111101AA] +; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_7_pcrel + +end: Index: test/MC/AVR/inst-family-set-clr-flag.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-family-set-clr-flag.s @@ -0,0 +1,105 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + +foo: + +; Flag set operations + +; SEC +bset 0 +sec + +; SEZ +bset 1 +sez + +; SEN +bset 2 +sen + +; SEV +bset 3 +sev + +; SES +bset 4 +ses + +; SEH +bset 5 +seh + +; SET +bset 6 +set + +; SEI +bset 7 +sei + +; Flag clear operations + +; CLC +bclr 0 +clc + +; CLZ +bclr 1 +clz + +; CLN +bclr 2 +cln + +; CLV +bclr 3 +clv + +; CLS +bclr 4 +cls + +; CLH +bclr 5 +clh + +; CLT +bclr 6 +clt + +; CLI +bclr 7 +cli + +; CHECK: sec ; encoding: [0x08,0x94] +; CHECK: sec ; encoding: [0x08,0x94] +; CHECK: sez ; encoding: [0x18,0x94] +; CHECK: sez ; encoding: [0x18,0x94] +; CHECK: sen ; encoding: [0x28,0x94] +; CHECK: sen ; encoding: [0x28,0x94] +; CHECK: sev ; encoding: [0x38,0x94] +; CHECK: sev ; encoding: [0x38,0x94] +; CHECK: ses ; encoding: [0x48,0x94] +; CHECK: ses ; encoding: [0x48,0x94] +; CHECK: seh ; encoding: [0x58,0x94] +; CHECK: seh ; encoding: [0x58,0x94] +; CHECK: set ; encoding: [0x68,0x94] +; CHECK: set ; encoding: [0x68,0x94] +; CHECK: sei ; encoding: [0x78,0x94] +; CHECK: sei ; encoding: [0x78,0x94] + +; CHECK: clc ; encoding: [0x88,0x94] +; CHECK: clc ; encoding: [0x88,0x94] +; CHECK: clz ; encoding: [0x98,0x94] +; CHECK: clz ; encoding: [0x98,0x94] +; CHECK: cln ; encoding: [0xa8,0x94] +; CHECK: cln ; encoding: [0xa8,0x94] +; CHECK: clv ; encoding: [0xb8,0x94] +; CHECK: clv ; encoding: [0xb8,0x94] +; CHECK: cls ; encoding: [0xc8,0x94] +; CHECK: cls ; encoding: [0xc8,0x94] +; CHECK: clh ; encoding: [0xd8,0x94] +; CHECK: clh ; encoding: [0xd8,0x94] +; CHECK: clt ; encoding: [0xe8,0x94] +; CHECK: clt ; encoding: [0xe8,0x94] +; CHECK: cli ; encoding: [0xf8,0x94] +; CHECK: cli ; encoding: [0xf8,0x94] Index: test/MC/AVR/inst-fmul.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-fmul.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=mul -show-encoding < %s | FileCheck %s + + +foo: + + fmul r22, r16 + fmul r19, r17 + fmul r21, r23 + fmul r23, r23 + +; CHECK: fmul r22, r16 ; encoding: [0x68,0x03] +; CHECK: fmul r19, r17 ; encoding: [0x39,0x03] +; CHECK: fmul r21, r23 ; encoding: [0x5f,0x03] +; CHECK: fmul r23, r23 ; encoding: [0x7f,0x03] Index: test/MC/AVR/inst-fmuls.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-fmuls.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=mul -show-encoding < %s | FileCheck %s + + +foo: + + fmuls r22, r16 + fmuls r19, r17 + fmuls r21, r23 + fmuls r23, r23 + +; CHECK: fmuls r22, r16 ; encoding: [0xe0,0x03] +; CHECK: fmuls r19, r17 ; encoding: [0xb1,0x03] +; CHECK: fmuls r21, r23 ; encoding: [0xd7,0x03] +; CHECK: fmuls r23, r23 ; encoding: [0xf7,0x03] Index: test/MC/AVR/inst-fmulsu.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-fmulsu.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=mul -show-encoding < %s | FileCheck %s + + +foo: + + fmulsu r22, r16 + fmulsu r19, r17 + fmulsu r21, r23 + fmulsu r23, r23 + +; CHECK: fmulsu r22, r16 ; encoding: [0xe8,0x03] +; CHECK: fmulsu r19, r17 ; encoding: [0xb9,0x03] +; CHECK: fmulsu r21, r23 ; encoding: [0xdf,0x03] +; CHECK: fmulsu r23, r23 ; encoding: [0xff,0x03] Index: test/MC/AVR/inst-icall.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-icall.s @@ -0,0 +1,8 @@ +; RUN: llvm-mc -triple avr -mattr=ijmpcall -show-encoding < %s | FileCheck %s + + +foo: + + icall + +; CHECK: icall ; encoding: [0x09,0x95] Index: test/MC/AVR/inst-ijmp.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-ijmp.s @@ -0,0 +1,8 @@ +; RUN: llvm-mc -triple avr -mattr=ijmpcall -show-encoding < %s | FileCheck %s + + +foo: + + ijmp + +; CHECK: ijmp ; encoding: [0x09,0x94] Index: test/MC/AVR/inst-in.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-in.s @@ -0,0 +1,20 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + in r2, 4 + in r9, 6 + in r5, 32 + in r0, 0 + + in r20, foo+1 + +; CHECK: in r2, 4 ; encoding: [0x24,0xb0] +; CHECK: in r9, 6 ; encoding: [0x96,0xb0] +; CHECK: in r5, 32 ; encoding: [0x50,0xb4] +; CHECK: in r0, 0 ; encoding: [0x00,0xb0] + +; CHECK: in r20, foo+1 ; encoding: [0x40'A',0xb1'A'] +; CHECK: ; fixup A - offset: 0, value: foo+1, kind: fixup_port6 + Index: test/MC/AVR/inst-inc.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-inc.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + inc r12 + inc r29 + inc r6 + inc r20 + +; CHECK: inc r12 ; encoding: [0xc3,0x94] +; CHECK: inc r29 ; encoding: [0xd3,0x95] +; CHECK: inc r6 ; encoding: [0x63,0x94] +; CHECK: inc r20 ; encoding: [0x43,0x95] Index: test/MC/AVR/inst-jmp.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-jmp.s @@ -0,0 +1,19 @@ +; RUN: llvm-mc -triple avr -mattr=jmpcall -show-encoding < %s | FileCheck %s + + +foo: + + jmp 200 + jmp -12 + jmp 80 + jmp 0 + + jmp foo+1 + +; CHECK: jmp 200 ; encoding: [0x0c,0x94,0x64,0x00] +; CHECK: jmp -12 ; encoding: [0xfd,0x95,0xfa,0xff] +; CHECK: jmp 80 ; encoding: [0x0c,0x94,0x28,0x00] +; CHECK: jmp 0 ; encoding: [0x0c,0x94,0x00,0x00] + +; CHECK: jmp foo+1 ; encoding: [0x0c'A',0x94'A',0b00AAAAAA,0x00] +; CHECK: ; fixup A - offset: 0, value: foo+1, kind: fixup_call Index: test/MC/AVR/inst-lac.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-lac.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=rmw -show-encoding < %s | FileCheck %s + + +foo: + + lac Z, r13 + lac Z, r0 + lac Z, r31 + lac Z, r3 + +; CHECK: lac Z, r13 ; encoding: [0xd6,0x92] +; CHECK: lac Z, r0 ; encoding: [0x06,0x92] +; CHECK: lac Z, r31 ; encoding: [0xf6,0x93] +; CHECK: lac Z, r3 ; encoding: [0x36,0x92] Index: test/MC/AVR/inst-las.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-las.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=rmw -show-encoding < %s | FileCheck %s + + +foo: + + las Z, r13 + las Z, r0 + las Z, r31 + las Z, r3 + +; CHECK: las Z, r13 ; encoding: [0xd5,0x92] +; CHECK: las Z, r0 ; encoding: [0x05,0x92] +; CHECK: las Z, r31 ; encoding: [0xf5,0x93] +; CHECK: las Z, r3 ; encoding: [0x35,0x92] Index: test/MC/AVR/inst-lat.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-lat.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=rmw -show-encoding < %s | FileCheck %s + + +foo: + + lat Z, r13 + lat Z, r0 + lat Z, r31 + lat Z, r3 + +; CHECK: lat Z, r13 ; encoding: [0xd7,0x92] +; CHECK: lat Z, r0 ; encoding: [0x07,0x92] +; CHECK: lat Z, r31 ; encoding: [0xf7,0x93] +; CHECK: lat Z, r3 ; encoding: [0x37,0x92] Index: test/MC/AVR/inst-ld.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-ld.s @@ -0,0 +1,73 @@ +; RUN: llvm-mc -triple avr -mattr=sram -show-encoding < %s | FileCheck %s + + +foo: + + ; Normal + + ld r10, X + ld r17, X + + ld r30, Y + ld r19, Y + + ld r10, Z + ld r2, Z + + ; Postincremenet + + ld r10, X+ + ld r17, X+ + + ld r30, Y+ + ld r19, Y+ + + ld r10, Z+ + ld r2, Z+ + + ; Predecrement + + ld r10, -X + ld r17, -X + + ld r30, -Y + ld r19, -Y + + ld r10, -Z + ld r2, -Z + + +; Normal + +; CHECK: ld r10, X ; encoding: [0xac,0x90] +; CHECK: ld r17, X ; encoding: [0x1c,0x91] + +; CHECK: ld r30, Y ; encoding: [0xe8,0x81] +; CHECK: ld r19, Y ; encoding: [0x38,0x81] + +; CHECK: ld r10, Z ; encoding: [0xa0,0x80] +; CHECK: ld r2, Z ; encoding: [0x20,0x80] + + +; Postincrement + +; CHECK: ld r10, X+ ; encoding: [0xad,0x90] +; CHECK: ld r17, X+ ; encoding: [0x1d,0x91] + +; CHECK: ld r30, Y+ ; encoding: [0xe9,0x91] +; CHECK: ld r19, Y+ ; encoding: [0x39,0x91] + +; CHECK: ld r10, Z+ ; encoding: [0xa1,0x90] +; CHECK: ld r2, Z+ ; encoding: [0x21,0x90] + + +; Predecrement + +; CHECK: ld r10, -X ; encoding: [0xae,0x90] +; CHECK: ld r17, -X ; encoding: [0x1e,0x91] + +; CHECK: ld r30, -Y ; encoding: [0xea,0x91] +; CHECK: ld r19, -Y ; encoding: [0x3a,0x91] + +; CHECK: ld r10, -Z ; encoding: [0xa2,0x90] +; CHECK: ld r2, -Z ; encoding: [0x22,0x90] Index: test/MC/AVR/inst-ldd.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-ldd.s @@ -0,0 +1,20 @@ +; RUN: llvm-mc -triple avr -mattr=sram -show-encoding < %s | FileCheck %s + + +foo: + ldd r2, Y+2 + ldd r0, Y+0 + + ldd r9, Z+12 + ldd r7, Z+30 + + ldd r9, Z+foo + +; CHECK: ldd r2, Y+2 ; encoding: [0x2a,0x80] +; CHECK: ldd r0, Y+0 ; encoding: [0x08,0x80] + +; CHECK: ldd r9, Z+12 ; encoding: [0x94,0x84] +; CHECK: ldd r7, Z+30 ; encoding: [0x76,0x8c] + +; CHECK: ldd r9, Z+foo ; encoding: [0x90'A',0x80'A'] +; CHECK: ; fixup A - offset: 0, value: +foo, kind: fixup_6 Index: test/MC/AVR/inst-ldi.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-ldi.s @@ -0,0 +1,17 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + ldi r16, 241 + ldi r29, 190 + ldi r22, 172 + ldi r27, 92 + ldi r21, SYMBOL+3 + +; CHECK: ldi r16, 241 ; encoding: [0x01,0xef] +; CHECK: ldi r29, 190 ; encoding: [0xde,0xeb] +; CHECK: ldi r22, 172 ; encoding: [0x6c,0xea] +; CHECK: ldi r27, 92 ; encoding: [0xbc,0xe5] + +; CHECK: ldi r21, SYMBOL+3 ; encoding: [0x50'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: SYMBOL+3, kind: fixup_ldi Index: test/MC/AVR/inst-lds.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-lds.s @@ -0,0 +1,16 @@ +; RUN: llvm-mc -triple avr -mattr=sram -show-encoding < %s | FileCheck %s + + +foo: + lds r16, 241 + lds r29, 190 + lds r22, 172 + lds r27, 92 + lds r4, SYMBOL+12 + +; CHECK: lds r16, 241 ; encoding: [0x00,0x91,0xf1,0x00] +; CHECK: lds r29, 190 ; encoding: [0xd0,0x91,0xbe,0x00] +; CHECK: lds r22, 172 ; encoding: [0x60,0x91,0xac,0x00] +; CHECK: lds r27, 92 ; encoding: [0xb0,0x91,0x5c,0x00] +; CHECK: lds r4, SYMBOL+12 ; encoding: [0x40'A',0x90'A',0x00,0x00] +; CHECK: ; fixup A - offset: 0, value: SYMBOL+12, kind: fixup_16 Index: test/MC/AVR/inst-lpm.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-lpm.s @@ -0,0 +1,20 @@ +; RUN: llvm-mc -triple avr -mattr=lpm,lpmx -show-encoding < %s | FileCheck %s + + +foo: + + lpm + + lpm r3, Z + lpm r23, Z + + lpm r8, Z+ + lpm r0, Z+ + +; CHECK: lpm ; encoding: [0xc8,0x95] + +; CHECK: lpm r3, Z ; encoding: [0x34,0x90] +; CHECK: lpm r23, Z ; encoding: [0x74,0x91] + +; CHECK: lpm r8, Z+ ; encoding: [0x85,0x90] +; CHECK: lpm r0, Z+ ; encoding: [0x05,0x90] Index: test/MC/AVR/inst-lsl.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-lsl.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + lsl r31 + lsl r25 + lsl r5 + lsl r0 + +; CHECK: lsl r31 ; encoding: [0xff,0x0f] +; CHECK: lsl r25 ; encoding: [0x99,0x0f] +; CHECK: lsl r5 ; encoding: [0x55,0x0c] +; CHECK: lsl r0 ; encoding: [0x00,0x0c] Index: test/MC/AVR/inst-lsr.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-lsr.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + lsr r31 + lsr r25 + lsr r5 + lsr r0 + +; CHECK: lsr r31 ; encoding: [0xf6,0x95] +; CHECK: lsr r25 ; encoding: [0x96,0x95] +; CHECK: lsr r5 ; encoding: [0x56,0x94] +; CHECK: lsr r0 ; encoding: [0x06,0x94] Index: test/MC/AVR/inst-mov.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-mov.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + mov r2, r13 + mov r9, r0 + mov r5, r31 + mov r3, r3 + +; CHECK: mov r2, r13 ; encoding: [0x2d,0x2c] +; CHECK: mov r9, r0 ; encoding: [0x90,0x2c] +; CHECK: mov r5, r31 ; encoding: [0x5f,0x2e] +; CHECK: mov r3, r3 ; encoding: [0x33,0x2c] Index: test/MC/AVR/inst-movw.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-movw.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=movw -show-encoding < %s | FileCheck %s + + +foo: + + movw r10, r8 + movw r12, r16 + movw r20, r22 + movw r8, r12 + +; CHECK: movw r10, r8 ; encoding: [0x54,0x01] +; CHECK: movw r12, r16 ; encoding: [0x68,0x01] +; CHECK: movw r20, r22 ; encoding: [0xab,0x01] +; CHECK: movw r8, r12 ; encoding: [0x46,0x01] Index: test/MC/AVR/inst-mul.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-mul.s @@ -0,0 +1,13 @@ +; RUN: llvm-mc -triple avr -mattr=mul -show-encoding < %s | FileCheck %s + + +foo: + mul r0, r15 + mul r15, r0 + mul r16, r31 + mul r31, r16 + +; CHECK: mul r0, r15 ; encoding: [0x0f,0x9c] +; CHECK: mul r15, r0 ; encoding: [0xf0,0x9c] +; CHECK: mul r16, r31 ; encoding: [0x0f,0x9f] +; CHECK: mul r31, r16 ; encoding: [0xf0,0x9f] Index: test/MC/AVR/inst-muls.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-muls.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=mul -show-encoding < %s | FileCheck %s + + +foo: + + muls r22, r16 + muls r19, r17 + muls r28, r31 + muls r31, r31 + +; CHECK: muls r22, r16 ; encoding: [0x60,0x02] +; CHECK: muls r19, r17 ; encoding: [0x31,0x02] +; CHECK: muls r28, r31 ; encoding: [0xcf,0x02] +; CHECK: muls r31, r31 ; encoding: [0xff,0x02] Index: test/MC/AVR/inst-mulsu.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-mulsu.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=mul -show-encoding < %s | FileCheck %s + + +foo: + + mulsu r22, r16 + mulsu r19, r17 + mulsu r21, r23 + mulsu r23, r23 + +; CHECK: mulsu r22, r16 ; encoding: [0x60,0x03] +; CHECK: mulsu r19, r17 ; encoding: [0x31,0x03] +; CHECK: mulsu r21, r23 ; encoding: [0x57,0x03] +; CHECK: mulsu r23, r23 ; encoding: [0x77,0x03] Index: test/MC/AVR/inst-neg.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-neg.s @@ -0,0 +1,12 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + +foo: + neg r15 + neg r1 + neg r22 + neg r31 + +; CHECK: neg r15 ; encoding: [0xf1,0x94] +; CHECK: neg r1 ; encoding: [0x11,0x94] +; CHECK: neg r22 ; encoding: [0x61,0x95] +; CHECK: neg r31 ; encoding: [0xf1,0x95] Index: test/MC/AVR/inst-nop.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-nop.s @@ -0,0 +1,8 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + nop + +; CHECK: nop ; encoding: [0x00,0x00] Index: test/MC/AVR/inst-or.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-or.s @@ -0,0 +1,13 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + or r0, r15 + or r15, r0 + or r16, r31 + or r31, r16 + +; CHECK: or r0, r15 ; encoding: [0x0f,0x28] +; CHECK: or r15, r0 ; encoding: [0xf0,0x28] +; CHECK: or r16, r31 ; encoding: [0x0f,0x2b] +; CHECK: or r31, r16 ; encoding: [0xf0,0x2b] Index: test/MC/AVR/inst-ori.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-ori.s @@ -0,0 +1,19 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + ori r17, 208 + ori r24, 190 + ori r20, 173 + ori r31, 0 + + ori r16, FOOBAR + +; CHECK: ori r17, 208 ; encoding: [0x10,0x6d] +; CHECK: ori r24, 190 ; encoding: [0x8e,0x6b] +; CHECK: ori r20, 173 ; encoding: [0x4d,0x6a] +; CHECK: ori r31, 0 ; encoding: [0xf0,0x60] + +; CHECK: ori r16, FOOBAR ; encoding: [A,0x60] +; CHECK: ; fixup A - offset: 0, value: FOOBAR, kind: fixup_ldi Index: test/MC/AVR/inst-out.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-out.s @@ -0,0 +1,20 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + out 4, r2 + out 6, r9 + out 32, r5 + out 0, r0 + + out bar-8, r29 + +; CHECK: out 4, r2 ; encoding: [0x24,0xb8] +; CHECK: out 6, r9 ; encoding: [0x96,0xb8] +; CHECK: out 32, r5 ; encoding: [0x50,0xbc] +; CHECK: out 0, r0 ; encoding: [0x00,0xb8] + +; CHECK: out bar-8, r29 ; encoding: [0xd0'A',0xb9'A'] +; CHECK: ; fixup A - offset: 0, value: bar-8, kind: fixup_port6 + Index: test/MC/AVR/inst-pop.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-pop.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=sram -show-encoding < %s | FileCheck %s + + +foo: + + pop r31 + pop r25 + pop r5 + pop r0 + +; CHECK: pop r31 ; encoding: [0xff,0x91] +; CHECK: pop r25 ; encoding: [0x9f,0x91] +; CHECK: pop r5 ; encoding: [0x5f,0x90] +; CHECK: pop r0 ; encoding: [0x0f,0x90] Index: test/MC/AVR/inst-push.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-push.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=sram -show-encoding < %s | FileCheck %s + + +foo: + + push r31 + push r25 + push r5 + push r0 + +; CHECK: push r31 ; encoding: [0xff,0x93] +; CHECK: push r25 ; encoding: [0x9f,0x93] +; CHECK: push r5 ; encoding: [0x5f,0x92] +; CHECK: push r0 ; encoding: [0x0f,0x92] Index: test/MC/AVR/inst-rcall.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-rcall.s @@ -0,0 +1,19 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + rcall .+0 + rcall .-8 + rcall .+12 + rcall .+46 + +; CHECK: rcall .Ltmp0+0 ; encoding: [A,0b1101AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp0+0, kind: fixup_13_pcrel +; CHECK: rcall .Ltmp1-8 ; encoding: [A,0b1101AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp1-8, kind: fixup_13_pcrel +; CHECK: rcall .Ltmp2+12 ; encoding: [A,0b1101AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp2+12, kind: fixup_13_pcrel +; CHECK: rcall .Ltmp3+46 ; encoding: [A,0b1101AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp3+46, kind: fixup_13_pcrel + Index: test/MC/AVR/inst-ret.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-ret.s @@ -0,0 +1,8 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + ret + +; CHECK: ret ; encoding: [0x08,0x95] Index: test/MC/AVR/inst-reti.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-reti.s @@ -0,0 +1,8 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + reti + +; CHECK: reti ; encoding: [0x18,0x95] Index: test/MC/AVR/inst-rjmp.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-rjmp.s @@ -0,0 +1,31 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + rjmp .+2 + rjmp .-2 + rjmp foo + rjmp .+8 + rjmp end + rjmp .+0 +end: + rjmp .-4 + rjmp .-6 + +; CHECK: rjmp .Ltmp0+2 ; encoding: [A,0b1100AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp0+2, kind: fixup_13_pcrel +; CHECK: rjmp .Ltmp1-2 ; encoding: [A,0b1100AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp1-2, kind: fixup_13_pcrel +; CHECK: rjmp foo ; encoding: [A,0b1100AAAA] +; CHECK: ; fixup A - offset: 0, value: foo, kind: fixup_13_pcrel +; CHECK: rjmp .Ltmp2+8 ; encoding: [A,0b1100AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp2+8, kind: fixup_13_pcrel +; CHECK: rjmp end ; encoding: [A,0b1100AAAA] +; CHECK: ; fixup A - offset: 0, value: end, kind: fixup_13_pcrel +; CHECK: rjmp .Ltmp3+0 ; encoding: [A,0b1100AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp3+0, kind: fixup_13_pcrel +; CHECK: rjmp .Ltmp4-4 ; encoding: [A,0b1100AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp4-4, kind: fixup_13_pcrel +; CHECK: rjmp .Ltmp5-6 ; encoding: [A,0b1100AAAA] +; CHECK: ; fixup A - offset: 0, value: .Ltmp5-6, kind: fixup_13_pcrel Index: test/MC/AVR/inst-rol.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-rol.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + rol r31 + rol r25 + rol r5 + rol r0 + +; CHECK: rol r31 ; encoding: [0xff,0x1f] +; CHECK: rol r25 ; encoding: [0x99,0x1f] +; CHECK: rol r5 ; encoding: [0x55,0x1c] +; CHECK: rol r0 ; encoding: [0x00,0x1c] Index: test/MC/AVR/inst-ror.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-ror.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + ror r31 + ror r25 + ror r5 + ror r0 + +; CHECK: ror r31 ; encoding: [0xf7,0x95] +; CHECK: ror r25 ; encoding: [0x97,0x95] +; CHECK: ror r5 ; encoding: [0x57,0x94] +; CHECK: ror r0 ; encoding: [0x07,0x94] Index: test/MC/AVR/inst-sbc.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbc.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + sbc r0, r15 + sbc r15, r0 + sbc r16, r31 + sbc r31, r16 + +; CHECK: sbc r0, r15 ; encoding: [0x0f,0x08] +; CHECK: sbc r15, r0 ; encoding: [0xf0,0x08] +; CHECK: sbc r16, r31 ; encoding: [0x0f,0x0b] +; CHECK: sbc r31, r16 ; encoding: [0xf0,0x0b] Index: test/MC/AVR/inst-sbci.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbci.s @@ -0,0 +1,18 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + sbci r17, 21 + sbci r23, 196 + sbci r30, 244 + sbci r19, 16 + sbci r22, FOO + +; CHECK: sbci r17, 21 ; encoding: [0x15,0x41] +; CHECK: sbci r23, 196 ; encoding: [0x74,0x4c] +; CHECK: sbci r30, 244 ; encoding: [0xe4,0x4f] +; CHECK: sbci r19, 16 ; encoding: [0x30,0x41] + +; CHECK: sbci r22, FOO ; encoding: [0x60'A',0x40] +; CHECK: ; fixup A - offset: 0, value: FOO, kind: fixup_ldi Index: test/MC/AVR/inst-sbi.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbi.s @@ -0,0 +1,20 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + sbi 3, 5 + sbi 1, 1 + sbi 0, 0 + sbi 7, 2 + + sbi main, 0 + +; CHECK: sbi 3, 5 ; encoding: [0x1d,0x9a] +; CHECK: sbi 1, 1 ; encoding: [0x09,0x9a] +; CHECK: sbi 0, 0 ; encoding: [0x00,0x9a] +; CHECK: sbi 7, 2 ; encoding: [0x3a,0x9a] + +; CHECK: sbi main, 0 ; encoding: [0bAAAAA000,0x9a] +; CHECK: ; fixup A - offset: 0, value: main, kind: fixup_port5 + Index: test/MC/AVR/inst-sbic.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbic.s @@ -0,0 +1,19 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + sbic 4, 3 + sbic 6, 2 + sbic 16, 5 + sbic 0, 0 + + sbic foo+1, 1 + +; CHECK: sbic 4, 3 ; encoding: [0x23,0x99] +; CHECK: sbic 6, 2 ; encoding: [0x32,0x99] +; CHECK: sbic 16, 5 ; encoding: [0x85,0x99] +; CHECK: sbic 0, 0 ; encoding: [0x00,0x99] + +; CHECK: sbic foo+1, 1 ; encoding: [0bAAAAA001,0x99] +; CHECK: ; fixup A - offset: 0, value: foo+1, kind: fixup_port5 Index: test/MC/AVR/inst-sbis.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbis.s @@ -0,0 +1,18 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + sbis 4, 3 + sbis 6, 2 + sbis 16, 5 + sbis 0, 0 + + sbis FOO+4, 7 + +; CHECK: sbis 4, 3 ; encoding: [0x23,0x9b] +; CHECK: sbis 6, 2 ; encoding: [0x32,0x9b] +; CHECK: sbis 16, 5 ; encoding: [0x85,0x9b] +; CHECK: sbis 0, 0 ; encoding: [0x00,0x9b] + +; CHECK: sbis FOO+4, 7 ; encoding: [0bAAAAA111,0x9b] +; CHECK: ; fixup A - offset: 0, value: FOO+4, kind: fixup_port5 Index: test/MC/AVR/inst-sbiw.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbiw.s @@ -0,0 +1,33 @@ +; RUN: llvm-mc -triple avr -mattr=addsubiw -show-encoding < %s | FileCheck %s + + +foo: + + sbiw r26, 54 + sbiw X, 63 + + sbiw 28, 52 + sbiw r28, 0 + + sbiw r30, 63 + sbiw Z, 47 + + sbiw r24, 1 + sbiw r24, 2 + + sbiw r24, SYMBOL-1 + +; CHECK: sbiw r26, 54 ; encoding: [0xd6,0x97] +; CHECK: sbiw r26, 63 ; encoding: [0xdf,0x97] + +; CHECK: sbiw r28, 52 ; encoding: [0xe4,0x97] +; CHECK: sbiw r28, 0 ; encoding: [0x20,0x97] + +; CHECK: sbiw r30, 63 ; encoding: [0xff,0x97] +; CHECK: sbiw r30, 47 ; encoding: [0xbf,0x97] + +; CHECK: sbiw r24, 1 ; encoding: [0x01,0x97] +; CHECK: sbiw r24, 2 ; encoding: [0x02,0x97] + +; CHECK: sbiw r24, SYMBOL-1 ; encoding: [0b00AAAAAA,0x97] + ; fixup A - offset: 0, value: SYMBOL-1, kind: fixup_6_adiw Index: test/MC/AVR/inst-sbr.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbr.s @@ -0,0 +1,18 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + sbr r17, 208 + sbr r24, 190 + sbr r20, 173 + sbr r31, 0 + + sbr r19, _start + +; CHECK: sbr r17, 208 ; encoding: [0x10,0x6d] +; CHECK: sbr r24, 190 ; encoding: [0x8e,0x6b] +; CHECK: sbr r20, 173 ; encoding: [0x4d,0x6a] +; CHECK: sbr r31, 0 ; encoding: [0xf0,0x60] + +; CHECK: sbr r19, _start ; encoding: [0x30'A',0x60] +; CHECK: ; fixup A - offset: 0, value: _start, kind: fixup_ldi Index: test/MC/AVR/inst-sbrc.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbrc.s @@ -0,0 +1,11 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + sbrc r2, 3 + sbrc r0, 7 + +; CHECK: sbrc r2, 3 ; encoding: [0x23,0xfc] +; CHECK: sbrc r0, 7 ; encoding: [0x07,0xfc] + Index: test/MC/AVR/inst-sbrs.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sbrs.s @@ -0,0 +1,11 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + sbrs r2, 3 + sbrs r0, 7 + +; CHECK: sbrs r2, 3 ; encoding: [0x23,0xfe] +; CHECK: sbrs r0, 7 ; encoding: [0x07,0xfe] + Index: test/MC/AVR/inst-ser.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-ser.s @@ -0,0 +1,13 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + ser r16 + ser r31 + ser r27 + ser r31 + +; CHECK: ldi r16, 255 ; encoding: [0x0f,0xef] +; CHECK: ldi r31, 255 ; encoding: [0xff,0xef] +; CHECK: ldi r27, 255 ; encoding: [0xbf,0xef] +; CHECK: ldi r31, 255 ; encoding: [0xff,0xef] Index: test/MC/AVR/inst-sleep.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sleep.s @@ -0,0 +1,8 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + sleep + +; CHECK: sleep ; encoding: [0x88,0x95] Index: test/MC/AVR/inst-spm.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-spm.s @@ -0,0 +1,10 @@ +; RUN: llvm-mc -triple avr -mattr=spm,spmx -show-encoding < %s | FileCheck %s + + +foo: + + spm + spm Z+ + +; CHECK: spm ; encoding: [0xe8,0x95] +; CHECK: spm Z+ ; encoding: [0xf8,0x95] Index: test/MC/AVR/inst-st.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-st.s @@ -0,0 +1,71 @@ +; RUN: llvm-mc -triple avr -mattr=sram -show-encoding < %s | FileCheck %s + + +foo: + ; Normal + + st X, r10 + st X, r17 + + st Y, r30 + st Y, r19 + + st Z, r10 + st Z, r2 + + ; Postincrement + + st X+, r10 + st X+, r17 + + st Y+, r30 + st Y+, r19 + + st Z+, r10 + st Z+, r2 + + ; Predecrement + + st -X, r10 + st -X, r17 + + st -Y, r30 + st -Y, r19 + + st -Z, r10 + st -Z, r2 + +; Normal + +; CHECK: st X, r10 ; encoding: [0xac,0x92] +; CHECK: st X, r17 ; encoding: [0x1c,0x93] + +; CHECK: st Y, r30 ; encoding: [0xe8,0x83] +; CHECK: st Y, r19 ; encoding: [0x38,0x83] + +; CHECK: st Z, r10 ; encoding: [0xa0,0x82] +; CHECK: st Z, r2 ; encoding: [0x20,0x82] + + +; Postincrement + +; CHECK: st X+, r10 ; encoding: [0xad,0x92] +; CHECK: st X+, r17 ; encoding: [0x1d,0x93] + +; CHECK: st Y+, r30 ; encoding: [0xe9,0x93] +; CHECK: st Y+, r19 ; encoding: [0x39,0x93] + +; CHECK: st Z+, r10 ; encoding: [0xa1,0x92] +; CHECK: st Z+, r2 ; encoding: [0x21,0x92] + + +; Predecrement + +; CHECK: st -X, r10 ; encoding: [0xae,0x92] +; CHECK: st -X, r17 ; encoding: [0x1e,0x93] + +; CHECK: st -Y, r30 ; encoding: [0xea,0x93] +; CHECK: st -Y, r19 ; encoding: [0x3a,0x93] + +; CHECK: st -Z, r10 ; encoding: [0xa2,0x92] +; CHECK: st -Z, r2 ; encoding: [0x22,0x92] Index: test/MC/AVR/inst-std.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-std.s @@ -0,0 +1,22 @@ +; RUN: llvm-mc -triple avr -mattr=sram -show-encoding < %s | FileCheck %s + + +foo: + + std Y+2, r2 + std Y+0, r0 + + std Z+12, r9 + std Z+30, r7 + + std Y+foo, r9 + +; CHECK: std Y+2, r2 ; encoding: [0x2a,0x82] +; CHECK: std Y+0, r0 ; encoding: [0x08,0x82] + +; CHECK: std Z+12, r9 ; encoding: [0x94,0x86] +; CHECK: std Z+30, r7 ; encoding: [0x76,0x8e] + +; CHECK: std Y+foo, r9 ; encoding: [0x98'A',0x82'A'] +; CHECK: ; fixup A - offset: 0, value: +foo, kind: fixup_6 + Index: test/MC/AVR/inst-sts.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sts.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=sram -show-encoding < %s | FileCheck %s + + +foo: + + sts 3, r5 + sts 255, r7 + sts SYMBOL+1, r25 + +; CHECK: sts 3, r5 ; encoding: [0x50,0x92,0x03,0x00] +; CHECK: sts 255, r7 ; encoding: [0x70,0x92,0xff,0x00] +; CHECK: sts SYMBOL+1, r25 ; encoding: [0x90'A',0x93'A',0x00,0x00] +; CHECK: ; fixup A - offset: 0, value: SYMBOL+1, kind: fixup_16 + Index: test/MC/AVR/inst-sub.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-sub.s @@ -0,0 +1,13 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + sub r0, r15 + sub r15, r0 + sub r16, r31 + sub r31, r16 + +; CHECK: sub r0, r15 ; encoding: [0x0f,0x18] +; CHECK: sub r15, r0 ; encoding: [0xf0,0x18] +; CHECK: sub r16, r31 ; encoding: [0x0f,0x1b] +; CHECK: sub r31, r16 ; encoding: [0xf0,0x1b] Index: test/MC/AVR/inst-subi.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-subi.s @@ -0,0 +1,18 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + subi r22, 82 + subi r27, 39 + subi r31, 244 + subi r16, 144 + + subi r20, EXTERN_SYMBOL+0 + +; CHECK: subi r22, 82 ; encoding: [0x62,0x55] +; CHECK: subi r27, 39 ; encoding: [0xb7,0x52] +; CHECK: subi r31, 244 ; encoding: [0xf4,0x5f] +; CHECK: subi r16, 144 ; encoding: [0x00,0x59] + +; CHECK: subi r20, EXTERN_SYMBOL+0 ; encoding: [0x40'A',0x50] +; CHECK: ; fixup A - offset: 0, value: EXTERN_SYMBOL+0, kind: fixup_ldi Index: test/MC/AVR/inst-swap.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-swap.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + swap r31 + swap r25 + swap r5 + swap r0 + +; CHECK: swap r31 ; encoding: [0xf2,0x95] +; CHECK: swap r25 ; encoding: [0x92,0x95] +; CHECK: swap r5 ; encoding: [0x52,0x94] +; CHECK: swap r0 ; encoding: [0x02,0x94] Index: test/MC/AVR/inst-tst.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-tst.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + tst r3 + tst r14 + tst r24 + tst r12 + +; CHECK: tst r3 ; encoding: [0x33,0x20] +; CHECK: tst r14 ; encoding: [0xee,0x20] +; CHECK: tst r24 ; encoding: [0x88,0x23] +; CHECK: tst r12 ; encoding: [0xcc,0x20] Index: test/MC/AVR/inst-wdr.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-wdr.s @@ -0,0 +1,8 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + + +foo: + + wdr + +; CHECK: wdr ; encoding: [0xa8,0x95] Index: test/MC/AVR/inst-xch.s =================================================================== --- /dev/null +++ test/MC/AVR/inst-xch.s @@ -0,0 +1,14 @@ +; RUN: llvm-mc -triple avr -mattr=rmw -show-encoding < %s | FileCheck %s + + +foo: + + xch Z, r13 + xch Z, r0 + xch Z, r31 + xch Z, r3 + +; CHECK: xch Z, r13 ; encoding: [0xd4,0x92] +; CHECK: xch Z, r0 ; encoding: [0x04,0x92] +; CHECK: xch Z, r31 ; encoding: [0xf4,0x93] +; CHECK: xch Z, r3 ; encoding: [0x34,0x92] Index: test/MC/AVR/lit.local.cfg =================================================================== --- /dev/null +++ test/MC/AVR/lit.local.cfg @@ -0,0 +1,3 @@ +if not 'AVR' in config.root.targets: + config.unsupported = True + Index: test/MC/AVR/modifiers.s =================================================================== --- /dev/null +++ test/MC/AVR/modifiers.s @@ -0,0 +1,203 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + +; TODO: Add support for lo8(-foo + 3), and add test +; FIXME: most of these tests use values (i.e. 0x0815) that are out of bounds. + +foo: + + ldi r24, lo8(0x42) + ldi r24, lo8(0x2342) + + ldi r24, lo8(0x23) + ldi r24, hi8(0x2342) + +; CHECK: ldi r24, lo8(66) ; encoding: [0x82,0xe4] +; CHECK: ldi r24, lo8(9026) ; encoding: [0x82,0xe4] + +; CHECK: ldi r24, lo8(35) ; encoding: [0x83,0xe2] +; CHECK: ldi r24, hi8(9026) ; encoding: [0x83,0xe2] + + +bar: + + ldi r24, lo8(bar) + ldi r24, hi8(bar) + +; CHECK: ldi r24, lo8(bar) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: lo8(bar), kind: fixup_lo8_ldi +; CHECK: ldi r24, hi8(bar) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hi8(bar), kind: fixup_hi8_ldi + +lo8: + + ldi r24, lo8(0x0815) + ldi r24, lo8(foo) + ldi r24, lo8(bar + 5) + +; CHECK: ldi r24, lo8(2069) ; encoding: [0x85,0xe1] +; CHECK: ldi r24, lo8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: lo8(foo), kind: fixup_lo8_ldi +; CHECK: ldi r24, lo8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: lo8(bar+5), kind: fixup_lo8_ldi + +lo8_neg: + + ldi r24, -lo8(123456) + ldi r24, -lo8(foo) + +; CHECK: ldi r24, -lo8(123456) ; encoding: [0x80,0xec] +; CHECK: ldi r24, -lo8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -lo8(foo), kind: fixup_lo8_ldi_neg + +hi8: + + ldi r24, hi8(0x0815) + ldi r24, hi8(foo) + ldi r24, hi8(bar + 5) + +; CHECK: ldi r24, hi8(2069) ; encoding: [0x88,0xe0] +; CHECK: ldi r24, hi8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hi8(foo), kind: fixup_hi8_ldi +; CHECK: ldi r24, hi8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hi8(bar+5), kind: fixup_hi8_ldi + +hi8_neg: + + ldi r24, -hi8(123456) + ldi r24, -hi8(foo) + +; CHECK: ldi r24, -hi8(123456) ; encoding: [0x8d,0xe1] +; CHECK: ldi r24, -hi8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -hi8(foo), kind: fixup_hi8_ldi_neg + +hh8: + + ldi r24, hh8(0x0815) + ldi r24, hh8(foo) + ldi r24, hh8(bar + 5) + +; CHECK: ldi r24, hh8(2069) ; encoding: [0x80,0xe0] +; CHECK: ldi r24, hh8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hh8(foo), kind: fixup_hh8_ldi +; CHECK: ldi r24, hh8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hh8(bar+5), kind: fixup_hh8_ldi + +hh8_neg: + + ldi r24, -hh8(123456) + ldi r24, -hh8(foo) + +; CHECK: ldi r24, -hh8(123456) ; encoding: [0x8e,0xef] +; CHECK: ldi r24, -hh8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -hh8(foo), kind: fixup_hh8_ldi_neg + +hlo8: ; synonym with hh8() above, hence the... odd results + + ldi r24, hlo8(0x0815) + ldi r24, hlo8(foo) + ldi r24, hlo8(bar + 5) + +; CHECK: ldi r24, hh8(2069) ; encoding: [0x80,0xe0] +; CHECK: ldi r24, hh8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hh8(foo), kind: fixup_hh8_ldi +; CHECK: ldi r24, hh8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hh8(bar+5), kind: fixup_hh8_ldi + +hlo8_neg: + + ldi r24, -hlo8(123456) + ldi r24, -hlo8(foo) + + +; CHECK: ldi r24, -hh8(123456) ; encoding: [0x8e,0xef] +; CHECK: ldi r24, -hh8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -hh8(foo), kind: fixup_hh8_ldi_neg + +hhi8: + + ldi r24, hhi8(0x0815) + ldi r24, hhi8(foo) + ldi r24, hhi8(bar + 5) + +; CHECK: ldi r24, hhi8(2069) ; encoding: [0x80,0xe0] +; CHECK: ldi r24, hhi8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hhi8(foo), kind: fixup_ms8_ldi +; CHECK: ldi r24, hhi8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: hhi8(bar+5), kind: fixup_ms8_ldi + +hhi8_neg: + ldi r24, -hhi8(123456) + ldi r24, -hhi8(foo) + + +; CHECK: ldi r24, -hhi8(123456) ; encoding: [0x8f,0xef] +; CHECK: ldi r24, -hhi8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -hhi8(foo), kind: fixup_ms8_ldi_neg + +pm_lo8: + ldi r24, pm_lo8(0x0815) + ldi r24, pm_lo8(foo) + ldi r24, pm_lo8(bar + 5) + +; CHECK: ldi r24, pm_lo8(2069) ; encoding: [0x8a,0xe0] +; CHECK: ldi r24, pm_lo8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: pm_lo8(foo), kind: fixup_lo8_ldi_pm +; CHECK: ldi r24, pm_lo8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: pm_lo8(bar+5), kind: fixup_lo8_ldi_pm + +pm_hi8: + ldi r24, pm_hi8(0x0815) + ldi r24, pm_hi8(foo) + ldi r24, pm_hi8(bar + 5) + +; CHECK: ldi r24, pm_hi8(2069) ; encoding: [0x84,0xe0] +; CHECK: ldi r24, pm_hi8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: pm_hi8(foo), kind: fixup_hi8_ldi_pm +; CHECK: ldi r24, pm_hi8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: pm_hi8(bar+5), kind: fixup_hi8_ldi_pm + +pm_hh8: + ldi r24, pm_hh8(0x0815) + ldi r24, pm_hh8(foo) + ldi r24, pm_hh8(bar + 5) + +; CHECK: ldi r24, pm_hh8(2069) ; encoding: [0x80,0xe0] +; CHECK: ldi r24, pm_hh8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: pm_hh8(foo), kind: fixup_hh8_ldi_pm +; CHECK: ldi r24, pm_hh8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: pm_hh8(bar+5), kind: fixup_hh8_ldi_pm + + +pm_lo8_neg: + ldi r24, -pm_lo8(0x0815) + ldi r24, -pm_lo8(foo) + ldi r24, -pm_lo8(bar + 5) + +; CHECK: ldi r24, -pm_lo8(2069) ; encoding: [0x85,0xef] +; CHECK: ldi r24, -pm_lo8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -pm_lo8(foo), kind: fixup_lo8_ldi_pm_neg +; CHECK: ldi r24, -pm_lo8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -pm_lo8(bar+5), kind: fixup_lo8_ldi_pm_neg + +pm_hi8_neg: + ldi r24, -pm_hi8(0x0815) + ldi r24, -pm_hi8(foo) + ldi r24, -pm_hi8(bar + 5) + +; CHECK: ldi r24, -pm_hi8(2069) ; encoding: [0x8b,0xef] +; CHECK: ldi r24, -pm_hi8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -pm_hi8(foo), kind: fixup_hi8_ldi_pm_neg +; CHECK: ldi r24, -pm_hi8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -pm_hi8(bar+5), kind: fixup_hi8_ldi_pm_neg + +pm_hh8_neg: + ldi r24, -pm_hh8(0x0815) + ldi r24, -pm_hh8(foo) + ldi r24, -pm_hh8(bar + 5) + +; CHECK: ldi r24, -pm_hh8(2069) ; encoding: [0x8f,0xef] +; CHECK: ldi r24, -pm_hh8(foo) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -pm_hh8(foo), kind: fixup_hh8_ldi_pm_neg +; CHECK: ldi r24, -pm_hh8(bar+5) ; encoding: [0x80'A',0xe0] +; CHECK: ; fixup A - offset: 0, value: -pm_hh8(bar+5), kind: fixup_hh8_ldi_pm_neg + Index: test/MC/AVR/out-of-range-fixups/adiw-fail.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/adiw-fail.s @@ -0,0 +1,5 @@ +; RUN: not llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s 2>&1 | FileCheck %s + +; CHECK: error: out of range immediate (expected an integer in the range 0 to 63) +adiw r24, foo+64 + Index: test/MC/AVR/out-of-range-fixups/adiw-pass.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/adiw-pass.s @@ -0,0 +1,5 @@ +; RUN: llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s | llvm-objdump -r - | FileCheck %s + +; CHECK: R_AVR_6_ADIW foo+63 +adiw r24, foo+63 + Index: test/MC/AVR/out-of-range-fixups/brbs-pass.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/brbs-pass.s @@ -0,0 +1,5 @@ +; RUN: llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s | llvm-objdump -r - | FileCheck %s + +; CHECK: R_AVR_7_PCREL foo+127 +brbs 1, foo+127 + Index: test/MC/AVR/out-of-range-fixups/call-pass.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/call-pass.s @@ -0,0 +1,5 @@ +; RUN: llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s 2>&1 | llvm-objdump -r - | FileCheck %s + +; CHECK: R_AVR_CALL foo+8388607 +jmp foo+8388607 + Index: test/MC/AVR/out-of-range-fixups/in-fail.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/in-fail.s @@ -0,0 +1,5 @@ +; RUN: not llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s 2>&1 | FileCheck %s + +; CHECK: error: out of range port number (expected an integer in the range 0 to 63) +in r3, foo+64 + Index: test/MC/AVR/out-of-range-fixups/in-pass.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/in-pass.s @@ -0,0 +1,5 @@ +; RUN: llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s | llvm-objdump -r - | FileCheck %s + +; CHECK: R_AVR_PORT6 foo+63 +in r3, foo+63 + Index: test/MC/AVR/out-of-range-fixups/lds-fail.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/lds-fail.s @@ -0,0 +1,5 @@ +; RUN: not llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s 2>&1 | FileCheck %s + +; CHECK: error: out of range port number (expected an integer in the range 0 to 65535) +lds r2, foo+65536 + Index: test/MC/AVR/out-of-range-fixups/lds-pass.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/lds-pass.s @@ -0,0 +1,5 @@ +; RUN: llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s | llvm-objdump -r - | FileCheck %s + +; CHECK: R_AVR_16 foo+65535 +lds r2, foo+65535 + Index: test/MC/AVR/out-of-range-fixups/rjmp-pass.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/rjmp-pass.s @@ -0,0 +1,5 @@ +; RUN: llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s | llvm-objdump -r - | FileCheck %s + +; CHECK: R_AVR_13_PCREL foo+4095 +rjmp foo+4095 + Index: test/MC/AVR/out-of-range-fixups/sbi-fail.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/sbi-fail.s @@ -0,0 +1,5 @@ +; RUN: not llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s 2>&1 | FileCheck %s + +; CHECK: error: out of range port number (expected an integer in the range 0 to 31) +sbi foo+32, 1 + Index: test/MC/AVR/out-of-range-fixups/sbi-pass.s =================================================================== --- /dev/null +++ test/MC/AVR/out-of-range-fixups/sbi-pass.s @@ -0,0 +1,5 @@ +; RUN: llvm-mc -triple avr -mattr=avr6 -filetype=obj < %s | llvm-objdump -r - | FileCheck %s + +; CHECK: R_AVR_PORT5 foo+31 +sbi foo+31, 1 + Index: test/MC/AVR/relocations.s =================================================================== --- /dev/null +++ test/MC/AVR/relocations.s @@ -0,0 +1,75 @@ +; RUN: llvm-mc -filetype=obj -triple=avr %s -mattr=avr6 | llvm-objdump -r - | FileCheck %s + +; CHECK: RELOCATION RECORDS FOR + +; CHECK-NEXT: R_AVR_LDI SYMBOL+3 +ldi r21, SYMBOL+3 + +; CHECK-NEXT: R_AVR_6_ADIW FOO +adiw r24, FOO + +; CHECK-NEXT: R_AVR_16 BAR+2 +lds r8, BAR+2 + +; CHECK-NEXT: R_AVR_PORT5 foo +sbic foo, 1 + +; CHECK-NEXT: R_AVR_PORT6 Bar+2 +in r30, Bar+2 + +; CHECK-NEXT: R_AVR_CALL foo+3 +call foo+3 + +; CHECK-NEXT: R_AVR_13_PCREL foo-10 +rjmp foo-10 + +; CHECK-NEXT: R_AVR_7_PCREL foo+2 +brcs foo+2 + +; CHECK-NEXT: R_AVR_LO8_LDI bar+3 +ldi r24, lo8(bar+3) + +; CHECK-NEXT: R_AVR_HI8_LDI abc +ldi r30, hi8(abc) + +; CHECK-NEXT: R_AVR_LO8_LDI_NEG abc +ldi r16, -lo8(abc) + +; CHECK-NEXT: R_AVR_HI8_LDI_NEG abc +ldi r16, -hi8(abc) + +; CHECK-NEXT: R_AVR_HH8_LDI foo +ldi r16, hh8(foo) + +; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo +ldi r16, -hh8(foo) + +; CHECK-NEXT: R_AVR_HH8_LDI foo +ldi r24, hlo8(foo) + +; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo +ldi r24, -hlo8(foo) + +; CHECK-NEXT: R_AVR_MS8_LDI bar +ldi r24, hhi8(bar) + +; CHECK-NEXT: R_AVR_MS8_LDI_NEG bar +ldi r24, -hhi8(bar) + +; CHECK-NEXT: R_AVR_LO8_LDI_PM foo +ldi r17, pm_lo8(foo) + +; CHECK-NEXT: R_AVR_HI8_LDI_PM bar +ldi r22, pm_hi8(bar) + +; CHECK-NEXT: R_AVR_HH8_LDI_PM baz +ldi r25, pm_hh8(baz) + +; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG +ldi r25, -pm_lo8(foo) + +; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG +ldi r25, -pm_hi8(foo) + +; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG +ldi r25, -pm_hh8(foo) Index: test/MC/AVR/symbol_relocation.s =================================================================== --- /dev/null +++ test/MC/AVR/symbol_relocation.s @@ -0,0 +1,16 @@ +; RUN: llvm-mc -filetype=obj -triple=avr %s -mattr=avr6 | llvm-objdump -r - | FileCheck %s + +; Checks that a global symbol with the address of another +; symbol generates a R_AVR_16_PM relocation, as the symbol +; will always be in program memory. + +; CHECK: RELOCATION RECORDS FOR [.rela.text]: +; CHECK-NEXT: 00000002 R_AVR_16_PM .text + +foo: + ret + +.globl ptr +ptr: + .short foo + Index: test/MC/AVR/syntax-reg-int-literal.s =================================================================== --- /dev/null +++ test/MC/AVR/syntax-reg-int-literal.s @@ -0,0 +1,15 @@ +; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s + +foo: + add 0, 15 + add 15, r0 + add 16, 31 + add r16, r31 + add 31, r16 + + +; CHECK: add r0, r15 ; encoding: [0x0f,0x0c] +; CHECK: add r15, r0 ; encoding: [0xf0,0x0c] +; CHECK: add r16, r31 ; encoding: [0x0f,0x0f] +; CHECK: add r16, r31 ; encoding: [0x0f,0x0f] +; CHECK: add r31, r16 ; encoding: [0xf0,0x0f] Index: test/MC/AVR/syntax-reg-pair.s =================================================================== --- /dev/null +++ test/MC/AVR/syntax-reg-pair.s @@ -0,0 +1,13 @@ +; RUN: llvm-mc -triple avr -mattr=addsubiw -show-encoding < %s | FileCheck %s + +foo: + + sbiw r24, 1 + sbiw r25:r24, 2 + sbiw r24, 2 + sbiw r27:r26, 3 + +; CHECK: sbiw r24, 1 ; encoding: [0x01,0x97] +; CHECK: sbiw r24, 2 ; encoding: [0x02,0x97] +; CHECK: sbiw r24, 2 ; encoding: [0x02,0x97] +; CHECK: sbiw r26, 3 ; encoding: [0x13,0x97]