Vectorize acos, asin, and atan for float.

This commit is contained in:
Rasmus Munk Larsen
2022-08-29 19:49:33 +00:00
parent e5af9f87f2
commit bd393e15c3
12 changed files with 262 additions and 0 deletions

View File

@@ -75,6 +75,24 @@ Packet4f pcos<Packet4f>(const Packet4f& _x)
return pcos_float(_x);
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet4f pacos<Packet4f>(const Packet4f& _x)
{
return pacos_float(_x);
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet4f pasin<Packet4f>(const Packet4f& _x)
{
return pasin_float(_x);
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Packet4f patan<Packet4f>(const Packet4f& _x)
{
return patan_float(_x);
}
// Notice that for newer processors, it is counterproductive to use Newton
// iteration for square root. In particular, Skylake and Zen2 processors
// have approximately doubled throughput of the _mm_sqrt_ps instruction

View File

@@ -139,6 +139,9 @@ struct packet_traits<float> : default_packet_traits {
HasReciprocal = EIGEN_FAST_MATH,
HasSin = EIGEN_FAST_MATH,
HasCos = EIGEN_FAST_MATH,
HasACos = 1,
HasASin = 1,
HasATan = 1,
HasLog = 1,
HasLog1p = 1,
HasExpm1 = 1,