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