void-packages/srcpkgs/digikam/patches/altivec.patch

84 lines
3.4 KiB
Diff

The AltiVec header typically defines the keywords "vector" and "bool" that
can be used within vector code, however this is not really compatible with
C++, so these tend to be undef'd in a C++ environment.
This is what happens here, at least in our specific environment, so use the
prefixed gcc/clang versions, which are available builtin, so the compilation
does not fail.
--- core/libs/facesengine/recognition/dlib-dnn/dnnface/dnn_base/simd4f.h
+++ core/libs/facesengine/recognition/dlib-dnn/dnnface/dnn_base/simd4f.h
@@ -109,7 +109,7 @@
class simd4f
{
typedef union {
- vector float v;
+ __vector float v;
float x[4];
} v4f;
@@ -118,7 +118,7 @@
public:
inline simd4f() : x{0,0,0,0} {}
inline simd4f(const simd4f& v) : x(v.x) { }
- inline simd4f(const vector float& v) : x{v} { }
+ inline simd4f(const __vector float& v) : x{v} { }
inline simd4f(const simd4i& v) {
x.x[0]=v[0]; x.x[1]=v[1]; x.x[2]=v[2]; x.x[3]=v[3];
@@ -132,7 +132,7 @@
inline simd4f& operator=(const simd4f& v) { x = v.x; return *this; }
inline simd4f& operator=(const float& v) { *this = simd4f(v); return *this; }
- inline vector float operator() () const { return x.v; }
+ inline __vector float operator() () const { return x.v; }
inline float operator[](unsigned int idx) const { return x.x[idx]; }
inline void load_aligned(const float* ptr) { x.v = vec_ld(0, ptr); }
--- core/libs/facesengine/recognition/dlib-dnn/dnnface/dnn_base/simd4i.h
+++ core/libs/facesengine/recognition/dlib-dnn/dnnface/dnn_base/simd4i.h
@@ -73,8 +73,8 @@
class simd4i
{
typedef union {
- vector signed int v;
- vector bool int b;
+ __vector signed int v;
+ __vector __bool int b;
signed int x[4];
} v4i;
@@ -83,8 +83,8 @@
public:
inline simd4i() : x{0,0,0,0} { }
inline simd4i(const simd4i& v) : x(v.x) { }
- inline simd4i(const vector int& v) : x{v} { }
- inline simd4i(const vector bool int& b) { x.b=b; }
+ inline simd4i(const __vector int& v) : x{v} { }
+ inline simd4i(const __vector __bool int& b) { x.b=b; }
inline simd4i(int32 f) : x{f,f,f,f} { }
inline simd4i(int32 r0, int32 r1, int32 r2, int32 r3)
@@ -93,10 +93,10 @@
inline simd4i& operator=(const simd4i& v) { x = v.x; return *this; }
inline simd4i& operator=(const int32& v) { *this = simd4i(v); return *this; }
- inline vector signed int operator() () const { return x.v; }
+ inline __vector signed int operator() () const { return x.v; }
inline int32 operator[](unsigned int idx) const { return x.x[idx]; }
- inline vector bool int to_bool() const { return x.b; }
+ inline __vector __bool int to_bool() const { return x.b; }
// intrinsics now seem to use xxpermdi automatically now
inline void load_aligned(const int32* ptr) { x.v = vec_ld(0, ptr); }
@@ -230,7 +230,7 @@
_lhs[2]*_rhs[2],
_lhs[3]*_rhs[3]);
#elif defined(DLIB_HAVE_VSX)
- vector int a = lhs(), b = rhs();
+ __vector int a = lhs(), b = rhs();
asm("vmuluwm %0, %0, %1\n\t" : "+&v" (a) : "v" (b) );
return simd4i(a);
#else