1 // RUN: %clang_cc1 %s -triple x86_64-apple-macosx10.7.2 -emit-llvm -o - | FileCheck %s
3 struct X
{ int x
[6]; };
4 struct Y
{ char x
[13]; struct X y
; } __attribute((packed
));
11 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
14 struct X
test2(void) {
16 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
21 void test3(struct X a
) {
23 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), ptr {{.*}}, i64 24, i1 false)
29 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}, ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), i64 24, i1 false)
36 // CHECK: load i32, ptr getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), align 1
42 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 getelementptr inbounds nuw (%struct.Y, ptr @g, i32 0, i32 1), ptr align 4 %{{.*}}, i64 24, i1 false)
55 } __attribute((packed
));
56 struct YBitfield gbitfield
;
58 unsigned test7(void) {
60 // CHECK: load i32, ptr getelementptr inbounds nuw (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
61 return gbitfield
.y
.b2
;
64 void test8(unsigned x
) {
66 // CHECK: load i32, ptr getelementptr inbounds nuw (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
67 // CHECK: store i32 {{.*}}, ptr getelementptr inbounds nuw (%struct.YBitfield, ptr @gbitfield, i32 0, i32 1), align 1
77 struct TBitfield tbitfield
;
79 unsigned test9(void) {
81 // CHECK: load i16, ptr getelementptr inbounds nuw (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1
85 void test10(unsigned x
) {
87 // CHECK: load i16, ptr getelementptr inbounds nuw (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1
88 // CHECK: store i16 {{.*}}, ptr getelementptr inbounds nuw (%struct.TBitfield, ptr @tbitfield, i32 0, i32 2), align 1