xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/ppc64-struct-onefloat.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // REQUIRES: ppc64-registered-target
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc typedef struct s1 { float f; } Sf;
5*f4a2713aSLionel Sambuc typedef struct s2 { double d; } Sd;
6*f4a2713aSLionel Sambuc typedef struct s4 { Sf fs; } SSf;
7*f4a2713aSLionel Sambuc typedef struct s5 { Sd ds; } SSd;
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc void bar(Sf a, Sd b, SSf d, SSd e) {}
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @bar
12*f4a2713aSLionel Sambuc // CHECK:  %a = alloca %struct.s1, align 4
13*f4a2713aSLionel Sambuc // CHECK:  %b = alloca %struct.s2, align 8
14*f4a2713aSLionel Sambuc // CHECK:  %d = alloca %struct.s4, align 4
15*f4a2713aSLionel Sambuc // CHECK:  %e = alloca %struct.s5, align 8
16*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1* %a, i32 0, i32 0
17*f4a2713aSLionel Sambuc // CHECK:  store float %a.coerce, float* %{{[a-zA-Z0-9.]+}}, align 1
18*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2* %b, i32 0, i32 0
19*f4a2713aSLionel Sambuc // CHECK:  store double %b.coerce, double* %{{[a-zA-Z0-9.]+}}, align 1
20*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s4* %d, i32 0, i32 0
21*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
22*f4a2713aSLionel Sambuc // CHECK:  store float %d.coerce, float* %{{[a-zA-Z0-9.]+}}, align 1
23*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s5* %e, i32 0, i32 0
24*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
25*f4a2713aSLionel Sambuc // CHECK:  store double %e.coerce, double* %{{[a-zA-Z0-9.]+}}, align 1
26*f4a2713aSLionel Sambuc // CHECK:  ret void
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc void foo(void)
29*f4a2713aSLionel Sambuc {
30*f4a2713aSLionel Sambuc   Sf p1 = { 22.63f };
31*f4a2713aSLionel Sambuc   Sd p2 = { 19.47 };
32*f4a2713aSLionel Sambuc   SSf p4 = { { 22.63f } };
33*f4a2713aSLionel Sambuc   SSd p5 = { { 19.47 } };
34*f4a2713aSLionel Sambuc   bar(p1, p2, p4, p5);
35*f4a2713aSLionel Sambuc }
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @foo
38*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1* %p1, i32 0, i32 0
39*f4a2713aSLionel Sambuc // CHECK:  %{{[0-9]+}} = load float* %{{[a-zA-Z0-9.]+}}, align 1
40*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2* %p2, i32 0, i32 0
41*f4a2713aSLionel Sambuc // CHECK:  %{{[0-9]+}} = load double* %{{[a-zA-Z0-9.]+}}, align 1
42*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s4* %p4, i32 0, i32 0
43*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
44*f4a2713aSLionel Sambuc // CHECK:  %{{[0-9]+}} = load float* %{{[a-zA-Z0-9.]+}}, align 1
45*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s5* %p5, i32 0, i32 0
46*f4a2713aSLionel Sambuc // CHECK:  %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
47*f4a2713aSLionel Sambuc // CHECK:  %{{[0-9]+}} = load double* %{{[a-zA-Z0-9.]+}}, align 1
48*f4a2713aSLionel Sambuc // CHECK:  call void @bar(float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}}, float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}})
49*f4a2713aSLionel Sambuc // CHECK:  ret void
50