1 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
4 // CHECK: _Z16convert_char_rtec
7 // CHECK20-NOT: _Z16convert_char_rtec
8 // CHECK-MOD: Reading modules
10 // Test including the default header as a module.
11 // The module should be compiled only once and loaded from cache afterwards.
12 // Change the directory mode to read only to make sure no new modules are created.
13 // Check time report to make sure module is used.
16 // Clear current directory.
21 // Compile for OpenCL 1.0 for the first time. A module should be generated.
22 // RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
23 // RUN: chmod u-w %t/opencl_c.pcm
26 // Compile for OpenCL 1.0 for the second time. The module should not be re-created.
27 // RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
28 // RUN: chmod u+w %t/opencl_c.pcm
29 // RUN: mv %t/opencl_c.pcm %t/1_0.pcm
32 // Compile for OpenCL 2.0 for the first time. The module should change.
33 // RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
34 // RUN: not diff %t/1_0.pcm %t/opencl_c.pcm
35 // RUN: chmod u-w %t/opencl_c.pcm
38 // Compile for OpenCL 2.0 for the second time. The module should not change.
39 // RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
41 // Check cached module works for different OpenCL versions.
44 // RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL1.2 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
45 // RUN: %clang_cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
47 // RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL1.2 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
48 // RUN: %clang_cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
52 #if __OPENCL_C_VERSION__ != CL_VERSION_2_0
53 return convert_char_rte(x);
55 //expected-warning@-2{{implicit declaration of function 'convert_char_rte' is invalid in C99}}
58 #else //__OPENCL_C_VERSION__
60 #endif //__OPENCL_C_VERSION__