109 lines · c
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-643// RUN: %clang_cc1 -triple powerpc64-linux -O2 -target-cpu pwr7 -emit-llvm \4// RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-645// RUN: %clang_cc1 -triple powerpc-linux -O2 -target-cpu pwr7 -emit-llvm \6// RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-327// RUN: %clang_cc1 -triple powerpc64-aix -O2 -target-cpu pwr7 -emit-llvm \8// RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-649// RUN: %clang_cc1 -triple powerpc-aix -O2 -target-cpu pwr7 -emit-llvm \10// RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-3211// RUN: %clang_cc1 -triple riscv64-linux -O2 -emit-llvm -fshort-enums \12// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-6413// RUN: %clang_cc1 -triple riscv32-linux -O2 -emit-llvm -fshort-enums \14// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-3215// RUN: %clang_cc1 -triple i386-linux -O2 -emit-llvm -fshort-enums \16// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-3217// RUN: %clang_cc1 -triple x86_64-linux -O2 -emit-llvm -fshort-enums \18// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-6419// RUN: %clang_cc1 -triple armv7-linux -O2 -emit-llvm -fshort-enums \20// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-3221// RUN: %clang_cc1 -triple arm64 -target-abi darwinpcs -O2 -emit-llvm \22// RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-6423// RUN: %clang_cc1 -triple aarch64 -target-abi darwinpcs -O2 -emit-llvm \24// RUN: -fshort-enums %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-6425 26typedef union tu_c {27 signed char a;28 signed char b;29} tu_c_t __attribute__((transparent_union));30 31typedef union tu_s {32 short a;33} tu_s_t __attribute__((transparent_union));34 35typedef union tu_us {36 unsigned short a;37} tu_us_t __attribute__((transparent_union));38 39typedef union tu_l {40 long a;41} tu_l_t __attribute__((transparent_union));42 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 void47void ftest0(tu_c_t uc) { }48 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 void53void ftest1(tu_s_t uc) { }54 55// CHECK-LABEL: define{{.*}} void @ftest1b(56// CHECK-SAME: ptr noundef readnone captures(none) [[UC:%.*]]) local_unnamed_addr #[[ATTR0]] {57// CHECK-NEXT: [[ENTRY:.*:]]58// CHECK-NEXT: ret void59//60void ftest1b(tu_s_t *uc) { }61 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 void66void ftest2(tu_us_t uc) { }67 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 void72//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 void77void ftest3(tu_l_t uc) { }78 79typedef union etest {80 enum flag {red, yellow, blue} fl;81 enum weekend {sun, sat} b;82} etest_t __attribute__((transparent_union));83 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 void88void ftest4(etest_t a) {}89 90typedef union tu_ptr {91 signed char *a;92 unsigned short *b;93 int *c;94} tu_ptr_t __attribute__((transparent_union));95 96// CHECK-LABEL: define{{.*}} void @ftest5(97// CHECK-SAME: ptr readnone captures(none) [[UC_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {98// CHECK-NEXT: [[ENTRY:.*:]]99// CHECK-NEXT: ret void100//101void ftest5(tu_ptr_t uc) { }102 103// CHECK-LABEL: define{{.*}} void @ftest6(104// CHECK-SAME: ptr noundef readnone captures(none) [[UC:%.*]]) local_unnamed_addr #[[ATTR0]] {105// CHECK-NEXT: [[ENTRY:.*:]]106// CHECK-NEXT: ret void107//108void ftest6(tu_ptr_t *uc) { }109