git: 73341bbefa72 - main - graphics/opencv: fix build with LLVM 13 on powerpc64le
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Mar 2022 02:21:01 UTC
The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=73341bbefa7237dc8c430400d72b376b2378f0ea commit 73341bbefa7237dc8c430400d72b376b2378f0ea Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2022-03-21 02:17:46 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2022-03-21 02:17:46 +0000 graphics/opencv: fix build with LLVM 13 on powerpc64le /wrkdirs/usr/ports/graphics/opencv/work/opencv-4.5.5/modules/core/include/opencv2/core/vsx_utils.hpp:352:12: warning: 'vec_permi' macro redefined [-Wmacro-redefined] ^ /usr/lib/clang/13.0.0/include/altivec.h:13077:9: note: previous definition is here ^ /wrkdirs/usr/ports/graphics/opencv/work/opencv-4.5.5/modules/core/include/opencv2/core/vsx_utils.hpp:370:25: error: redefinition of 'vec_promote' VSX_FINLINE(vec_dword2) vec_promote(long long a, int b) ^ /usr/lib/clang/13.0.0/include/altivec.h:14604:1: note: previous definition is here vec_promote(signed long long __a, int __b) { ^ /wrkdirs/usr/ports/graphics/opencv/work/opencv-4.5.5/modules/core/include/opencv2/core/vsx_utils.hpp:377:26: error: redefinition of 'vec_promote' VSX_FINLINE(vec_udword2) vec_promote(unsigned long long a, int b) ^ /usr/lib/clang/13.0.0/include/altivec.h:14611:1: note: previous definition is here vec_promote(unsigned long long __a, int __b) { ^ /wrkdirs/usr/ports/graphics/opencv/work/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:1045:22: error: call to 'vec_rsqrt' is ambiguous { return v_float32x4(vec_rsqrt(x.val)); } ^~~~~~~~~ /usr/lib/clang/13.0.0/include/altivec.h:8472:34: note: candidate function static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) { ^ /wrkdirs/usr/ports/graphics/opencv/work/opencv-4.5.5/modules/core/include/opencv2/core/vsx_utils.hpp:362:29: note: candidate function VSX_FINLINE(vec_float4) vec_rsqrt(const vec_float4& a) ^ /wrkdirs/usr/ports/graphics/opencv/work/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:1047:22: error: call to 'vec_rsqrt' is ambiguous { return v_float64x2(vec_rsqrt(x.val)); } ^~~~~~~~~ /usr/lib/clang/13.0.0/include/altivec.h:8477:35: note: candidate function static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) { ^ /wrkdirs/usr/ports/graphics/opencv/work/opencv-4.5.5/modules/core/include/opencv2/core/vsx_utils.hpp:365:30: note: candidate function VSX_FINLINE(vec_double2) vec_rsqrt(const vec_double2& a) ^ 1 warning and 4 errors generated. --- ...odules_core_include_opencv2_core_vsx__utils.hpp | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/graphics/opencv/files/patch-modules_core_include_opencv2_core_vsx__utils.hpp b/graphics/opencv/files/patch-modules_core_include_opencv2_core_vsx__utils.hpp new file mode 100644 index 000000000000..4802cdfb7ec5 --- /dev/null +++ b/graphics/opencv/files/patch-modules_core_include_opencv2_core_vsx__utils.hpp @@ -0,0 +1,33 @@ +--- modules/core/include/opencv2/core/vsx_utils.hpp.orig 2022-03-21 01:40:15 UTC ++++ modules/core/include/opencv2/core/vsx_utils.hpp +@@ -324,6 +324,7 @@ VSX_IMPL_1RG(vec_udword2, vec_float4, xvcvspuxds, vec + #define VSX_IMPL_CONVERT(rt, rg, fnm) \ + VSX_FINLINE(rt) fnm(const rg& a) { return __builtin_convertvector(a, rt); } + ++#ifndef vec_permi + #if __clang_major__ < 5 + // implement vec_permi in a dirty way + # define VSX_IMPL_CLANG_4_PERMI(Tvec) \ +@@ -351,12 +352,14 @@ VSX_FINLINE(rt) fnm(const rg& a) { return __builtin_co + // vec_xxpermdi is missing little-endian supports in clang 4 just like gcc4 + # define vec_permi(a, b, c) vec_xxpermdi(b, a, (3 ^ (((c) & 1) << 1 | (c) >> 1))) + #endif // __clang_major__ < 5 ++#endif // vec_permi + + // shift left double by word immediate + #ifndef vec_sldw + # define vec_sldw vec_xxsldwi + #endif + ++#if __clang_major__ < 13 + // Implement vec_rsqrt since clang only supports vec_rsqrte + #ifndef vec_rsqrt + VSX_FINLINE(vec_float4) vec_rsqrt(const vec_float4& a) +@@ -380,6 +383,7 @@ VSX_FINLINE(vec_udword2) vec_promote(unsigned long lon + ret[b & 1] = a; + return ret; + } ++#endif + + // vec_popcnt should return unsigned but clang has different thought just like gcc in vec_vpopcnt + #define VSX_IMPL_POPCNTU(Tvec, Tvec2, ucast) \