1 // XFAIL: target=aarch64-pc-windows-{{.*}}
2 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=ITANIUM
3 // RUN: %clang_cc1 -triple %ms_abi_triple -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=MSABI
5 // Should be 3 hello strings, two global (of different sizes), the rest are
8 // CHECK: @align = {{(dso_local )?}}global i8 [[ALIGN:[0-9]+]]
9 // ITANIUM: @.str = private unnamed_addr constant [6 x i8] c"hello\00"
10 // MSABI: @"??_C@_05CJBACGMB@hello?$AA@" = linkonce_odr dso_local unnamed_addr constant [6 x i8] c"hello\00", comdat, align 1
11 // ITANIUM: @f1.x = internal global ptr @.str
12 // MSABI: @f1.x = internal global ptr @"??_C@_05CJBACGMB@hello?$AA@"
13 // CHECK: @f2.x = internal global [6 x i8] c"hello\00", align [[ALIGN]]
14 // CHECK: @f3.x = internal global [8 x i8] c"hello\00\00\00", align [[ALIGN]]
15 // ITANIUM: @f4.x = internal global %struct.s { ptr @.str }
16 // MSABI: @f4.x = internal global %struct.s { ptr @"??_C@_05CJBACGMB@hello?$AA@" }
17 // CHECK: @x = {{(dso_local )?}}global [3 x i8] c"ola", align [[ALIGN]]
19 // XFAIL: target=hexagon-{{.*}}
20 // Hexagon aligns arrays of size 8+ bytes to a 64-bit boundary, which
21 // fails the check for "@f3.x = ... align [ALIGN]", since ALIGN is derived
22 // from the alignment of a single i8, which is still 1.
24 // XFAIL: target=csky{{.*}}
25 // CSKY aligns arrays of size 4+ bytes to a 32-bit boundary, which
26 // fails the check for "@f2.x = ... align [ALIGN]", since ALIGN is derived
27 // from the alignment of a single i8, which is still 1.
29 #if defined(__s390x__)
30 unsigned char align
= 2;
32 unsigned char align
= 1;
35 void bar(const char *);
37 // CHECK-LABEL: define {{.*}}void @f0()
40 // ITANIUM: call {{.*}}void @bar({{.*}} @.str
41 // MSABI: call {{.*}}void @bar({{.*}} @"??_C@_05CJBACGMB@hello?$AA@"
44 // CHECK-LABEL: define {{.*}}void @f1()
46 static char *x
= "hello";
48 // CHECK: [[T1:%.*]] = load ptr, ptr @f1.x
49 // CHECK: call {{.*}}void @bar(ptr noundef [[T1:%.*]])
52 // CHECK-LABEL: define {{.*}}void @f2()
54 static char x
[] = "hello";
56 // CHECK: call {{.*}}void @bar({{.*}} @f2.x
59 // CHECK-LABEL: define {{.*}}void @f3()
61 static char x
[8] = "hello";
63 // CHECK: call {{.*}}void @bar({{.*}} @f3.x
68 // CHECK-LABEL: define {{.*}}void @f4()
74 // CHECK: call {{.*}}void @gaz({{.*}} @f4.x