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