diff --git a/CMakeLists.txt b/CMakeLists.txt index 6037c6b8..e4c31818 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,8 +152,14 @@ if(MSVC) endif() if( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source") + set(Shared_Flags_Intel "-Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -fp:strict") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Shared_Flags_Intel}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${Shared_Flags_Intel}") + if (NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM")) + set(ICC_Extra_Flags "-Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:source") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ICC_Extra_Flags}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ICC_Extra_Flags}") + endif() endif() # To handle addresses larger than 2 gigabytes for 32bit targets diff --git a/test_common/harness/msvc9.c b/test_common/harness/msvc9.c index 29b45d65..ef70035f 100644 --- a/test_common/harness/msvc9.c +++ b/test_common/harness/msvc9.c @@ -714,6 +714,11 @@ int32_t float2int(float fx) return u.i; } +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + +#if !__has_builtin(__builtin_clz) #if !defined(_WIN64) /** Returns the number of leading 0-bits in x, starting at the most significant bit position. @@ -778,6 +783,7 @@ int __builtin_clz(unsigned int pattern) } #endif // !defined(_WIN64) +#endif // !__has_builtin(__builtin_clz) #include #include diff --git a/test_conformance/events/test_userevents.cpp b/test_conformance/events/test_userevents.cpp index 1fdb4ea4..b716b5c7 100644 --- a/test_conformance/events/test_userevents.cpp +++ b/test_conformance/events/test_userevents.cpp @@ -28,18 +28,6 @@ /////////////////////////////////////////////////////////////////////////////// // CL error checking. -#if defined(_MSC_VER) -#define CL_EXIT_ERROR(cmd, ...) \ - { \ - if ((cmd) != CL_SUCCESS) \ - { \ - log_error("CL ERROR: %s %u: ", __FILE__, __LINE__); \ - log_error(##__VA_ARGS__); \ - log_error("\n"); \ - return -1; \ - } \ - } -#else #define CL_EXIT_ERROR(cmd, format, ...) \ { \ if ((cmd) != CL_SUCCESS) \ @@ -50,7 +38,6 @@ return -1; \ } \ } -#endif #define CL_EXIT_BUILD_ERROR(cmd, program, format, ...) \ { \ diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_create_context.cpp b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_create_context.cpp index 6033ce9b..310c0870 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_create_context.cpp +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_create_context.cpp @@ -24,7 +24,7 @@ int context_create(cl_device_id deviceID, cl_context context, CResult result; // create device - std::auto_ptr deviceWrapper; + std::unique_ptr deviceWrapper; if (!DeviceCreate(adapterType, deviceWrapper)) { result.ResultSub(CResult::TEST_ERROR); @@ -68,7 +68,7 @@ int context_create(cl_device_id deviceID, cl_context context, } void *objectSharedHandle = 0; - std::auto_ptr surface; + std::unique_ptr surface; if (!MediaSurfaceCreate( adapterType, width, height, surfaceFormat, *deviceWrapper, surface, (sharedHandle == SHARED_HANDLE_ENABLED) ? true : false, diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_functions_api.cpp b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_functions_api.cpp index 68db364c..0f3fe4f6 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_functions_api.cpp +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_functions_api.cpp @@ -27,7 +27,7 @@ int api_functions(cl_device_id deviceID, cl_context context, CResult result; // create device - std::auto_ptr deviceWrapper; + std::unique_ptr deviceWrapper; if (!DeviceCreate(adapterType, deviceWrapper)) { result.ResultSub(CResult::TEST_ERROR); @@ -87,7 +87,7 @@ int api_functions(cl_device_id deviceID, cl_context context, } void *objectSharedHandle = 0; - std::auto_ptr surface; + std::unique_ptr surface; // create surface if (!MediaSurfaceCreate( diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_functions_kernel.cpp b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_functions_kernel.cpp index 84761223..b8c97f80 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_functions_kernel.cpp +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_functions_kernel.cpp @@ -48,7 +48,7 @@ int kernel_functions(cl_device_id deviceID, cl_context context, CResult result; - std::auto_ptr deviceWrapper; + std::unique_ptr deviceWrapper; if (!DeviceCreate(adapterType, deviceWrapper)) { result.ResultSub(CResult::TEST_ERROR); @@ -102,7 +102,7 @@ int kernel_functions(cl_device_id deviceID, cl_context context, } void *objectSrcHandle = 0; - std::auto_ptr surfaceSrc; + std::unique_ptr surfaceSrc; if (!MediaSurfaceCreate(adapterType, width, height, surfaceFormat, *deviceWrapper, surfaceSrc, (sharedHandle == SHARED_HANDLE_ENABLED) ? true @@ -116,7 +116,7 @@ int kernel_functions(cl_device_id deviceID, cl_context context, } void *objectDstHandle = 0; - std::auto_ptr surfaceDst; + std::unique_ptr surfaceDst; if (!MediaSurfaceCreate(adapterType, width, height, surfaceFormat, *deviceWrapper, surfaceDst, (sharedHandle == SHARED_HANDLE_ENABLED) ? true diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_get_device_ids.cpp b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_get_device_ids.cpp index 613a602c..e8f1193e 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_get_device_ids.cpp +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_get_device_ids.cpp @@ -21,7 +21,7 @@ int get_device_ids(cl_device_id deviceID, cl_context context, { CResult result; - std::auto_ptr deviceWrapper; + std::unique_ptr deviceWrapper; if (!DeviceCreate(adapterType, deviceWrapper)) { result.ResultSub(CResult::TEST_ERROR); diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_interop_sync.cpp b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_interop_sync.cpp index 280f47b5..1147cc45 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_interop_sync.cpp +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_interop_sync.cpp @@ -26,7 +26,7 @@ int interop_user_sync(cl_device_id deviceID, cl_context context, CResult result; // create device - std::auto_ptr deviceWrapper; + std::unique_ptr deviceWrapper; if (!DeviceCreate(adapterType, deviceWrapper)) { result.ResultSub(CResult::TEST_ERROR); @@ -72,7 +72,7 @@ int interop_user_sync(cl_device_id deviceID, cl_context context, } void *objectSharedHandle = 0; - std::auto_ptr surface; + std::unique_ptr surface; if (!MediaSurfaceCreate( adapterType, width, height, surfaceFormat, *deviceWrapper, surface, (sharedHandle == SHARED_HANDLE_ENABLED) ? true : false, diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_memory_access.cpp b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_memory_access.cpp index c7242422..2833dcf1 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_memory_access.cpp +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_memory_access.cpp @@ -23,7 +23,7 @@ int memory_access(cl_device_id deviceID, cl_context context, { CResult result; - std::auto_ptr deviceWrapper; + std::unique_ptr deviceWrapper; // creates device if (!DeviceCreate(adapterType, deviceWrapper)) { @@ -74,7 +74,7 @@ int memory_access(cl_device_id deviceID, cl_context context, } void *objectSharedHandle = 0; - std::auto_ptr surface; + std::unique_ptr surface; // creates surface if (!MediaSurfaceCreate( diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_other_data_types.cpp b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_other_data_types.cpp index 8ff71279..81807bcd 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/test_other_data_types.cpp +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/test_other_data_types.cpp @@ -57,7 +57,7 @@ int other_data_types(cl_device_id deviceID, cl_context context, return result.Result(); } - std::auto_ptr deviceWrapper; + std::unique_ptr deviceWrapper; if (!DeviceCreate(adapterType, deviceWrapper)) { result.ResultSub(CResult::TEST_ERROR); @@ -158,7 +158,7 @@ int other_data_types(cl_device_id deviceID, cl_context context, } void *objectSrcHandle = 0; - std::auto_ptr surfaceSrc; + std::unique_ptr surfaceSrc; if (!MediaSurfaceCreate(adapterType, width, height, surfaceFormat, *deviceWrapper, surfaceSrc, (sharedHandle == SHARED_HANDLE_ENABLED) ? true @@ -172,7 +172,7 @@ int other_data_types(cl_device_id deviceID, cl_context context, } void *objectDstHandle = 0; - std::auto_ptr surfaceDst; + std::unique_ptr surfaceDst; if (!MediaSurfaceCreate(adapterType, width, height, surfaceFormat, *deviceWrapper, surfaceDst, (sharedHandle == SHARED_HANDLE_ENABLED) ? true diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/utils.cpp b/test_conformance/extensions/cl_khr_dx9_media_sharing/utils.cpp index 87eb13c3..3b0bf0ad 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/utils.cpp +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/utils.cpp @@ -224,7 +224,7 @@ bool YUVGenerate(TSurfaceFormat surfaceFormat, std::vector &yuv, return true; } -bool YUVSurfaceSetNV12(std::auto_ptr &surface, +bool YUVSurfaceSetNV12(std::unique_ptr &surface, const std::vector &yuv, unsigned int width, unsigned int height) { @@ -257,7 +257,7 @@ bool YUVSurfaceSetNV12(std::auto_ptr &surface, #endif } -bool YUVSurfaceSetYV12(std::auto_ptr &surface, +bool YUVSurfaceSetYV12(std::unique_ptr &surface, const std::vector &yuv, unsigned int width, unsigned int height) { @@ -305,7 +305,7 @@ bool YUVSurfaceSetYV12(std::auto_ptr &surface, } bool YUVSurfaceSet(TSurfaceFormat surfaceFormat, - std::auto_ptr &surface, + std::unique_ptr &surface, const std::vector &yuv, unsigned int width, unsigned int height) { @@ -326,7 +326,7 @@ bool YUVSurfaceSet(TSurfaceFormat surfaceFormat, return true; } -bool YUVSurfaceGetNV12(std::auto_ptr &surface, +bool YUVSurfaceGetNV12(std::unique_ptr &surface, std::vector &yuv, unsigned int width, unsigned int height) { @@ -363,7 +363,7 @@ bool YUVSurfaceGetNV12(std::auto_ptr &surface, #endif } -bool YUVSurfaceGetYV12(std::auto_ptr &surface, +bool YUVSurfaceGetYV12(std::unique_ptr &surface, std::vector &yuv, unsigned int width, unsigned int height) { @@ -411,7 +411,7 @@ bool YUVSurfaceGetYV12(std::auto_ptr &surface, } bool YUVSurfaceGet(TSurfaceFormat surfaceFormat, - std::auto_ptr &surface, + std::unique_ptr &surface, std::vector &yuv, unsigned int width, unsigned int height) { @@ -1078,7 +1078,7 @@ bool GetImageInfo(cl_mem object, cl_image_format formatExp, } bool GetMemObjInfo(cl_mem object, cl_dx9_media_adapter_type_khr adapterType, - std::auto_ptr &surface, + std::unique_ptr &surface, void *shareHandleExp) { bool result = true; @@ -1172,7 +1172,7 @@ bool GetMemObjInfo(cl_mem object, cl_dx9_media_adapter_type_khr adapterType, bool ImageInfoVerify(cl_dx9_media_adapter_type_khr adapterType, const std::vector &memObjList, unsigned int width, unsigned int height, - std::auto_ptr &surface, + std::unique_ptr &surface, void *sharedHandle) { if (memObjList.size() != 2 && memObjList.size() != 3) @@ -1379,19 +1379,19 @@ D3DFORMAT SurfaceFormatToD3D(TSurfaceFormat surfaceFormat) #endif bool DeviceCreate(cl_dx9_media_adapter_type_khr adapterType, - std::auto_ptr &device) + std::unique_ptr &device) { switch (adapterType) { #if defined(_WIN32) case CL_ADAPTER_D3D9_KHR: - device = std::auto_ptr(new CD3D9Wrapper()); + device = std::unique_ptr(new CD3D9Wrapper()); break; case CL_ADAPTER_D3D9EX_KHR: - device = std::auto_ptr(new CD3D9ExWrapper()); + device = std::unique_ptr(new CD3D9ExWrapper()); break; case CL_ADAPTER_DXVA_KHR: - device = std::auto_ptr(new CDXVAWrapper()); + device = std::unique_ptr(new CDXVAWrapper()); break; #endif default: @@ -1551,7 +1551,7 @@ void SurfaceFormatToString(TSurfaceFormat surfaceFormat, std::string &str) bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType, unsigned int width, unsigned int height, TSurfaceFormat surfaceFormat, CDeviceWrapper &device, - std::auto_ptr &surface, + std::unique_ptr &surface, bool sharedHandle, void **objectSharedHandle) { switch (adapterType) @@ -1559,7 +1559,7 @@ bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType, #if defined(_WIN32) case CL_ADAPTER_D3D9_KHR: { surface = - std::auto_ptr(new CD3D9SurfaceWrapper); + std::unique_ptr(new CD3D9SurfaceWrapper); CD3D9SurfaceWrapper *d3dSurface = static_cast(surface.get()); HRESULT hr = 0; @@ -1578,7 +1578,7 @@ bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType, break; case CL_ADAPTER_D3D9EX_KHR: { surface = - std::auto_ptr(new CD3D9SurfaceWrapper); + std::unique_ptr(new CD3D9SurfaceWrapper); CD3D9SurfaceWrapper *d3dSurface = static_cast(surface.get()); HRESULT hr = 0; @@ -1598,7 +1598,7 @@ bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType, break; case CL_ADAPTER_DXVA_KHR: { surface = - std::auto_ptr(new CD3D9SurfaceWrapper); + std::unique_ptr(new CD3D9SurfaceWrapper); CD3D9SurfaceWrapper *d3dSurface = static_cast(surface.get()); HRESULT hr = 0; diff --git a/test_conformance/extensions/cl_khr_dx9_media_sharing/utils.h b/test_conformance/extensions/cl_khr_dx9_media_sharing/utils.h index 56c0fc2c..9c18eaff 100644 --- a/test_conformance/extensions/cl_khr_dx9_media_sharing/utils.h +++ b/test_conformance/extensions/cl_khr_dx9_media_sharing/utils.h @@ -116,24 +116,24 @@ void YUVGenerateYV12(std::vector &yuv, unsigned int width, bool YUVGenerate(TSurfaceFormat surfaceFormat, std::vector &yuv, unsigned int width, unsigned int height, cl_uchar valueMin, cl_uchar valueMax, double valueAdd = 0.0); -bool YUVSurfaceSetNV12(std::auto_ptr &surface, +bool YUVSurfaceSetNV12(std::unique_ptr &surface, const std::vector &yuv, unsigned int width, unsigned int height); -bool YUVSurfaceSetYV12(std::auto_ptr &surface, +bool YUVSurfaceSetYV12(std::unique_ptr &surface, const std::vector &yuv, unsigned int width, unsigned int height); bool YUVSurfaceSet(TSurfaceFormat surfaceFormat, - std::auto_ptr &surface, + std::unique_ptr &surface, const std::vector &yuv, unsigned int width, unsigned int height); -bool YUVSurfaceGetNV12(std::auto_ptr &surface, +bool YUVSurfaceGetNV12(std::unique_ptr &surface, std::vector &yuv, unsigned int width, unsigned int height); -bool YUVSurfaceGetYV12(std::auto_ptr &surface, +bool YUVSurfaceGetYV12(std::unique_ptr &surface, std::vector &yuv, unsigned int width, unsigned int height); bool YUVSurfaceGet(TSurfaceFormat surfaceFormat, - std::auto_ptr &surface, + std::unique_ptr &surface, std::vector &yuv, unsigned int width, unsigned int height); bool YUVCompareNV12(const std::vector &yuvTest, @@ -178,12 +178,12 @@ bool GetImageInfo(cl_mem object, cl_image_format formatExp, size_t slicePitchExp, size_t widthExp, size_t heightExp, size_t depthExp, unsigned int planeExp); bool GetMemObjInfo(cl_mem object, cl_dx9_media_adapter_type_khr adapterType, - std::auto_ptr &surface, + std::unique_ptr &surface, void *shareHandleExp); bool ImageInfoVerify(cl_dx9_media_adapter_type_khr adapterType, const std::vector &memObjList, unsigned int width, unsigned int height, - std::auto_ptr &surface, + std::unique_ptr &surface, void *sharedHandle); bool ImageFormatCheck(cl_context context, cl_mem_object_type imageType, const cl_image_format imageFormatCheck); @@ -195,7 +195,7 @@ D3DFORMAT SurfaceFormatToD3D(TSurfaceFormat surfaceFormat); #endif bool DeviceCreate(cl_dx9_media_adapter_type_khr adapterType, - std::auto_ptr &device); + std::unique_ptr &device); bool SurfaceFormatCheck(cl_dx9_media_adapter_type_khr adapterType, const CDeviceWrapper &device, TSurfaceFormat surfaceFormat); @@ -204,7 +204,7 @@ void SurfaceFormatToString(TSurfaceFormat surfaceFormat, std::string &str); bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType, unsigned int width, unsigned int height, TSurfaceFormat surfaceFormat, CDeviceWrapper &device, - std::auto_ptr &surface, + std::unique_ptr &surface, bool sharedHandle, void **objectSharedHandle); cl_int diff --git a/test_conformance/math_brute_force/reference_math.cpp b/test_conformance/math_brute_force/reference_math.cpp index 10e2bb73..049f2013 100644 --- a/test_conformance/math_brute_force/reference_math.cpp +++ b/test_conformance/math_brute_force/reference_math.cpp @@ -3196,7 +3196,7 @@ int reference_isgreaterequall(long double x, long double y) { return x >= y; } int reference_isinfl(long double x) { return 0 != isinf(x); } int reference_islessl(long double x, long double y) { return x < y; } int reference_islessequall(long double x, long double y) { return x <= y; } -#if defined(__INTEL_COMPILER) +#if defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER) int reference_islessgreaterl(long double x, long double y) { return 0 != islessgreaterl(x, y); @@ -3218,7 +3218,7 @@ int reference_isunorderedl(long double x, long double y) { return isnan(x) || isnan(y); } -#if defined(__INTEL_COMPILER) +#if defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER) int reference_signbitl(long double x) { return 0 != signbitl(x); } #else int reference_signbitl(long double x) { return 0 != signbit(x); } @@ -3582,7 +3582,8 @@ long double reference_exp2l(long double z) long double reference_expm1l(long double x) { -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) +#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) \ + && !defined(__INTEL_LLVM_COMPILER) // unimplemented return x; #else @@ -3667,7 +3668,8 @@ long double reference_log2l(long double x) long double reference_log1pl(long double x) { -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) +#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) \ + && !defined(__INTEL_LLVM_COMPILER) // unimplemented return x; #elif defined(__PPC__) diff --git a/test_conformance/math_brute_force/utility.h b/test_conformance/math_brute_force/utility.h index c321fcb1..74cacc46 100644 --- a/test_conformance/math_brute_force/utility.h +++ b/test_conformance/math_brute_force/utility.h @@ -215,7 +215,8 @@ inline void Force64BitFPUPrecision(void) __asm__ __volatile__("fstcw %0" : "=m"(orig_cw)); new_cw = orig_cw | 0x0300; // set precision to 64-bit __asm__ __volatile__("fldcw %0" ::"m"(new_cw)); -#elif defined(_WIN32) && defined(__INTEL_COMPILER) +#elif defined(_WIN32) \ + && (defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)) // Unfortunately, usual method (`_controlfp( _PC_64, _MCW_PC );') does *not* // work on win.x64: > On the x64 architecture, changing the floating point // precision is not supported. (Taken from