1// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL3.0 -cl-ext=-all \
2// RUN:   | FileCheck -match-full-lines %s  --check-prefix=NO-FEATURES
3// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL3.0 -cl-ext=+all \
4// RUN:   | FileCheck -match-full-lines %s  --check-prefix=FEATURES
5// RUN: %clang_cc1 -triple r600-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL3.0 \
6// RUN:   | FileCheck -match-full-lines %s  --check-prefix=NO-FEATURES
7// RUN: %clang_cc1 -triple r600-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL3.0 -cl-ext=+all \
8// RUN:   | FileCheck -match-full-lines %s  --check-prefix=FEATURES
9
10// For OpenCL C 2.0 feature macros are defined only in header, so test that earlier OpenCL
11// versions don't define feature macros accidentally and CL2.0 don't define them without header
12// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL1.1 \
13// RUN:   | FileCheck -match-full-lines %s  --check-prefix=NO-FEATURES
14// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL1.2 \
15// RUN:   | FileCheck -match-full-lines %s  --check-prefix=NO-FEATURES
16// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL2.0 \
17// RUN:   | FileCheck -match-full-lines %s  --check-prefix=NO-FEATURES
18// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CLC++ \
19// RUN:   | FileCheck -match-full-lines %s  --check-prefix=NO-FEATURES
20
21// Note that __opencl_c_int64 is always defined assuming
22// always compiling for FULL OpenCL profile
23
24// FEATURES: #define __opencl_c_3d_image_writes 1
25// FEATURES: #define __opencl_c_atomic_order_acq_rel 1
26// FEATURES: #define __opencl_c_atomic_order_seq_cst 1
27// FEATURES: #define __opencl_c_device_enqueue 1
28// FEATURES: #define __opencl_c_fp64 1
29// FEATURES: #define __opencl_c_generic_address_space 1
30// FEATURES: #define __opencl_c_images 1
31// FEATURES: #define __opencl_c_int64 1
32// FEATURES: #define __opencl_c_pipes 1
33// FEATURES: #define __opencl_c_program_scope_global_variables 1
34// FEATURES: #define __opencl_c_read_write_images 1
35// FEATURES: #define __opencl_c_subgroups 1
36
37// NO-FEATURES: #define __opencl_c_int64 1
38// NO-FEATURES-NOT: __opencl_c_3d_image_writes
39// NO-FEATURES-NOT: __opencl_c_atomic_order_acq_rel
40// NO-FEATURES-NOT: __opencl_c_atomic_order_seq_cst
41// NO-FEATURES-NOT: __opencl_c_device_enqueue
42// NO-FEATURES-NOT: __opencl_c_fp64
43// NO-FEATURES-NOT: __opencl_c_generic_address_space
44// NO-FEATURES-NOT: __opencl_c_images
45// NO-FEATURES-NOT: __opencl_c_pipes
46// NO-FEATURES-NOT: __opencl_c_program_scope_global_variables
47// NO-FEATURES-NOT: __opencl_c_read_write_images
48// NO-FEATURES-NOT: __opencl_c_subgroups
49