1; RUN: llc < %s -march=avr | FileCheck --check-prefixes=CHECK,NOSECTIONS %s
2; RUN: llc -function-sections -data-sections < %s -march=avr | FileCheck --check-prefixes=CHECK,SECTIONS %s
3
4; Test that functions (in address space 1) are not considered .progmem data.
5
6; CHECK: .text
7; SECTIONS: .text.somefunc,"ax",@progbits
8; CHECK-LABEL: somefunc:
9define void @somefunc() addrspace(1) {
10  ret void
11}
12
13
14; Test whether global variables are placed in the correct section.
15
16; Note: avr-gcc would place this global in .progmem.data.flash with
17; -fdata-sections. The AVR backend does not yet respect -fdata-sections in this
18; case.
19; CHECK: .section .progmem.data,"a",@progbits
20; CHECK-LABEL: flash:
21@flash = addrspace(1) constant i16 3
22
23; NOSECTIONS: .section .rodata,"a",@progbits
24; SECTIONS:   .section .rodata.ram1,"a",@progbits
25; CHECK-LABEL: ram1:
26@ram1 = constant i16 3
27
28; NOSECTIONS: .data
29; SECTIONS:   .section .data.ram2,"aw",@progbits
30; CHECK-LABEL: ram2:
31@ram2 = global i16 3
32