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