diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h --- a/clang/lib/Headers/opencl-c-base.h +++ b/clang/lib/Headers/opencl-c-base.h @@ -567,7 +567,6 @@ #endif #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 @@ -701,7 +700,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. diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h --- a/clang/lib/Headers/opencl-c.h +++ b/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)) diff --git a/clang/test/Headers/opencl-c-header.cl b/clang/test/Headers/opencl-c-header.cl --- a/clang/test/Headers/opencl-c-header.cl +++ b/clang/test/Headers/opencl-c-header.cl @@ -89,9 +89,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__ @@ -99,9 +100,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) #if cl_khr_subgroup_extended_types != 1