[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / clang / test / CodeGen / transparent-union-type.c
blobf7fac25dc098484dbe16e4426c8d7b334035c152
1 // RUN: %clang_cc1 -triple powerpc64le-linux -O2 -target-cpu pwr7 -emit-llvm \
2 // RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
3 // RUN: %clang_cc1 -triple powerpc64-linux -O2 -target-cpu pwr7 -emit-llvm \
4 // RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
5 // RUN: %clang_cc1 -triple powerpc-linux -O2 -target-cpu pwr7 -emit-llvm \
6 // RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
7 // RUN: %clang_cc1 -triple powerpc64-aix -O2 -target-cpu pwr7 -emit-llvm \
8 // RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
9 // RUN: %clang_cc1 -triple powerpc-aix -O2 -target-cpu pwr7 -emit-llvm \
10 // RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
11 // RUN: %clang_cc1 -triple riscv64-linux -O2 -emit-llvm -fshort-enums \
12 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
13 // RUN: %clang_cc1 -triple riscv32-linux -O2 -emit-llvm -fshort-enums \
14 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
15 // RUN: %clang_cc1 -triple i386-linux -O2 -emit-llvm -fshort-enums \
16 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
17 // RUN: %clang_cc1 -triple x86_64-linux -O2 -emit-llvm -fshort-enums \
18 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
19 // RUN: %clang_cc1 -triple armv7-linux -O2 -emit-llvm -fshort-enums \
20 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
21 // RUN: %clang_cc1 -triple arm64 -target-abi darwinpcs -O2 -emit-llvm \
22 // RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
23 // RUN: %clang_cc1 -triple aarch64 -target-abi darwinpcs -O2 -emit-llvm \
24 // RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
26 typedef union tu_c {
27 signed char a;
28 signed char b;
29 } tu_c_t __attribute__((transparent_union));
31 typedef union tu_s {
32 short a;
33 } tu_s_t __attribute__((transparent_union));
35 typedef union tu_us {
36 unsigned short a;
37 } tu_us_t __attribute__((transparent_union));
39 typedef union tu_l {
40 long a;
41 } tu_l_t __attribute__((transparent_union));
43 // CHECK-LABEL: define{{.*}} void @ftest0(
44 // CHECK-SAME: i8 noundef signext [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
45 // CHECK-NEXT: [[ENTRY:.*:]]
46 // CHECK-NEXT: ret void
47 void ftest0(tu_c_t uc) { }
49 // CHECK-LABEL: define{{.*}} void @ftest1(
50 // CHECK-SAME: i16 noundef signext [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
51 // CHECK-NEXT: [[ENTRY:.*:]]
52 // CHECK-NEXT: ret void
53 void ftest1(tu_s_t uc) { }
55 // CHECK-LABEL: define{{.*}} void @ftest1b(
56 // CHECK-SAME: ptr nocapture noundef readnone [[UC:%.*]]) local_unnamed_addr #[[ATTR0]] {
57 // CHECK-NEXT: [[ENTRY:.*:]]
58 // CHECK-NEXT: ret void
60 void ftest1b(tu_s_t *uc) { }
62 // CHECK-LABEL: define{{.*}} void @ftest2(
63 // CHECK-SAME: i16 noundef zeroext [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
64 // CHECK-NEXT: [[ENTRY:.*:]]
65 // CHECK-NEXT: ret void
66 void ftest2(tu_us_t uc) { }
68 // CHECK-64-LABEL: define{{.*}} void @ftest3(
69 // CHECK-64-SAME: i64 [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
70 // CHECK-64-NEXT: [[ENTRY:.*:]]
71 // CHECK-64-NEXT: ret void
73 // CHECK-32-LABEL: define{{.*}} void @ftest3(
74 // CHECK-32-SAME: i32 [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
75 // CHECK-32-NEXT: [[ENTRY:.*:]]
76 // CHECK-32-NEXT: ret void
77 void ftest3(tu_l_t uc) { }
79 typedef union etest {
80 enum flag {red, yellow, blue} fl;
81 enum weekend {sun, sat} b;
82 } etest_t __attribute__((transparent_union));
84 // CHECK-LABEL: define{{.*}} void @ftest4(
85 // CHECK-SAME: i8 noundef zeroext [[A_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
86 // CHECK-NEXT: [[ENTRY:.*:]]
87 // CHECK-NEXT: ret void
88 void ftest4(etest_t a) {}
90 typedef union tu_ptr {
91 signed char *a;
92 unsigned short *b;
93 int *c;
94 } tu_ptr_t __attribute__((transparent_union));
96 // CHECK-LABEL: define{{.*}} void @ftest5(
97 // CHECK-SAME: ptr nocapture readnone [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
98 // CHECK-NEXT: [[ENTRY:.*:]]
99 // CHECK-NEXT: ret void
101 void ftest5(tu_ptr_t uc) { }
103 // CHECK-LABEL: define{{.*}} void @ftest6(
104 // CHECK-SAME: ptr nocapture noundef readnone [[UC:%.*]]) local_unnamed_addr #[[ATTR0]] {
105 // CHECK-NEXT: [[ENTRY:.*:]]
106 // CHECK-NEXT: ret void
108 void ftest6(tu_ptr_t *uc) { }