[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Driver / lanai-unknown-unknown.cpp
blob220a84f9eb2de0358648c9d7827ffcecc7132e83
1 // RUN: %clang -target lanai-unknown-unknown -### %s -emit-llvm-only -c 2>&1 \
2 // RUN: | FileCheck %s -check-prefix=ECHO
3 // RUN: %clang -target lanai-unknown-unknown %s -emit-llvm -S -o - \
4 // RUN: | FileCheck %s
6 // ECHO: {{.*}} "-cc1" {{.*}}lanai-unknown-unknown.c
8 typedef __builtin_va_list va_list;
9 typedef __SIZE_TYPE__ size_t;
10 typedef __PTRDIFF_TYPE__ ptrdiff_t;
12 extern "C" {
14 // CHECK: @align_c = dso_local global i32 1
15 int align_c = __alignof(char);
17 // CHECK: @align_s = dso_local global i32 2
18 int align_s = __alignof(short);
20 // CHECK: @align_i = dso_local global i32 4
21 int align_i = __alignof(int);
23 // CHECK: @align_l = dso_local global i32 4
24 int align_l = __alignof(long);
26 // CHECK: @align_ll = dso_local global i32 8
27 int align_ll = __alignof(long long);
29 // CHECK: @align_p = dso_local global i32 4
30 int align_p = __alignof(void*);
32 // CHECK: @align_vl = dso_local global i32 4
33 int align_vl = __alignof(va_list);
35 // Check types
37 // CHECK: signext i8 @check_char()
38 char check_char() { return 0; }
40 // CHECK: signext i16 @check_short()
41 short check_short() { return 0; }
43 // CHECK: i32 @check_int()
44 int check_int() { return 0; }
46 // CHECK: i32 @check_long()
47 long check_long() { return 0; }
49 // CHECK: i64 @check_longlong()
50 long long check_longlong() { return 0; }
52 // CHECK: zeroext i8 @check_uchar()
53 unsigned char check_uchar() { return 0; }
55 // CHECK: zeroext i16 @check_ushort()
56 unsigned short check_ushort() { return 0; }
58 // CHECK: i32 @check_uint()
59 unsigned int check_uint() { return 0; }
61 // CHECK: i32 @check_ulong()
62 unsigned long check_ulong() { return 0; }
64 // CHECK: i64 @check_ulonglong()
65 unsigned long long check_ulonglong() { return 0; }
67 // CHECK: i32 @check_size_t()
68 size_t check_size_t() { return 0; }
72 template<int> void Switch();
73 template<> void Switch<4>();
74 template<> void Switch<8>();
75 template<> void Switch<16>();
77 void check_pointer_size() {
78 // CHECK: SwitchILi4
79 Switch<sizeof(void*)>();
81 // CHECK: SwitchILi8
82 Switch<sizeof(long long)>();
84 // CHECK: SwitchILi4
85 Switch<sizeof(va_list)>();