blob: d0ccfbe34a44563946ef63bf7bd5babd19575dd9 [file] [log] [blame]
Stephen Hines651f13c2014-04-23 16:59:28 -07001// REQUIRES: powerpc-registered-target
Rafael Espindolaa3f55b02013-09-04 04:12:25 +00002// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
Bill Schmidtb1f5fe02012-10-12 19:26:17 +00003
4typedef struct s1 { float f; } Sf;
5typedef struct s2 { double d; } Sd;
Bill Schmidtb1f5fe02012-10-12 19:26:17 +00006typedef struct s4 { Sf fs; } SSf;
7typedef struct s5 { Sd ds; } SSd;
Bill Schmidtb1f5fe02012-10-12 19:26:17 +00008
Bill Schmidtcfe9f322012-10-12 20:07:31 +00009void bar(Sf a, Sd b, SSf d, SSd e) {}
Bill Schmidtb1f5fe02012-10-12 19:26:17 +000010
Stephen Lin93ab6bf2013-08-15 06:47:53 +000011// CHECK-LABEL: define void @bar
Bill Schmidtb1f5fe02012-10-12 19:26:17 +000012// CHECK: %a = alloca %struct.s1, align 4
13// CHECK: %b = alloca %struct.s2, align 8
Bill Schmidtb1f5fe02012-10-12 19:26:17 +000014// CHECK: %d = alloca %struct.s4, align 4
15// CHECK: %e = alloca %struct.s5, align 8
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070016// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1, %struct.s1* %a, i32 0, i32 0
Bill Schmidtcfe9f322012-10-12 20:07:31 +000017// CHECK: store float %a.coerce, float* %{{[a-zA-Z0-9.]+}}, align 1
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070018// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2, %struct.s2* %b, i32 0, i32 0
Bill Schmidtcfe9f322012-10-12 20:07:31 +000019// CHECK: store double %b.coerce, double* %{{[a-zA-Z0-9.]+}}, align 1
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070020// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s4, %struct.s4* %d, i32 0, i32 0
21// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1, %struct.s1* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
Bill Schmidtcfe9f322012-10-12 20:07:31 +000022// CHECK: store float %d.coerce, float* %{{[a-zA-Z0-9.]+}}, align 1
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070023// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s5, %struct.s5* %e, i32 0, i32 0
24// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2, %struct.s2* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
Bill Schmidtcfe9f322012-10-12 20:07:31 +000025// CHECK: store double %e.coerce, double* %{{[a-zA-Z0-9.]+}}, align 1
Bill Schmidtb1f5fe02012-10-12 19:26:17 +000026// CHECK: ret void
27
28void foo(void)
29{
30 Sf p1 = { 22.63f };
31 Sd p2 = { 19.47 };
Bill Schmidtb1f5fe02012-10-12 19:26:17 +000032 SSf p4 = { { 22.63f } };
33 SSd p5 = { { 19.47 } };
Bill Schmidtcfe9f322012-10-12 20:07:31 +000034 bar(p1, p2, p4, p5);
Bill Schmidtb1f5fe02012-10-12 19:26:17 +000035}
36
Stephen Lin93ab6bf2013-08-15 06:47:53 +000037// CHECK-LABEL: define void @foo
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -070038// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1, %struct.s1* %p1, i32 0, i32 0
39// CHECK: %{{[0-9]+}} = load float, float* %{{[a-zA-Z0-9.]+}}, align 1
40// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2, %struct.s2* %p2, i32 0, i32 0
41// CHECK: %{{[0-9]+}} = load double, double* %{{[a-zA-Z0-9.]+}}, align 1
42// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s4, %struct.s4* %p4, i32 0, i32 0
43// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1, %struct.s1* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
44// CHECK: %{{[0-9]+}} = load float, float* %{{[a-zA-Z0-9.]+}}, align 1
45// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s5, %struct.s5* %p5, i32 0, i32 0
46// CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2, %struct.s2* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0
47// CHECK: %{{[0-9]+}} = load double, double* %{{[a-zA-Z0-9.]+}}, align 1
Bill Schmidtcfe9f322012-10-12 20:07:31 +000048// CHECK: call void @bar(float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}}, float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}})
Bill Schmidtb1f5fe02012-10-12 19:26:17 +000049// CHECK: ret void