2018-01-11 21:36:56 +08:00
|
|
|
// A basic clang -cc1 command-line, and simple environment check.
|
|
|
|
|
|
|
|
// RUN: %clang %s -### -no-canonical-prefixes -target riscv64 2>&1 | FileCheck -check-prefix=CC1 %s
|
|
|
|
// CC1: clang{{.*}} "-cc1" "-triple" "riscv64"
|
|
|
|
|
|
|
|
// RUN: %clang -target riscv64 %s -emit-llvm -S -o - | FileCheck %s
|
|
|
|
|
|
|
|
typedef __builtin_va_list va_list;
|
|
|
|
typedef __SIZE_TYPE__ size_t;
|
|
|
|
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
|
|
|
typedef __WCHAR_TYPE__ wchar_t;
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_c = global i32 1
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_c = __alignof(char);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_s = global i32 2
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_s = __alignof(short);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_i = global i32 4
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_i = __alignof(int);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_wc = global i32 4
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_wc = __alignof(wchar_t);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_l = global i32 8
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_l = __alignof(long);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_ll = global i32 8
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_ll = __alignof(long long);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_p = global i32 8
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_p = __alignof(void*);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_f = global i32 4
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_f = __alignof(float);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_d = global i32 8
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_d = __alignof(double);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_ld = global i32 16
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_ld = __alignof(long double);
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: @align_vl = global i32 8
|
2018-01-11 21:36:56 +08:00
|
|
|
int align_vl = __alignof(va_list);
|
2018-01-16 01:54:52 +08:00
|
|
|
|
|
|
|
// Check types
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define zeroext i8 @check_char()
|
2018-01-16 01:54:52 +08:00
|
|
|
char check_char() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define signext i16 @check_short()
|
2018-01-16 01:54:52 +08:00
|
|
|
short check_short() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define signext i32 @check_int()
|
2018-01-16 01:54:52 +08:00
|
|
|
int check_int() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define signext i32 @check_wchar_t()
|
2018-01-16 01:54:52 +08:00
|
|
|
int check_wchar_t() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define i64 @check_long()
|
2018-01-16 01:54:52 +08:00
|
|
|
long check_long() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define i64 @check_longlong()
|
2018-01-16 01:54:52 +08:00
|
|
|
long long check_longlong() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define zeroext i8 @check_uchar()
|
2018-01-16 01:54:52 +08:00
|
|
|
unsigned char check_uchar() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define zeroext i16 @check_ushort()
|
2018-01-16 01:54:52 +08:00
|
|
|
unsigned short check_ushort() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define signext i32 @check_uint()
|
2018-01-16 01:54:52 +08:00
|
|
|
unsigned int check_uint() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define i64 @check_ulong()
|
2018-01-16 01:54:52 +08:00
|
|
|
unsigned long check_ulong() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define i64 @check_ulonglong()
|
2018-01-16 01:54:52 +08:00
|
|
|
unsigned long long check_ulonglong() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define i64 @check_size_t()
|
2018-01-16 01:54:52 +08:00
|
|
|
size_t check_size_t() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define float @check_float()
|
2018-01-16 01:54:52 +08:00
|
|
|
float check_float() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define double @check_double()
|
2018-01-16 01:54:52 +08:00
|
|
|
double check_double() { return 0; }
|
|
|
|
|
2018-02-08 03:44:15 +08:00
|
|
|
// CHECK: define fp128 @check_longdouble()
|
2018-01-16 01:54:52 +08:00
|
|
|
long double check_longdouble() { return 0; }
|