Ich versuche, einige gängige Hilfsfunktionen zu schreiben, wie z.B. die Addition aller Elemente in einem gcc-Vektor.
inline float add_all(float const in __attribute__((vector_size(8))))
{
return in[0] + in[1];
}
inline float add_all(float const in __attribute__((vector_size(16))))
{
return in[0] + in[1] + in[2] + in[3];
}
inline double add_all(double const in __attribute__((vector_size(16))))
{
return in[0] + in[1];
}
inline double add_all(double const in __attribute__((vector_size(32))))
{
return in[0] + in[1] + in[2] + in[3];
}
Allerdings meldet gcc beim Kompilieren:
In file included from matrix.hpp:5:0,
from matrix.cpp:3:
vector.hpp:22:1: Fehler: 'float vxl::add_all(__vector(4) float)' steht im Widerspruch zu einer früheren Deklaration
}
^
vector.hpp:14:14: Hinweis: frühere Deklaration 'float vxl::add_all(__vector(2) float)'
inline float add_all(float const in __attribute__((vector_size(8))))
^
vector.hpp:19:14: Hinweis: -fabi-version=6 (or =0) vermeidet diesen Fehler mit einer Änderung im Mangeln
inline float add_all(float const in __attribute__((vector_size(16))))
^
vector.hpp:32:1: Fehler: 'double vxl::add_all(__vector(4) double)' steht im Widerspruch zu einer früheren Deklaration
}
^
vector.hpp:24:15: Hinweis: frühere Deklaration 'double vxl::add_all(__vector(2) double)'
inline double add_all(double const in __attribute__((vector_size(16))))
^
vector.hpp:29:15: Hinweis: -fabi-version=6 (or =0) vermeidet diesen Fehler mit einer Änderung im Mangeln
inline double add_all(double const in __attribute__((vector_size(32))))
Gibt es eine Lösung, außer der von gcc vorgeschlagenen?