Index: clang/lib/Headers/opencl-c-base.h =================================================================== --- clang/lib/Headers/opencl-c-base.h +++ clang/lib/Headers/opencl-c-base.h @@ -446,7 +446,6 @@ #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0) #ifdef cl_intel_device_side_avc_motion_estimation -#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : begin #define CLK_AVC_ME_MAJOR_16x16_INTEL 0x0 #define CLK_AVC_ME_MAJOR_16x8_INTEL 0x1 @@ -580,7 +579,6 @@ #define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0 #define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0 -#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : end #endif // cl_intel_device_side_avc_motion_estimation // Disable any extensions we may have enabled previously. Index: clang/lib/Headers/opencl-c.h =================================================================== --- clang/lib/Headers/opencl-c.h +++ clang/lib/Headers/opencl-c.h @@ -23,10 +23,11 @@ #endif //cl_khr_3d_image_writes #endif //__OPENCL_C_VERSION__ < CL_VERSION_2_0 -#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) + +#if (defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)) && defined(__SPIR__) #pragma OPENCL EXTENSION cl_intel_planar_yuv : begin #pragma OPENCL EXTENSION cl_intel_planar_yuv : end -#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) +#endif // (defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)) && defined(__SPIR__) #define __ovld __attribute__((overloadable)) #define __conv __attribute__((convergent)) Index: clang/test/Headers/opencl-c-header.cl =================================================================== --- clang/test/Headers/opencl-c-header.cl +++ clang/test/Headers/opencl-c-header.cl @@ -88,9 +88,10 @@ // Check that extension macros are defined correctly. -// FIXME: this should not be defined for all targets -// Verify that non-builtin cl_intel_planar_yuv extension is defined from -// OpenCL 1.2 onwards. +// For SPIR all extensions are supported. +#if defined(__SPIR__) + +// Verify that cl_intel_planar_yuv extension is defined from OpenCL 1.2 onwards. #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2) // expected-no-diagnostics #else //__OPENCL_C_VERSION__ @@ -98,9 +99,6 @@ #endif //__OPENCL_C_VERSION__ #pragma OPENCL EXTENSION cl_intel_planar_yuv : enable -// For SPIR all extensions are supported. -#if defined(__SPIR__) - #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200) #ifndef cl_khr_subgroup_extended_types