Use of builtin vec_sel is ambiguous when compiling with Clang for PowerPC
Submitted by João Paulo Labegalini de Carvalho
Assigned to Nobody
Link to original bugzilla bug (#1718)
Version: 3.3 (current stable)
Operating system: Linux
Description
Created attachment 941
minimal source code example
I am not sure if this is an Eigen or Clang bug. However this is the behavior. When I compile the file bug.cc (attached) with Clang for PowerPC with the following command:
clang++ -target powerpc64le-unknown-linux-gnu -maltivec -I ../../eigen-mirror -o bug bug.cc
I get the following error:
Eigen/src/Core/arch/AltiVec/PacketMath.h:455:10: error: call to 'vec_sel' is ambiguous
return vec_sel(b, a, mask);
By inspecting <clang-sysroot>/lib/clang/9.0.0/include/altivec.h I have noticed that it does not define a vec_sel(float,float,float) builtin. The best candidates are vec_sel(float,float,unsigned int) and vec_sel(float,float,int).
The same file (bug.cc) successfully compiles with GCC. The problem can be solved by applying the following patch:
diff --git a/Eigen/src/Core/arch/AltiVec/PacketMath.h b/Eigen/src/Core/arch/AltiVec/PacketMath.h
index 4b770d036..bae9cb172 100755
--- a/Eigen/src/Core/arch/AltiVec/PacketMath.h
+++ b/Eigen/src/Core/arch/AltiVec/PacketMath.h
@@ -452,7 +452,8 @@ template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, con
template<> EIGEN_STRONG_INLINE Packet4i pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_and(a, vec_nor(b, b)); }
template<> EIGEN_STRONG_INLINE Packet4f pselect(const Packet4f& mask, const Packet4f& a, const Packet4f& b) {
- return vec_sel(b, a, mask);
-
const Packet4ui _mask = reinterpret_cast<Packet4ui>(vec_cmpeq(reinterpret_cast<Packet4ui>(mask), reinterpret_cast<Packet4ui>(p4i_ONE)));
-
return vec_sel(b, a, _mask);
}
Attachment 941, "minimal source code example":