xref: /llvm-project/clang/test/CodeGen/2006-05-19-SingleEltReturn.c (revision 158d72d728261c1e54dc77931372b2322c52849f)
1 // Test returning a single element aggregate value containing a double.
2 // RUN: %clang_cc1 -triple i686-linux %s -emit-llvm -o - | FileCheck %s --check-prefix=X86_32
3 // RUN: %clang_cc1 %s -emit-llvm -o -
4 
5 struct X {
6   double D;
7 };
8 
9 struct Y {
10   struct X x;
11 };
12 
13 struct Y bar(void);
14 
foo(struct Y * P)15 void foo(struct Y *P) {
16   *P = bar();
17 }
18 
bar(void)19 struct Y bar(void) {
20   struct Y a;
21   a.x.D = 0;
22   return a;
23 }
24 
25 
26 // X86_32: define{{.*}} void @foo(ptr noundef %P)
27 // X86_32:   call void @bar(ptr dead_on_unwind writable sret(%struct.Y) align 4 %{{[^),]*}})
28 
29 // X86_32: define{{.*}} void @bar(ptr dead_on_unwind noalias writable sret(%struct.Y) align 4 %{{[^,)]*}})
30 // X86_32:   ret void
31