[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / SystemZ / align-systemz.c
blob9daff6ee976097440c44e46b299636ccd935cf25
1 // RUN: %clang_cc1 -triple s390x-linux-gnu -emit-llvm %s -o - | FileCheck %s
3 // SystemZ prefers to align all global variables to two bytes.
5 struct test {
6 signed char a;
7 };
9 char c;
10 // CHECK-DAG: @c ={{.*}} global i8 0, align 2
12 struct test s;
13 // CHECK-DAG: @s ={{.*}} global %struct.test zeroinitializer, align 2
15 extern char ec;
16 // CHECK-DAG: @ec = external global i8, align 2
18 extern struct test es;
19 // CHECK-DAG: @es = external global %struct.test, align 2
21 // Dummy function to make sure external symbols are used.
22 void func (void)
24 c = ec;
25 s = es;
28 // Test that a global variable with an incomplete type gets the minimum
29 // alignment of 2 per the ABI if no alignment was specified by user.
31 // CHECK-DAG: @VarNoAl {{.*}} align 2
32 // CHECK-DAG: @VarExplAl1 {{.*}} align 1
33 // CHECK-DAG: @VarExplAl4 {{.*}} align 4
34 struct incomplete_ty;
35 extern struct incomplete_ty VarNoAl;
36 extern struct incomplete_ty __attribute__((aligned(1))) VarExplAl1;
37 extern struct incomplete_ty __attribute__((aligned(4))) VarExplAl4;
38 struct incomplete_ty *fun0 (void) { return &VarNoAl; }
39 struct incomplete_ty *fun1 (void) { return &VarExplAl1; }
40 struct incomplete_ty *fun2 (void) { return &VarExplAl4; }
42 // The SystemZ ABI aligns __int128_t to only eight bytes.
44 struct S_int128 { __int128_t B; } Obj_I128;
45 __int128_t GlobI128;
46 // CHECK: @Obj_I128 = global %struct.S_int128 zeroinitializer, align 8
47 // CHECK: @GlobI128 = global i128 0, align 8
50 // Alignment should be respected for coerced argument loads
52 struct arg { long y __attribute__((packed, aligned(4))); };
54 extern struct arg x;
55 void f(struct arg);
57 void test (void)
59 f(x);
62 // CHECK-LABEL: @test
63 // CHECK: load i64, ptr @x, align 4