brintos

brintos / llvm-project-archived public Read only

0
0
Text · 19.8 KiB · 378f3d9 Raw
404 lines · c
1// UNSUPPORTED: system-windows2// 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 %s7// 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 %s13// LLD: ld.lld14 15// In the below tests, --rtlib=platform is used so that the driver ignores16// the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib17 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 %s23 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" "-lgcc" "-lc" "-lgloss" "--end-group"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 %s39 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" "-lgcc" "-lc" "-lgloss" "--end-group"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 %s53 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" "-lgcc" "-lc" "-lgloss" "--end-group"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 %s69 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" "-lgcc" "-lc" "-lgloss" "--end-group"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 %s84 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 %s99 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 %s114 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" "-lgcc" "-lc" "-lgloss" "--end-group"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 %s129 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" "-lgcc" "-lc" "-lgloss" "--end-group"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 library140// 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 %s144// C-RV64-RTLIB-LIBGCC-LP64: "{{.*}}crt0.o"145// C-RV64-RTLIB-LIBGCC-LP64: "{{.*}}crtbegin.o"146// C-RV64-RTLIB-LIBGCC-LP64: "--start-group" "-lgcc" "-lc" "-lgloss" "--end-group"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 %s153// 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" "{{.*}}libclang_rt.builtins.a" "-lc" "-lgloss" "--end-group"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 %s162// 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 %s169// 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 %s173 174/// Check that "--no-relax" is forwarded to the linker for RISC-V.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 %s180// CHECK-RV64-NORELAX: "--no-relax"181 182/// Check that "--no-relax" is not forwarded to the linker for RISC-V.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 %s188// 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 %s196// 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 %s204// CHECK-RV64-GNU-RELAX-NOT: "--no-relax"205 206/// Check that "-static -pie" is forwarded to linker when "-static-pie" is used207// RUN: %clang -static-pie -### %s -fuse-ld= \208// RUN:   --target=riscv64-unknown-elf -rtlib=platform --unwindlib=platform \209// RUN:   --gcc-toolchain=%S/Inputs/basic_riscv64_tree \210// RUN:   --sysroot=%S/Inputs/basic_riscv64_tree/riscv64-unknown-elf 2>&1 \211// RUN:   | FileCheck -check-prefix=C-RV64-STATIC-PIE %s212 213// C-RV64-STATIC-PIE: "-Bstatic" "-pie" "--no-dynamic-linker" "-z" "text" "-m" "elf64lriscv" "-X"214// C-RV64-STATIC-PIE: "{{.*}}rcrt1.o"215// C-RV64-STATIC-PIE: "{{.*}}crtbeginS.o"216// C-RV64-STATIC-PIE: "--start-group" "-lgcc" "-lc" "-lgloss" "--end-group"217// C-RV64-STATIC-PIE: "{{.*}}crtendS.o"218 219typedef __builtin_va_list va_list;220typedef __SIZE_TYPE__ size_t;221typedef __PTRDIFF_TYPE__ ptrdiff_t;222typedef __WCHAR_TYPE__ wchar_t;223typedef __WINT_TYPE__ wint_t;224 225 226// Check Alignments227 228// CHECK: @align_c = dso_local global i32 1229int align_c = __alignof(char);230 231// CHECK: @align_s = dso_local global i32 2232int align_s = __alignof(short);233 234// CHECK: @align_i = dso_local global i32 4235int align_i = __alignof(int);236 237// CHECK: @align_wc = dso_local global i32 4238int align_wc = __alignof(wchar_t);239 240// CHECK: @align_wi = dso_local global i32 4241int align_wi = __alignof(wint_t);242 243// CHECK: @align_l = dso_local global i32 8244int align_l = __alignof(long);245 246// CHECK: @align_ll = dso_local global i32 8247int align_ll = __alignof(long long);248 249// CHECK: @align_p = dso_local global i32 8250int align_p = __alignof(void*);251 252// CHECK: @align_f16 = dso_local global i32 2253int align_f16 = __alignof(_Float16);254 255// CHECK: @align_f = dso_local global i32 4256int align_f = __alignof(float);257 258// CHECK: @align_d = dso_local global i32 8259int align_d = __alignof(double);260 261// CHECK: @align_ld = dso_local global i32 16262int align_ld = __alignof(long double);263 264// CHECK: @align_vl = dso_local global i32 8265int align_vl = __alignof(va_list);266 267// CHECK: @align_a_c = dso_local global i32 1268int align_a_c = __alignof(_Atomic(char));269 270// CHECK: @align_a_s = dso_local global i32 2271int align_a_s = __alignof(_Atomic(short));272 273// CHECK: @align_a_i = dso_local global i32 4274int align_a_i = __alignof(_Atomic(int));275 276// CHECK: @align_a_wc = dso_local global i32 4277int align_a_wc = __alignof(_Atomic(wchar_t));278 279// CHECK: @align_a_wi = dso_local global i32 4280int align_a_wi = __alignof(_Atomic(wint_t));281 282// CHECK: @align_a_l = dso_local global i32 8283int align_a_l = __alignof(_Atomic(long));284 285// CHECK: @align_a_ll = dso_local global i32 8286int align_a_ll = __alignof(_Atomic(long long));287 288// CHECK: @align_a_p = dso_local global i32 8289int align_a_p = __alignof(_Atomic(void*));290 291// CHECK: @align_a_f16 = dso_local global i32 2292int align_a_f16 = __alignof(_Atomic(_Float16));293 294// CHECK: @align_a_f = dso_local global i32 4295int align_a_f = __alignof(_Atomic(float));296 297// CHECK: @align_a_d = dso_local global i32 8298int align_a_d = __alignof(_Atomic(double));299 300// CHECK: @align_a_ld = dso_local global i32 16301int align_a_ld = __alignof(_Atomic(long double));302 303// CHECK: @align_a_s4 = dso_local global i32 4304int align_a_s4 = __alignof(_Atomic(struct { char _[4]; }));305 306// CHECK: @align_a_s8 = dso_local global i32 8307int align_a_s8 = __alignof(_Atomic(struct { char _[8]; }));308 309// CHECK: @align_a_s16 = dso_local global i32 16310int align_a_s16 = __alignof(_Atomic(struct { char _[16]; }));311 312// CHECK: @align_a_s32 = dso_local global i32 1313int align_a_s32 = __alignof(_Atomic(struct { char _[32]; }));314 315 316// Check Sizes317 318// CHECK: @size_a_c = dso_local global i32 1319int size_a_c = sizeof(_Atomic(char));320 321// CHECK: @size_a_s = dso_local global i32 2322int size_a_s = sizeof(_Atomic(short));323 324// CHECK: @size_a_i = dso_local global i32 4325int size_a_i = sizeof(_Atomic(int));326 327// CHECK: @size_a_wc = dso_local global i32 4328int size_a_wc = sizeof(_Atomic(wchar_t));329 330// CHECK: @size_a_wi = dso_local global i32 4331int size_a_wi = sizeof(_Atomic(wint_t));332 333// CHECK: @size_a_l = dso_local global i32 8334int size_a_l = sizeof(_Atomic(long));335 336// CHECK: @size_a_ll = dso_local global i32 8337int size_a_ll = sizeof(_Atomic(long long));338 339// CHECK: @size_a_p = dso_local global i32 8340int size_a_p = sizeof(_Atomic(void*));341 342// CHECK: @size_a_f16 = dso_local global i32 2343int size_a_f16 = sizeof(_Atomic(_Float16));344 345// CHECK: @size_a_f = dso_local global i32 4346int size_a_f = sizeof(_Atomic(float));347 348// CHECK: @size_a_d = dso_local global i32 8349int size_a_d = sizeof(_Atomic(double));350 351// CHECK: @size_a_ld = dso_local global i32 16352int size_a_ld = sizeof(_Atomic(long double));353 354 355// Check types356 357// CHECK: define dso_local zeroext i8 @check_char()358char check_char(void) { return 0; }359 360// CHECK: define dso_local signext i16 @check_short()361short check_short(void) { return 0; }362 363// CHECK: define dso_local signext i32 @check_int()364int check_int(void) { return 0; }365 366// CHECK: define dso_local signext i32 @check_wchar_t()367int check_wchar_t(void) { return 0; }368 369// CHECK: define dso_local i64 @check_long()370long check_long(void) { return 0; }371 372// CHECK: define dso_local i64 @check_longlong()373long long check_longlong(void) { return 0; }374 375// CHECK: define dso_local zeroext i8 @check_uchar()376unsigned char check_uchar(void) { return 0; }377 378// CHECK: define dso_local zeroext i16 @check_ushort()379unsigned short check_ushort(void) { return 0; }380 381// CHECK: define dso_local signext i32 @check_uint()382unsigned int check_uint(void) { return 0; }383 384// CHECK: define dso_local i64 @check_ulong()385unsigned long check_ulong(void) { return 0; }386 387// CHECK: define dso_local i64 @check_ulonglong()388unsigned long long check_ulonglong(void) { return 0; }389 390// CHECK: define dso_local i64 @check_size_t()391size_t check_size_t(void) { return 0; }392 393// CHECK: define dso_local half @check_float16()394_Float16 check_float16(void) { return 0; }395 396// CHECK: define dso_local float @check_float()397float check_float(void) { return 0; }398 399// CHECK: define dso_local double @check_double()400double check_double(void) { return 0; }401 402// CHECK: define dso_local fp128 @check_longdouble()403long double check_longdouble(void) { return 0; }404