File: transparent-union-type.c

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,388 kB
  • sloc: cpp: 7,438,767; ansic: 1,393,871; asm: 1,012,926; python: 241,728; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (108 lines) | stat: -rw-r--r-- 4,295 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// RUN: %clang_cc1 -triple powerpc64le-linux -O2 -target-cpu pwr7 -emit-llvm \
// RUN:   -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
// RUN: %clang_cc1 -triple powerpc64-linux -O2 -target-cpu pwr7 -emit-llvm \
// RUN:   -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
// RUN: %clang_cc1 -triple powerpc-linux -O2 -target-cpu pwr7 -emit-llvm \
// RUN:   -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
// RUN: %clang_cc1 -triple powerpc64-aix -O2 -target-cpu pwr7 -emit-llvm \
// RUN:   -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
// RUN: %clang_cc1 -triple powerpc-aix -O2 -target-cpu pwr7 -emit-llvm \
// RUN:   -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
// RUN: %clang_cc1 -triple riscv64-linux -O2 -emit-llvm -fshort-enums \
// RUN:   %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
// RUN: %clang_cc1 -triple riscv32-linux -O2 -emit-llvm -fshort-enums \
// RUN:   %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
// RUN: %clang_cc1 -triple i386-linux -O2 -emit-llvm -fshort-enums \
// RUN:   %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
// RUN: %clang_cc1 -triple x86_64-linux -O2 -emit-llvm -fshort-enums \
// RUN:   %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
// RUN: %clang_cc1 -triple armv7-linux -O2 -emit-llvm -fshort-enums \
// RUN:   %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-32
// RUN: %clang_cc1 -triple arm64 -target-abi darwinpcs -O2 -emit-llvm \
// RUN:   -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64
// RUN: %clang_cc1 -triple aarch64 -target-abi darwinpcs -O2 -emit-llvm \
// RUN:   -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-64

typedef union tu_c {
  signed char a;
  signed char b;
} tu_c_t __attribute__((transparent_union));

typedef union tu_s {
  short a;
} tu_s_t __attribute__((transparent_union));

typedef union tu_us {
  unsigned short a;
} tu_us_t __attribute__((transparent_union));

typedef union tu_l {
  long a;
} tu_l_t __attribute__((transparent_union));

// CHECK-LABEL: define{{.*}} void @ftest0(
// CHECK-SAME: i8 noundef signext [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
// CHECK-NEXT:  [[ENTRY:.*:]]
// CHECK-NEXT:    ret void
void ftest0(tu_c_t uc) { }

// CHECK-LABEL: define{{.*}} void @ftest1(
// CHECK-SAME: i16 noundef signext [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT:  [[ENTRY:.*:]]
// CHECK-NEXT:    ret void
void ftest1(tu_s_t uc) { }

// CHECK-LABEL: define{{.*}} void @ftest1b(
// CHECK-SAME: ptr nocapture noundef readnone [[UC:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT:  [[ENTRY:.*:]]
// CHECK-NEXT:    ret void
//
void ftest1b(tu_s_t *uc) { }

// CHECK-LABEL: define{{.*}} void @ftest2(
// CHECK-SAME: i16 noundef zeroext [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT:  [[ENTRY:.*:]]
// CHECK-NEXT:    ret void
void ftest2(tu_us_t uc) { }

// CHECK-64-LABEL: define{{.*}} void @ftest3(
// CHECK-64-SAME: i64 [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-64-NEXT:  [[ENTRY:.*:]]
// CHECK-64-NEXT:    ret void
//
// CHECK-32-LABEL: define{{.*}} void @ftest3(
// CHECK-32-SAME: i32 [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-32-NEXT:  [[ENTRY:.*:]]
// CHECK-32-NEXT:    ret void
void ftest3(tu_l_t uc) { }

typedef union etest {
  enum flag {red, yellow, blue} fl;
  enum weekend {sun, sat} b;
} etest_t __attribute__((transparent_union));

// CHECK-LABEL: define{{.*}} void @ftest4(
// CHECK-SAME: i8 noundef zeroext [[A_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
// CHECK-NEXT:  [[ENTRY:.*:]]
// CHECK-NEXT:    ret void
void ftest4(etest_t a) {}

typedef union tu_ptr {
  signed char *a;
  unsigned short *b;
  int *c;
} tu_ptr_t __attribute__((transparent_union));

// CHECK-LABEL: define{{.*}} void @ftest5(
// CHECK-SAME: ptr nocapture readnone [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
// CHECK-NEXT:  [[ENTRY:.*:]]
// CHECK-NEXT:    ret void
//
void ftest5(tu_ptr_t uc) { }

// CHECK-LABEL: define{{.*}} void @ftest6(
// CHECK-SAME: ptr nocapture noundef readnone [[UC:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT:  [[ENTRY:.*:]]
// CHECK-NEXT:    ret void
//
void ftest6(tu_ptr_t *uc) { }