diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-04-26 19:25:46 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2016-04-26 19:25:46 +0000 |
commit | 382d355359c879472eaaf49e389f848fcf69003b (patch) | |
tree | bb8a96c5ca818e10446e0a83a3912265f85972c6 /clang/test/Frontend | |
parent | ff788aa0ee68097da3a24dbc5597c16932297c56 (diff) | |
download | bcm5719-llvm-382d355359c879472eaaf49e389f848fcf69003b.tar.gz bcm5719-llvm-382d355359c879472eaaf49e389f848fcf69003b.zip |
[OpenCL] Add predefined macros.
OpenCL spec requires __OPENCL_C_VERSION__ to be defined based on -cl-std option. This patch implements that.
The patch also defines __FAST_RELAXED_MATH__ based on -cl-fast-relaxed-math option.
Also fixed a test using -std=c99 for OpenCL program. Limit allowed language standard of OpenCL to be OpenCL standards.
Differential Revision: http://reviews.llvm.org/D19071
llvm-svn: 267590
Diffstat (limited to 'clang/test/Frontend')
-rw-r--r-- | clang/test/Frontend/std.cl | 9 | ||||
-rw-r--r-- | clang/test/Frontend/stdlang.c | 11 |
2 files changed, 9 insertions, 11 deletions
diff --git a/clang/test/Frontend/std.cl b/clang/test/Frontend/std.cl deleted file mode 100644 index b811b64dabc..00000000000 --- a/clang/test/Frontend/std.cl +++ /dev/null @@ -1,9 +0,0 @@ -// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL -// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL1.1 -// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL1.2 -// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL2.0 -// RUN: not %clang_cc1 %s -fsyntax-only -cl-std=invalid -DINVALID 2>&1 | FileCheck %s - -#ifdef INVALID -// CHECK: invalid value 'invalid' in '-cl-std=invalid' -#endif diff --git a/clang/test/Frontend/stdlang.c b/clang/test/Frontend/stdlang.c index 71997f1403c..765d7272294 100644 --- a/clang/test/Frontend/stdlang.c +++ b/clang/test/Frontend/stdlang.c @@ -1,6 +1,13 @@ // RUN: %clang_cc1 -x cuda -std=c++11 -DCUDA %s -// RUN: %clang_cc1 -x cl -std=c99 -DOPENCL %s -// expected-no-diagnostics +// RUN: %clang_cc1 -x cl -DOPENCL %s +// RUN: %clang_cc1 -x cl -cl-std=CL -DOPENCL %s +// RUN: %clang_cc1 -x cl -cl-std=CL1.1 -DOPENCL %s +// RUN: %clang_cc1 -x cl -cl-std=CL1.2 -DOPENCL %s +// RUN: %clang_cc1 -x cl -cl-std=CL2.0 -DOPENCL %s +// RUN: not %clang_cc1 -x cl -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s +// RUN: not %clang_cc1 -x cl -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s +// CHECK-C99: error: invalid argument '-std=c99' not allowed with 'OpenCL' +// CHECK-INVALID: error: invalid value 'invalid' in '-cl-std=invalid' #if defined(CUDA) __attribute__((device)) void f_device(); |