mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix pow and other cwise ops for half/bfloat16.
The new `generic_pow` implementation was failing for half/bfloat16 since their construction from int/float is not `constexpr`. Modified in `GenericPacketMathFunctions` to remove `constexpr`. While adding tests for half/bfloat16, found other issues related to implicit conversions. Also needed to implement `numext::arg` for non-integer, non-complex, non-float/double/long double types. These seem to be implicitly converted to `std::complex<T>`, which then fails for half/bfloat16.
This commit is contained in:
@@ -804,8 +804,8 @@ EIGEN_STRONG_INLINE
|
||||
void veltkamp_splitting(const Packet& x, Packet& x_hi, Packet& x_lo) {
|
||||
typedef typename unpacket_traits<Packet>::type Scalar;
|
||||
EIGEN_CONSTEXPR int shift = (NumTraits<Scalar>::digits() + 1) / 2;
|
||||
EIGEN_CONSTEXPR Scalar shift_scale = Scalar(uint64_t(1) << shift);
|
||||
Packet gamma = pmul(pset1<Packet>(shift_scale + 1), x);
|
||||
Scalar shift_scale = Scalar(uint64_t(1) << shift); // Scalar constructor not necessarily constexpr.
|
||||
Packet gamma = pmul(pset1<Packet>(shift_scale + Scalar(1)), x);
|
||||
#ifdef EIGEN_HAS_SINGLE_INSTRUCTION_MADD
|
||||
x_hi = pmadd(pset1<Packet>(-shift_scale), x, gamma);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user