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/Preprocessor | |
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/Preprocessor')
-rw-r--r-- | clang/test/Preprocessor/predefined-macros.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c index a19ec48c57d..53964061ce6 100644 --- a/clang/test/Preprocessor/predefined-macros.c +++ b/clang/test/Preprocessor/predefined-macros.c @@ -146,3 +146,40 @@ // CHECK-SYNC_CAS_MIPS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 // CHECK-SYNC_CAS_MIPS32-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 // CHECK-SYNC_CAS_MIPS64: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 + +// RUN: %clang_cc1 %s -E -dM -o - -x cl \ +// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL10 +// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL1.1 \ +// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL11 +// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL1.2 \ +// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL12 +// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL2.0 \ +// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL20 +// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-fast-relaxed-math \ +// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FRM +// CHECK-CL10: #define CL_VERSION_1_0 100 +// CHECK-CL10: #define CL_VERSION_1_1 110 +// CHECK-CL10: #define CL_VERSION_1_2 120 +// CHECK-CL10: #define CL_VERSION_2_0 200 +// CHECK-CL10: #define __OPENCL_C_VERSION__ 100 +// CHECK-CL10-NOT: #define __FAST_RELAXED_MATH__ 1 +// CHECK-CL11: #define CL_VERSION_1_0 100 +// CHECK-CL11: #define CL_VERSION_1_1 110 +// CHECK-CL11: #define CL_VERSION_1_2 120 +// CHECK-CL11: #define CL_VERSION_2_0 200 +// CHECK-CL11: #define __OPENCL_C_VERSION__ 110 +// CHECK-CL11-NOT: #define __FAST_RELAXED_MATH__ 1 +// CHECK-CL12: #define CL_VERSION_1_0 100 +// CHECK-CL12: #define CL_VERSION_1_1 110 +// CHECK-CL12: #define CL_VERSION_1_2 120 +// CHECK-CL12: #define CL_VERSION_2_0 200 +// CHECK-CL12: #define __OPENCL_C_VERSION__ 120 +// CHECK-CL12-NOT: #define __FAST_RELAXED_MATH__ 1 +// CHECK-CL20: #define CL_VERSION_1_0 100 +// CHECK-CL20: #define CL_VERSION_1_1 110 +// CHECK-CL20: #define CL_VERSION_1_2 120 +// CHECK-CL20: #define CL_VERSION_2_0 200 +// CHECK-CL20: #define __OPENCL_C_VERSION__ 200 +// CHECK-CL20-NOT: #define __FAST_RELAXED_MATH__ 1 +// CHECK-FRM: #define __FAST_RELAXED_MATH__ 1 + |