1 ; RUN: llc -mattr=avr6,sram < %s -march=avr | FileCheck %s
3 ;TODO: test returning byval structs
4 ; TODO: test naked functions
6 define void @return_void() {
7 ; CHECK: return_void:{{[a-zA-Z0-9 #@]*}}
13 define i8 @return8_imm() {
14 ; CHECK-LABEL: return8_imm:
19 define i8 @return8_arg(i8 %x) {
20 ; CHECK: return8_arg:{{[a-zA-Z0-9 #@]*}}
26 define i8 @return8_arg2(i8 %x, i8 %y, i8 %z) {
27 ; CHECK-LABEL: return8_arg2:
32 define i16 @return16_imm() {
33 ; CHECK-LABEL: return16_imm:
39 define i16 @return16_arg(i16 %x) {
40 ; CHECK: return16_arg:{{[a-zA-Z0-9 #@]*}}
46 define i16 @return16_arg2(i16 %x, i16 %y, i16 %z) {
47 ; CHECK-LABEL: return16_arg2:
48 ; CHECK: movw r24, r20
52 define i32 @return32_imm() {
53 ; CHECK-LABEL: return32_imm:
61 define i32 @return32_arg(i32 %x) {
62 ; CHECK: return32_arg:{{[a-zA-Z0-9 #@]*}}
68 define i32 @return32_arg2(i32 %x, i32 %y, i32 %z) {
69 ; CHECK-LABEL: return32_arg2:
70 ; CHECK: movw r22, r14
71 ; CHECK: movw r24, r16
75 define i64 @return64_imm() {
76 ; CHECK-LABEL: return64_imm:
85 ret i64 13757395258967641292
88 define i64 @return64_arg(i64 %x) {
89 ; CHECK: return64_arg:{{[a-zA-Z0-9 #@]*}}
95 define i64 @return64_arg2(i64 %x, i64 %y, i64 %z) {
96 ; CHECK-LABEL: return64_arg2:
100 ; CHECK: ldd r19, Y+4
101 ; CHECK: ldd r20, Y+5
102 ; CHECK: ldd r21, Y+6
103 ; CHECK: ldd r22, Y+7
104 ; CHECK: ldd r23, Y+8
105 ; CHECK: ldd r24, Y+9
106 ; CHECK: ldd r25, Y+10
112 define i32 @return64_trunc(i32 %a, i32 %b, i32 %c, i64 %d) {
113 ; CHECK-LABEL: return64_trunc:
116 ; CHECK: ldd r22, Y+3
117 ; CHECK: ldd r23, Y+4
118 ; CHECK: ldd r24, Y+5
119 ; CHECK: ldd r25, Y+6
122 %result = trunc i64 %d to i32
126 define i32 @naked(i32 %x) naked {
127 ; CHECK-LABEL: naked:
132 define avr_intrcc void @interrupt_handler() {
133 ; CHECK-LABEL: interrupt_handler:
138 define avr_signalcc void @signal_handler() {
139 ; CHECK-LABEL: signal_handler: