]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/packed-nest-unpacked.c
Vendor import of clang trunk r154661:
[FreeBSD/FreeBSD.git] / test / CodeGen / packed-nest-unpacked.c
1 // RUN: %clang_cc1 %s -triple x86_64-apple-macosx10.7.2 -emit-llvm -o - | FileCheck %s
2 // <rdar://problem/10463337>
3
4 struct X { int x[6]; };
5 struct Y { char x[13]; struct X y; } __attribute((packed));
6 struct Y g;
7 void f(struct X);
8
9 struct X test1() {
10   // CHECK: @test1
11   // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* bitcast (%struct.X* getelementptr inbounds (%struct.Y* @g, i32 0, i32 1) to i8*), i64 24, i32 1, i1 false)
12   return g.y;
13 }
14 struct X test2() {
15   // CHECK: @test2
16   // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* bitcast (%struct.X* getelementptr inbounds (%struct.Y* @g, i32 0, i32 1) to i8*), i64 24, i32 1, i1 false)
17   struct X a = g.y;
18   return a;
19 }
20
21 void test3(struct X a) {
22   // CHECK: @test3
23   // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* bitcast (%struct.X* getelementptr inbounds (%struct.Y* @g, i32 0, i32 1) to i8*), i8* {{.*}}, i64 24, i32 1, i1 false)
24   g.y = a;
25 }
26
27 void test4() {
28   // CHECK: @test4
29   // FIXME: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* bitcast (%struct.X* getelementptr inbounds (%struct.Y* @g, i32 0, i32 1) to i8*), i64 24, i32 1, i1 false)
30   f(g.y);
31 }