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; |
| 6 | typedef struct s3 { long double ld; } Sld; |
| 7 | typedef struct s4 { Sf fs; } SSf; |
| 8 | typedef struct s5 { Sd ds; } SSd; |
| 9 | typedef struct s6 { Sld lds; } SSld; |
| 10 | |
| 11 | void bar(Sf a, Sd b, Sld c, SSf d, SSd e, SSld f) {} |
| 12 | |
| 13 | // CHECK: define void @bar |
| 14 | // CHECK: %a = alloca %struct.s1, align 4 |
| 15 | // CHECK: %b = alloca %struct.s2, align 8 |
| 16 | // CHECK: %c = alloca %struct.s3, align 16 |
| 17 | // CHECK: %d = alloca %struct.s4, align 4 |
| 18 | // CHECK: %e = alloca %struct.s5, align 8 |
| 19 | // CHECK: %f = alloca %struct.s6, align 16 |
| 20 | // CHECK: %coerce.dive = getelementptr %struct.s1* %a, i32 0, i32 0 |
| 21 | // CHECK: store float %a.coerce, float* %coerce.dive, align 1 |
| 22 | // CHECK: %coerce.dive1 = getelementptr %struct.s2* %b, i32 0, i32 0 |
| 23 | // CHECK: store double %b.coerce, double* %coerce.dive1, align 1 |
| 24 | // CHECK: %coerce.dive2 = getelementptr %struct.s3* %c, i32 0, i32 0 |
| 25 | // CHECK: store ppc_fp128 %c.coerce, ppc_fp128* %coerce.dive2, align 1 |
| 26 | // CHECK: %coerce.dive3 = getelementptr %struct.s4* %d, i32 0, i32 0 |
| 27 | // CHECK: %coerce.dive4 = getelementptr %struct.s1* %coerce.dive3, i32 0, i32 0 |
| 28 | // CHECK: store float %d.coerce, float* %coerce.dive4, align 1 |
| 29 | // CHECK: %coerce.dive5 = getelementptr %struct.s5* %e, i32 0, i32 0 |
| 30 | // CHECK: %coerce.dive6 = getelementptr %struct.s2* %coerce.dive5, i32 0, i32 0 |
| 31 | // CHECK: store double %e.coerce, double* %coerce.dive6, align 1 |
| 32 | // CHECK: %coerce.dive7 = getelementptr %struct.s6* %f, i32 0, i32 0 |
| 33 | // CHECK: %coerce.dive8 = getelementptr %struct.s3* %coerce.dive7, i32 0, i32 0 |
| 34 | // CHECK: store ppc_fp128 %f.coerce, ppc_fp128* %coerce.dive8, align 1 |
| 35 | // CHECK: ret void |
| 36 | |
| 37 | void foo(void) |
| 38 | { |
| 39 | Sf p1 = { 22.63f }; |
| 40 | Sd p2 = { 19.47 }; |
| 41 | Sld p3 = { -155.1l }; |
| 42 | SSf p4 = { { 22.63f } }; |
| 43 | SSd p5 = { { 19.47 } }; |
| 44 | SSld p6 = { { -155.1l } }; |
| 45 | bar(p1, p2, p3, p4, p5, p6); |
| 46 | } |
| 47 | |
| 48 | // CHECK: define void @foo |
| 49 | // CHECK: %coerce.dive = getelementptr %struct.s1* %p1, i32 0, i32 0 |
| 50 | // CHECK: %{{[0-9]+}} = load float* %coerce.dive, align 1 |
| 51 | // CHECK: %coerce.dive1 = getelementptr %struct.s2* %p2, i32 0, i32 0 |
| 52 | // CHECK: %{{[0-9]+}} = load double* %coerce.dive1, align 1 |
| 53 | // CHECK: %coerce.dive2 = getelementptr %struct.s3* %p3, i32 0, i32 0 |
| 54 | // CHECK: %{{[0-9]+}} = load ppc_fp128* %coerce.dive2, align 1 |
| 55 | // CHECK: %coerce.dive3 = getelementptr %struct.s4* %p4, i32 0, i32 0 |
| 56 | // CHECK: %coerce.dive4 = getelementptr %struct.s1* %coerce.dive3, i32 0, i32 0 |
| 57 | // CHECK: %{{[0-9]+}} = load float* %coerce.dive4, align 1 |
| 58 | // CHECK: %coerce.dive5 = getelementptr %struct.s5* %p5, i32 0, i32 0 |
| 59 | // CHECK: %coerce.dive6 = getelementptr %struct.s2* %coerce.dive5, i32 0, i32 0 |
| 60 | // CHECK: %{{[0-9]+}} = load double* %coerce.dive6, align 1 |
| 61 | // CHECK: %coerce.dive7 = getelementptr %struct.s6* %p6, i32 0, i32 0 |
| 62 | // CHECK: %coerce.dive8 = getelementptr %struct.s3* %coerce.dive7, i32 0, i32 0 |
| 63 | // CHECK: %{{[0-9]+}} = load ppc_fp128* %coerce.dive8, align 1 |
| 64 | // CHECK: call void @bar(float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}}, ppc_fp128 inreg %{{[0-9]+}}, float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}}, ppc_fp128 inreg %{{[0-9]+}}) |
| 65 | // CHECK: ret void |