| 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, test that CL2.0 define them but earlier OpenCL |
| 19 |
// versions don't define feature macros accidentally. |
| 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=FEATURES-CL20 |
| 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=FEATURES-CL20 |
| 28 |
|
| 29 |
// Features can be disabled using -cl-ext=-<feature>. |
| 30 |
// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header \ |
| 31 |
// RUN: -cl-ext=-__opencl_c_integer_dot_product_input_4x8bit \ |
| 32 |
// RUN: -cl-ext=-__opencl_c_integer_dot_product_input_4x8bit_packed \ |
| 33 |
// RUN: | FileCheck %s --check-prefix=NO-FEATURES-CL20 |
| 34 |
// RUN: %clang_cc1 -triple spir-unknown-unknown %s -E -dM -o - -x cl -cl-std=CL3.0 -fdeclare-opencl-builtins -finclude-default-header \ |
| 35 |
// RUN: -cl-ext=-__opencl_c_work_group_collective_functions, \ |
| 36 |
// RUN: -cl-ext=-__opencl_c_atomic_order_seq_cst \ |
| 37 |
// RUN: -cl-ext=-__opencl_c_atomic_scope_device \ |
| 38 |
// RUN: -cl-ext=-__opencl_c_atomic_scope_all_devices \ |
| 39 |
// RUN: -cl-ext=-__opencl_c_read_write_images \ |
| 40 |
// RUN: | FileCheck %s --check-prefix=DISABLE-FEATURES |
| 41 |
|
| 42 |
// Note that __opencl_c_int64 is always defined assuming |
| 43 |
// always compiling for FULL OpenCL profile |
| 44 |
|
| 45 |
// FEATURES: #define __opencl_c_3d_image_writes 1 |
| 46 |
// FEATURES: #define __opencl_c_atomic_order_acq_rel 1 |
| 47 |
// FEATURES: #define __opencl_c_atomic_order_seq_cst 1 |
| 48 |
// FEATURES: #define __opencl_c_atomic_scope_all_devices 1 |
| 49 |
// FEATURES: #define __opencl_c_atomic_scope_device 1 |
| 50 |
// FEATURES: #define __opencl_c_device_enqueue 1 |
| 51 |
// FEATURES: #define __opencl_c_ext_image_unorm_int_2_101010 1 |
| 52 |
// FEATURES: #define __opencl_c_ext_image_unsigned_10x6_12x4_14x2 1 |
| 53 |
// FEATURES: #define __opencl_c_fp64 1 |
| 54 |
// FEATURES: #define __opencl_c_generic_address_space 1 |
| 55 |
// FEATURES: #define __opencl_c_images 1 |
| 56 |
// FEATURES: #define __opencl_c_int64 1 |
| 57 |
// FEATURES: #define __opencl_c_integer_dot_product_input_4x8bit 1 |
| 58 |
// FEATURES: #define __opencl_c_integer_dot_product_input_4x8bit_packed 1 |
| 59 |
// FEATURES: #define __opencl_c_kernel_clock_scope_device 1 |
| 60 |
// FEATURES: #define __opencl_c_kernel_clock_scope_sub_group 1 |
| 61 |
// FEATURES: #define __opencl_c_kernel_clock_scope_work_group 1 |
| 62 |
// FEATURES: #define __opencl_c_pipes 1 |
| 63 |
// FEATURES: #define __opencl_c_program_scope_global_variables 1 |
| 64 |
// FEATURES: #define __opencl_c_read_write_images 1 |
| 65 |
// FEATURES: #define __opencl_c_subgroups 1 |
| 66 |
// FEATURES: #define __opencl_c_work_group_collective_functions 1 |
| 67 |
|
| 68 |
// FEATURES-CL20: #define __opencl_c_atomic_order_acq_rel 1 |
| 69 |
// FEATURES-CL20: #define __opencl_c_atomic_order_seq_cst 1 |
| 70 |
// FEATURES-CL20: #define __opencl_c_atomic_scope_all_devices 1 |
| 71 |
// FEATURES-CL20: #define __opencl_c_atomic_scope_device 1 |
| 72 |
// FEATURES-CL20: #define __opencl_c_device_enqueue 1 |
| 73 |
// FEATURES-CL20: #define __opencl_c_generic_address_space 1 |
| 74 |
// FEATURES-CL20: #define __opencl_c_images 1 |
| 75 |
// FEATURES-CL20: #define __opencl_c_int64 1 |
| 76 |
// FEATURES-CL20: #define __opencl_c_pipes 1 |
| 77 |
// FEATURES-CL20: #define __opencl_c_program_scope_global_variables 1 |
| 78 |
// FEATURES-CL20: #define __opencl_c_read_write_images 1 |
| 79 |
// FEATURES-CL20: #define __opencl_c_work_group_collective_functions 1 |
| 80 |
|
| 81 |
// NO-FEATURES: #define __opencl_c_int64 1 |
| 82 |
// NO-FEATURES-NOT: #define __opencl_c_3d_image_writes 1 |
| 83 |
// NO-FEATURES-NOT: #define __opencl_c_atomic_order_acq_rel 1 |
| 84 |
// NO-FEATURES-NOT: #define __opencl_c_atomic_order_seq_cst 1 |
| 85 |
// NO-FEATURES-NOT: #define __opencl_c_atomic_scope_all_devices 1 |
| 86 |
// NO-FEATURES-NOT: #define __opencl_c_atomic_scope_device 1 |
| 87 |
// NO-FEATURES-NOT: #define __opencl_c_device_enqueue 1 |
| 88 |
// NO-FEATURES-NOT: #define __opencl_c_ext_image_unorm_int_2_101010 1 |
| 89 |
// NO-FEATURES-NOT: #define __opencl_c_ext_image_unsigned_10x6_12x4_14x2 1 |
| 90 |
// NO-FEATURES-NOT: #define __opencl_c_fp64 1 |
| 91 |
// NO-FEATURES-NOT: #define __opencl_c_generic_address_space 1 |
| 92 |
// NO-FEATURES-NOT: #define __opencl_c_images 1 |
| 93 |
// NO-FEATURES-NOT: #define __opencl_c_int64 1 |
| 94 |
// NO-FEATURES-NOT: #define __opencl_c_integer_dot_product_input_4x8bit 1 |
| 95 |
// NO-FEATURES-NOT: #define __opencl_c_integer_dot_product_input_4x8bit_packed 1 |
| 96 |
// NO-FEATURES-NOT: #define __opencl_c_kernel_clock_scope_device 1 |
| 97 |
// NO-FEATURES-NOT: #define __opencl_c_kernel_clock_scope_sub_group 1 |
| 98 |
// NO-FEATURES-NOT: #define __opencl_c_kernel_clock_scope_work_group 1 |
| 99 |
// NO-FEATURES-NOT: #define __opencl_c_pipes 1 |
| 100 |
// NO-FEATURES-NOT: #define __opencl_c_program_scope_global_variables 1 |
| 101 |
// NO-FEATURES-NOT: #define __opencl_c_read_write_images 1 |
| 102 |
// NO-FEATURES-NOT: #define __opencl_c_subgroups 1 |
| 103 |
// NO-FEATURES-NOT: #define __opencl_c_work_group_collective_functions 1 |
| 104 |
|
| 105 |
// NO-FEATURES-CL20-NOT: #define __opencl_c_integer_dot_product_input_4x8bit |
| 106 |
// NO-FEATURES-CL20-NOT: #define __opencl_c_integer_dot_product_input_4x8bit_packed |
| 107 |
|
| 108 |
// DISABLE-FEATURES-NOT: #define __opencl_c_work_group_collective_functions |
| 109 |
// DISABLE-FEATURES-NOT: #define __opencl_c_atomic_order_seq_cst |
| 110 |
// DISABLE-FEATURES-NOT: #define __opencl_c_atomic_scope_all_devices |
| 111 |
// DISABLE-FEATURES-NOT: #define __opencl_c_atomic_scope_device |
| 112 |
// DISABLE-FEATURES-NOT: #define __opencl_c_read_write_images |