1 // A basic clang -cc1 command-line, and simple environment check. 2 3 // RUN: %clang %s -### -no-canonical-prefixes -target riscv64 \ 4 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree 2>&1 \ 5 // RUN: | FileCheck -check-prefix=CC1 %s 6 // CC1: clang{{.*}} "-cc1" "-triple" "riscv64" 7 8 // Test interaction with -fuse-ld=lld, if lld is available. 9 // RUN: %clang %s -### -no-canonical-prefixes -target riscv32 -fuse-ld=lld \ 10 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree 2>&1 \ 11 // RUN: | FileCheck -check-prefix=LLD %s 12 // LLD: {{(error: invalid linker name in argument '-fuse-ld=lld')|(ld.lld)}} 13 14 // In the below tests, --rtlib=platform is used so that the driver ignores 15 // the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib 16 17 // RUN: %clang %s -### -no-canonical-prefixes -fuse-ld= \ 18 // RUN: -target riscv64-unknown-elf --rtlib=platform \ 19 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree \ 20 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf 2>&1 \ 21 // RUN: | FileCheck -check-prefix=C-RV64-BAREMETAL-LP64 %s 22 23 // C-RV64-BAREMETAL-LP64: "{{.*}}Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}bin{{/|\\\\}}riscv64-unknown-elf-ld" 24 // C-RV64-BAREMETAL-LP64: "--sysroot={{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf" 25 // C-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf/lib{{/|\\\\}}crt0.o" 26 // C-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" 27 // C-RV64-BAREMETAL-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1" 28 // C-RV64-BAREMETAL-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf/lib" 29 // C-RV64-BAREMETAL-LP64: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" 30 // C-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o" 31 32 // RUN: %clang %s -### -no-canonical-prefixes -fuse-ld= \ 33 // RUN: -target riscv64-unknown-elf --rtlib=platform \ 34 // RUN: --sysroot= \ 35 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree 2>&1 \ 36 // RUN: | FileCheck -check-prefix=C-RV64-BAREMETAL-NOSYSROOT-LP64 %s 37 38 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}bin{{/|\\\\}}riscv64-unknown-elf-ld" 39 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib{{/|\\\\}}crt0.o" 40 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" 41 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1" 42 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf{{/|\\\\}}lib" 43 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" 44 // C-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o" 45 46 // RUN: %clangxx %s -### -no-canonical-prefixes -fuse-ld= \ 47 // RUN: -target riscv64-unknown-elf -stdlib=libstdc++ --rtlib=platform \ 48 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree \ 49 // RUN: --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf 2>&1 \ 50 // RUN: | FileCheck -check-prefix=CXX-RV64-BAREMETAL-LP64 %s 51 52 // CXX-RV64-BAREMETAL-LP64: "-internal-isystem" "{{.*}}Inputs/basic_riscv64_tree/riscv64-unknown-elf/include/c++{{/|\\\\}}8.0.1" 53 // CXX-RV64-BAREMETAL-LP64: "{{.*}}Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}bin{{/|\\\\}}riscv64-unknown-elf-ld" 54 // CXX-RV64-BAREMETAL-LP64: "--sysroot={{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf" 55 // CXX-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf/lib{{/|\\\\}}crt0.o" 56 // CXX-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" 57 // CXX-RV64-BAREMETAL-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1" 58 // CXX-RV64-BAREMETAL-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/riscv64-unknown-elf/lib" 59 // CXX-RV64-BAREMETAL-LP64: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" 60 // CXX-RV64-BAREMETAL-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o" 61 62 // RUN: %clangxx %s -### -no-canonical-prefixes -fuse-ld= \ 63 // RUN: -target riscv64-unknown-elf -stdlib=libstdc++ --rtlib=platform \ 64 // RUN: --sysroot= \ 65 // RUN: --gcc-toolchain=%S/Inputs/basic_riscv64_tree 2>&1 \ 66 // RUN: | FileCheck -check-prefix=CXX-RV64-BAREMETAL-NOSYSROOT-LP64 %s 67 68 // CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "-internal-isystem" "{{.*}}Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/include/c++{{/|\\\\}}8.0.1" 69 // CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}bin{{/|\\\\}}riscv64-unknown-elf-ld" 70 // CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib{{/|\\\\}}crt0.o" 71 // CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" 72 // CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1" 73 // CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "-L{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib" 74 // CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" 75 // CXX-RV64-BAREMETAL-NOSYSROOT-LP64: "{{.*}}/Inputs/basic_riscv64_tree/lib/gcc/riscv64-unknown-elf/8.0.1{{/|\\\\}}crtend.o" 76 77 // RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld -fuse-ld= \ 78 // RUN: -target riscv64-unknown-linux-gnu --rtlib=platform -mabi=lp64 \ 79 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \ 80 // RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \ 81 // RUN: | FileCheck -check-prefix=C-RV64-LINUX-MULTI-LP64 %s 82 83 // C-RV64-LINUX-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-linux-gnu/bin{{/|\\\\}}ld" 84 // C-RV64-LINUX-MULTI-LP64: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" 85 // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv" 86 // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64.so.1" 87 // C-RV64-LINUX-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64{{/|\\\\}}crtbegin.o" 88 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64" 89 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64" 90 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64" 91 92 // RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \ 93 // RUN: -target riscv64-unknown-linux-gnu --rtlib=platform -march=rv64imafd \ 94 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \ 95 // RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \ 96 // RUN: | FileCheck -check-prefix=C-RV64-LINUX-MULTI-LP64D %s 97 98 // C-RV64-LINUX-MULTI-LP64D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-linux-gnu/bin{{/|\\\\}}ld" 99 // C-RV64-LINUX-MULTI-LP64D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" 100 // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv" 101 // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64d.so.1" 102 // C-RV64-LINUX-MULTI-LP64D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d{{/|\\\\}}crtbegin.o" 103 // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d" 104 // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d" 105 // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d" 106 107 // RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \ 108 // RUN: -target riscv64-unknown-elf --rtlib=platform --sysroot= \ 109 // RUN: -march=rv64imac -mabi=lp64\ 110 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk 2>&1 \ 111 // RUN: | FileCheck -check-prefix=C-RV64IMAC-BAREMETAL-MULTI-LP64 %s 112 113 // C-RV64IMAC-BAREMETAL-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/bin{{/|\\\\}}ld" 114 // C-RV64IMAC-BAREMETAL-MULTI-LP64: "-m" "elf64lriscv" 115 // C-RV64IMAC-BAREMETAL-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib/rv64imac/lp64{{/|\\\\}}crt0.o" 116 // C-RV64IMAC-BAREMETAL-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imac/lp64{{/|\\\\}}crtbegin.o" 117 // C-RV64IMAC-BAREMETAL-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0" 118 // C-RV64IMAC-BAREMETAL-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib" 119 // C-RV64IMAC-BAREMETAL-MULTI-LP64: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" 120 // C-RV64IMAC-BAREMETAL-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imac/lp64{{/|\\\\}}crtend.o" 121 122 // RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \ 123 // RUN: -target riscv64-unknown-elf --rtlib=platform --sysroot= \ 124 // RUN: -march=rv64imafdc -mabi=lp64d \ 125 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk 2>&1 \ 126 // RUN: | FileCheck -check-prefix=C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D %s 127 128 // C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/bin{{/|\\\\}}ld" 129 // C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D: "-m" "elf64lriscv" 130 // C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib/rv64imafdc/lp64d{{/|\\\\}}crt0.o" 131 // C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imafdc/lp64d{{/|\\\\}}crtbegin.o" 132 // C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0" 133 // C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D: "-L{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/../../..{{/|\\\\}}..{{/|\\\\}}riscv64-unknown-elf/lib" 134 // C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" 135 // C-RV64IMAFDC-BAREMETAL-MULTI-ILP64D: "{{.*}}/Inputs/multilib_riscv_elf_sdk/lib/gcc/riscv64-unknown-elf/8.2.0/rv64imafdc/lp64d{{/|\\\\}}crtend.o" 136 137 // Check that --rtlib can be used to override the used runtime library 138 // RUN: %clang %s -### -no-canonical-prefixes \ 139 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk \ 140 // RUN: -target riscv64-unknown-elf --rtlib=libgcc 2>&1 \ 141 // RUN: | FileCheck -check-prefix=C-RV64-RTLIB-LIBGCC-LP64 %s 142 // C-RV64-RTLIB-LIBGCC-LP64: "{{.*}}crt0.o" 143 // C-RV64-RTLIB-LIBGCC-LP64: "{{.*}}crtbegin.o" 144 // C-RV64-RTLIB-LIBGCC-LP64: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" 145 // C-RV64-RTLIB-LIBGCC-LP64: "{{.*}}crtend.o" 146 147 // RUN: %clang %s -### -no-canonical-prefixes \ 148 // RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_elf_sdk \ 149 // RUN: -target riscv64-unknown-elf --rtlib=compiler-rt 2>&1 \ 150 // RUN: | FileCheck -check-prefix=C-RV64-RTLIB-COMPILERRT-LP64 %s 151 // C-RV64-RTLIB-COMPILERRT-LP64: "{{.*}}crt0.o" 152 // C-RV64-RTLIB-COMPILERRT-LP64: "{{.*}}clang_rt.crtbegin-riscv64.o" 153 // C-RV64-RTLIB-COMPILERRT-LP64: "--start-group" "-lc" "-lgloss" "--end-group" "{{.*}}libclang_rt.builtins-riscv64.a" 154 // C-RV64-RTLIB-COMPILERRT-LP64: "{{.*}}clang_rt.crtend-riscv64.o" 155 156 // RUN: %clang -target riscv64 %s -emit-llvm -S -o - | FileCheck %s 157 158 typedef __builtin_va_list va_list; 159 typedef __SIZE_TYPE__ size_t; 160 typedef __PTRDIFF_TYPE__ ptrdiff_t; 161 typedef __WCHAR_TYPE__ wchar_t; 162 typedef __WINT_TYPE__ wint_t; 163 164 165 // Check Alignments 166 167 // CHECK: @align_c = dso_local global i32 1 168 int align_c = __alignof(char); 169 170 // CHECK: @align_s = dso_local global i32 2 171 int align_s = __alignof(short); 172 173 // CHECK: @align_i = dso_local global i32 4 174 int align_i = __alignof(int); 175 176 // CHECK: @align_wc = dso_local global i32 4 177 int align_wc = __alignof(wchar_t); 178 179 // CHECK: @align_wi = dso_local global i32 4 180 int align_wi = __alignof(wint_t); 181 182 // CHECK: @align_l = dso_local global i32 8 183 int align_l = __alignof(long); 184 185 // CHECK: @align_ll = dso_local global i32 8 186 int align_ll = __alignof(long long); 187 188 // CHECK: @align_p = dso_local global i32 8 189 int align_p = __alignof(void*); 190 191 // CHECK: @align_f = dso_local global i32 4 192 int align_f = __alignof(float); 193 194 // CHECK: @align_d = dso_local global i32 8 195 int align_d = __alignof(double); 196 197 // CHECK: @align_ld = dso_local global i32 16 198 int align_ld = __alignof(long double); 199 200 // CHECK: @align_vl = dso_local global i32 8 201 int align_vl = __alignof(va_list); 202 203 // CHECK: @align_a_c = dso_local global i32 1 204 int align_a_c = __alignof(_Atomic(char)); 205 206 // CHECK: @align_a_s = dso_local global i32 2 207 int align_a_s = __alignof(_Atomic(short)); 208 209 // CHECK: @align_a_i = dso_local global i32 4 210 int align_a_i = __alignof(_Atomic(int)); 211 212 // CHECK: @align_a_wc = dso_local global i32 4 213 int align_a_wc = __alignof(_Atomic(wchar_t)); 214 215 // CHECK: @align_a_wi = dso_local global i32 4 216 int align_a_wi = __alignof(_Atomic(wint_t)); 217 218 // CHECK: @align_a_l = dso_local global i32 8 219 int align_a_l = __alignof(_Atomic(long)); 220 221 // CHECK: @align_a_ll = dso_local global i32 8 222 int align_a_ll = __alignof(_Atomic(long long)); 223 224 // CHECK: @align_a_p = dso_local global i32 8 225 int align_a_p = __alignof(_Atomic(void*)); 226 227 // CHECK: @align_a_f = dso_local global i32 4 228 int align_a_f = __alignof(_Atomic(float)); 229 230 // CHECK: @align_a_d = dso_local global i32 8 231 int align_a_d = __alignof(_Atomic(double)); 232 233 // CHECK: @align_a_ld = dso_local global i32 16 234 int align_a_ld = __alignof(_Atomic(long double)); 235 236 // CHECK: @align_a_s4 = dso_local global i32 4 237 int align_a_s4 = __alignof(_Atomic(struct { char _[4]; })); 238 239 // CHECK: @align_a_s8 = dso_local global i32 8 240 int align_a_s8 = __alignof(_Atomic(struct { char _[8]; })); 241 242 // CHECK: @align_a_s16 = dso_local global i32 16 243 int align_a_s16 = __alignof(_Atomic(struct { char _[16]; })); 244 245 // CHECK: @align_a_s32 = dso_local global i32 1 246 int align_a_s32 = __alignof(_Atomic(struct { char _[32]; })); 247 248 249 // Check Sizes 250 251 // CHECK: @size_a_c = dso_local global i32 1 252 int size_a_c = sizeof(_Atomic(char)); 253 254 // CHECK: @size_a_s = dso_local global i32 2 255 int size_a_s = sizeof(_Atomic(short)); 256 257 // CHECK: @size_a_i = dso_local global i32 4 258 int size_a_i = sizeof(_Atomic(int)); 259 260 // CHECK: @size_a_wc = dso_local global i32 4 261 int size_a_wc = sizeof(_Atomic(wchar_t)); 262 263 // CHECK: @size_a_wi = dso_local global i32 4 264 int size_a_wi = sizeof(_Atomic(wint_t)); 265 266 // CHECK: @size_a_l = dso_local global i32 8 267 int size_a_l = sizeof(_Atomic(long)); 268 269 // CHECK: @size_a_ll = dso_local global i32 8 270 int size_a_ll = sizeof(_Atomic(long long)); 271 272 // CHECK: @size_a_p = dso_local global i32 8 273 int size_a_p = sizeof(_Atomic(void*)); 274 275 // CHECK: @size_a_f = dso_local global i32 4 276 int size_a_f = sizeof(_Atomic(float)); 277 278 // CHECK: @size_a_d = dso_local global i32 8 279 int size_a_d = sizeof(_Atomic(double)); 280 281 // CHECK: @size_a_ld = dso_local global i32 16 282 int size_a_ld = sizeof(_Atomic(long double)); 283 284 285 // Check types 286 287 // CHECK: define dso_local zeroext i8 @check_char() check_char()288char check_char() { return 0; } 289 290 // CHECK: define dso_local signext i16 @check_short() check_short()291short check_short() { return 0; } 292 293 // CHECK: define dso_local signext i32 @check_int() check_int()294int check_int() { return 0; } 295 296 // CHECK: define dso_local signext i32 @check_wchar_t() check_wchar_t()297int check_wchar_t() { return 0; } 298 299 // CHECK: define dso_local i64 @check_long() check_long()300long check_long() { return 0; } 301 302 // CHECK: define dso_local i64 @check_longlong() check_longlong()303long long check_longlong() { return 0; } 304 305 // CHECK: define dso_local zeroext i8 @check_uchar() check_uchar()306unsigned char check_uchar() { return 0; } 307 308 // CHECK: define dso_local zeroext i16 @check_ushort() check_ushort()309unsigned short check_ushort() { return 0; } 310 311 // CHECK: define dso_local signext i32 @check_uint() check_uint()312unsigned int check_uint() { return 0; } 313 314 // CHECK: define dso_local i64 @check_ulong() check_ulong()315unsigned long check_ulong() { return 0; } 316 317 // CHECK: define dso_local i64 @check_ulonglong() check_ulonglong()318unsigned long long check_ulonglong() { return 0; } 319 320 // CHECK: define dso_local i64 @check_size_t() check_size_t()321size_t check_size_t() { return 0; } 322 323 // CHECK: define dso_local float @check_float() check_float()324float check_float() { return 0; } 325 326 // CHECK: define dso_local double @check_double() check_double()327double check_double() { return 0; } 328 329 // CHECK: define dso_local fp128 @check_longdouble() check_longdouble()330long double check_longdouble() { return 0; } 331