xref: /llvm-project/clang/test/CodeGen/avr/return-value.c (revision 84ef7235732896530564289c8db59291a7d5413e)
1 // RUN: %clang_cc1 -triple avr -target-cpu atmega328 -emit-llvm %s -o - \
2 // RUN:     | FileCheck %s --check-prefix=AVR
3 // RUN: %clang_cc1 -triple avr -target-cpu attiny40 -emit-llvm %s -o - \
4 // RUN:     | FileCheck %s --check-prefix=TINY
5 
6 // Structure that is more than 8 bytes.
7 struct s10 {
8   int a, b, c, d, e;
9 };
10 
11 // Structure that is less than 8 bytes but more than 4 bytes.
12 struct s06 {
13   int a, b, c;
14 };
15 
16 // Structure that is less than 4 bytes.
17 struct s04 {
18   int a, b;
19 };
20 
foo10(int a,int b,int c)21 struct s10 foo10(int a, int b, int c) {
22   struct s10 a0;
23   return a0;
24 }
25 
foo06(int a,int b,int c)26 struct s06 foo06(int a, int b, int c) {
27   struct s06 a0;
28   return a0;
29 }
30 
foo04(int a,int b)31 struct s04 foo04(int a, int b) {
32   struct s04 a0;
33   return a0;
34 }
35 
fooi64(void)36 long long fooi64(void) {
37   return 0xaa5533;
38 }
39 
40 // AVR: %struct.s10 = type { i16, i16, i16, i16, i16 }
41 // AVR: %struct.s06 = type { i16, i16, i16 }
42 // AVR: %struct.s04 = type { i16, i16 }
43 // AVR: define{{.*}} void @foo10(ptr {{.*}}, i16 noundef %a, i16 noundef %b, i16 noundef %c)
44 // AVR: define{{.*}} %struct.s06 @foo06(i16 noundef %a, i16 noundef %b, i16 noundef %c)
45 // AVR: define{{.*}} %struct.s04 @foo04(i16 noundef %a, i16 noundef %b)
46 // AVR: define{{.*}} i64 @fooi64()
47 
48 // TINY: %struct.s10 = type { i16, i16, i16, i16, i16 }
49 // TINY: %struct.s06 = type { i16, i16, i16 }
50 // TINY: %struct.s04 = type { i16, i16 }
51 // TINY: define{{.*}} void @foo10(ptr {{.*}}, i16 noundef %a, i16 noundef %b, i16 noundef %c)
52 // TINY: define{{.*}} void @foo06(ptr {{.*}}, i16 noundef %a, i16 noundef %b, i16 noundef %c)
53 // TINY: define{{.*}} %struct.s04 @foo04(i16 noundef %a, i16 noundef %b)
54 // TINY: define{{.*}} void @fooi64(ptr {{.*}})
55