86 lines · plain
1// RUN: %clang_cc1 -triple r600 -cl-std=CL1.2 %s -emit-llvm -o - | FileCheck %s2// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-std=CL1.2 %s -emit-llvm -o - | FileCheck %s3// RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL1.2 %s -emit-llvm -o - | FileCheck %s4// RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s5// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL1.2 %s -emit-llvm -o - | FileCheck %s6// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s7 8// RUN: %clang_cc1 -triple r600 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s9// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s10// RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s11// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s12// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=+__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s13// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=+__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s14// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=+__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s15// RUN: %clang_cc1 -triple r600 -cl-ext=+cl_khr_fp64,+__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s16// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=+cl_khr_fp64,+__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s17// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=+cl_khr_fp64,+__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s18// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=+cl_khr_fp64,+__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s19 20#ifdef __AMDGCN__21#define PTSIZE 822#else23#define PTSIZE 424#endif25 26#ifdef cl_khr_fp6427#pragma OPENCL EXTENSION cl_khr_fp64 : enable28#endif29#ifdef cl_khr_fp1630#pragma OPENCL EXTENSION cl_khr_fp16 : enable31#endif32 33typedef __SIZE_TYPE__ size_t;34typedef __PTRDIFF_TYPE__ ptrdiff_t;35typedef __INTPTR_TYPE__ intptr_t;36typedef __UINTPTR_TYPE__ uintptr_t;37typedef global void *global_ptr_t;38typedef constant void *constant_ptr_t;39typedef local void *local_ptr_t;40typedef private void *private_ptr_t;41 42void check(bool);43 44void test() {45 // CHECK-NOT: call void @check(i1 zeroext false)46 check(sizeof(size_t) == PTSIZE);47 check(__alignof__(size_t) == PTSIZE);48 check(sizeof(intptr_t) == PTSIZE);49 check(__alignof__(intptr_t) == PTSIZE);50 check(sizeof(uintptr_t) == PTSIZE);51 check(__alignof__(uintptr_t) == PTSIZE);52 check(sizeof(ptrdiff_t) == PTSIZE);53 check(__alignof__(ptrdiff_t) == PTSIZE);54 55 check(sizeof(char) == 1);56 check(__alignof__(char) == 1);57 check(sizeof(short) == 2);58 check(__alignof__(short) == 2);59 check(sizeof(int) == 4);60 check(__alignof__(int) == 4);61 check(sizeof(long) == 8);62 check(__alignof__(long) == 8);63#ifdef cl_khr_fp1664 check(sizeof(half) == 2);65 check(__alignof__(half) == 2);66#endif67 check(sizeof(float) == 4);68 check(__alignof__(float) == 4);69#ifdef cl_khr_fp6470 check(sizeof(double) == 8);71 check(__alignof__(double) == 8);72#endif73 check(sizeof(private void*) == 4);74 check(__alignof__(private void*) == 4);75#if (__OPENCL_C_VERSION__ == 200) || defined(__opencl_c_generic_address_space)76 check(sizeof(generic void*) == 8);77 check(__alignof__(generic void*) == 8);78#endif79 check(sizeof(global_ptr_t) == PTSIZE);80 check(__alignof__(global_ptr_t) == PTSIZE);81 check(sizeof(constant_ptr_t) == PTSIZE);82 check(__alignof__(constant_ptr_t) == PTSIZE);83 check(sizeof(local_ptr_t) == 4);84 check(__alignof__(private_ptr_t) == 4);85}86