brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 31c438f Raw
82 lines · c
1// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=ITANIUM2// RUN: %clang_cc1 -triple %ms_abi_triple -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK --check-prefix=MSABI3 4// Should be 3 hello strings, two global (of different sizes), the rest are5// shared.6 7// CHECK: @align = {{(dso_local )?}}global i8 [[ALIGN:[0-9]+]]8// ITANIUM: @.str = private unnamed_addr constant [6 x i8] c"hello\00"9// MSABI: @"??_C@_05CJBACGMB@hello?$AA@" = linkonce_odr dso_local unnamed_addr constant [6 x i8] c"hello\00", comdat, align 110// ITANIUM: @f1.x = internal global ptr @.str11// MSABI: @f1.x = internal global ptr @"??_C@_05CJBACGMB@hello?$AA@"12// CHECK: @f2.x = internal global [6 x i8] c"hello\00", align [[ALIGN]]13// CHECK: @f3.x = internal global [8 x i8] c"hello\00\00\00", align [[ALIGN]]14// ITANIUM: @f4.x = internal global %struct.s { ptr @.str }15// MSABI: @f4.x = internal global %struct.s { ptr @"??_C@_05CJBACGMB@hello?$AA@" }16// CHECK: @x = {{(dso_local )?}}global [3 x i8] c"ola", align [[ALIGN]]17 18// XFAIL: target=aarch64-{{.*}}-windows-msvc, target=arm64ec-{{.*}}-windows-msvc19// Arm64 in MSVC mode aligns arrays to either 32-bit or 64-bit boundaries, which fails20// various checks above, since ALIGN is derived from the alignment of a single21// i8, which is still 1.22 23// XFAIL: target=hexagon-{{.*}}24// Hexagon aligns arrays of size 8+ bytes to a 64-bit boundary, which25// fails the check for "@f3.x = ... align [ALIGN]", since ALIGN is derived26// from the alignment of a single i8, which is still 1.27 28// XFAIL: target=csky{{.*}}29// CSKY aligns arrays of size 4+ bytes to a 32-bit boundary, which30// fails the check for "@f2.x = ... align [ALIGN]", since ALIGN is derived31// from the alignment of a single i8, which is still 1.32 33#if defined(__s390x__)34unsigned char align = 2;35#else36unsigned char align = 1;37#endif38 39void bar(const char *);40 41// CHECK-LABEL: define {{.*}}void @f0()42void f0(void) {43  bar("hello");44  // ITANIUM: call {{.*}}void @bar({{.*}} @.str45  // MSABI: call {{.*}}void @bar({{.*}} @"??_C@_05CJBACGMB@hello?$AA@"46}47 48// CHECK-LABEL: define {{.*}}void @f1()49void f1(void) {50  static char *x = "hello";51  bar(x);52  // CHECK: [[T1:%.*]] = load ptr, ptr @f1.x53  // CHECK: call {{.*}}void @bar(ptr noundef [[T1:%.*]])54}55 56// CHECK-LABEL: define {{.*}}void @f2()57void f2(void) {58  static char x[] = "hello";59  bar(x);60  // CHECK: call {{.*}}void @bar({{.*}} @f2.x61}62 63// CHECK-LABEL: define {{.*}}void @f3()64void f3(void) {65  static char x[8] = "hello";66  bar(x);67  // CHECK: call {{.*}}void @bar({{.*}} @f3.x68}69 70void gaz(void *);71 72// CHECK-LABEL: define {{.*}}void @f4()73void f4(void) {74  static struct s {75    char *name;76  } x = { "hello" };77  gaz(&x);78  // CHECK: call {{.*}}void @gaz({{.*}} @f4.x79}80 81char x[3] = "ola";82