2016-05-30 10:22:28 +08:00
|
|
|
// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// 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
|
|
|
|
|
|
|
|
// CHECK: _Z16convert_char_rtec
|
2016-06-21 03:26:00 +08:00
|
|
|
// CHECK-NOT: _Z3ctzc
|
|
|
|
// CHECK20: _Z3ctzc
|
|
|
|
// CHECK20-NOT: _Z16convert_char_rtec
|
|
|
|
// CHECK-MOD: Reading modules
|
|
|
|
|
|
|
|
// Test including the default header as a module.
|
|
|
|
// The module should be compiled only once and loaded from cache afterwards.
|
|
|
|
// Change the directory mode to read only to make sure no new modules are created.
|
|
|
|
// Check time report to make sure module is used.
|
|
|
|
|
|
|
|
// ===
|
|
|
|
// Clear current directory.
|
|
|
|
// RUN: rm -rf %t
|
|
|
|
// RUN: mkdir -p %t
|
|
|
|
|
|
|
|
// ===
|
|
|
|
// Compile for OpenCL 1.0 for the first time. A module should be generated.
|
|
|
|
// 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
|
|
|
|
// RUN: chmod u-w %t/opencl_c.pcm
|
|
|
|
|
|
|
|
// ===
|
|
|
|
// Compile for OpenCL 1.0 for the second time. The module should not be re-created.
|
|
|
|
// 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
|
|
|
|
// RUN: chmod u+w %t/opencl_c.pcm
|
|
|
|
// RUN: mv %t/opencl_c.pcm %t/1_0.pcm
|
|
|
|
|
|
|
|
// ===
|
|
|
|
// Compile for OpenCL 2.0 for the first time. The module should change.
|
|
|
|
// 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
|
|
|
|
// RUN: not diff %t/1_0.pcm %t/opencl_c.pcm
|
|
|
|
// RUN: chmod u-w %t/opencl_c.pcm
|
|
|
|
|
|
|
|
// ===
|
|
|
|
// Compile for OpenCL 2.0 for the second time. The module should not change.
|
|
|
|
// 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
|
|
|
|
|
|
|
|
// Check cached module works for different OpenCL versions.
|
|
|
|
// RUN: rm -rf %t
|
|
|
|
// RUN: mkdir -p %t
|
2016-11-07 23:55:51 +08:00
|
|
|
// 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
|
|
|
|
// 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
|
2016-06-28 05:43:00 +08:00
|
|
|
// RUN: chmod u-w %t
|
2016-11-07 23:55:51 +08:00
|
|
|
// 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
|
2016-06-21 03:26:00 +08:00
|
|
|
// 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
|
2016-06-28 05:43:00 +08:00
|
|
|
// RUN: chmod u+w %t
|
2016-06-21 03:26:00 +08:00
|
|
|
|
2016-05-30 10:22:28 +08:00
|
|
|
char f(char x) {
|
2016-06-21 03:26:00 +08:00
|
|
|
#if __OPENCL_C_VERSION__ != CL_VERSION_2_0
|
2016-05-30 10:22:28 +08:00
|
|
|
return convert_char_rte(x);
|
2016-06-21 03:26:00 +08:00
|
|
|
#ifdef NO_HEADER
|
|
|
|
//expected-warning@-2{{implicit declaration of function 'convert_char_rte' is invalid in C99}}
|
|
|
|
#endif //NO_HEADER
|
|
|
|
|
|
|
|
#else //__OPENCL_C_VERSION__
|
|
|
|
return ctz(x);
|
|
|
|
#endif //__OPENCL_C_VERSION__
|
2016-05-30 10:22:28 +08:00
|
|
|
}
|