mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Fix address of temporary object errors in clang11.
This fixes the problem with taking the address of temporary objects which clang11 treats as errors.
This commit is contained in:
parent
e4233b6e3d
commit
c24bee6120
@ -139,8 +139,8 @@ EIGEN_STRONG_INLINE Packet2cf pload2(const std::complex<float>* from0, const std
|
|||||||
__asm__ ("xxpermdi %x0, %x2, %x1, 0" : "=wa" (res0) : "wa" (res0), "wa" (res1));
|
__asm__ ("xxpermdi %x0, %x2, %x1, 0" : "=wa" (res0) : "wa" (res0), "wa" (res1));
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
*((std::complex<float> *)&res0[0]) = *from0;
|
*reinterpret_cast<std::complex<float> *>(&res0) = *from0;
|
||||||
*((std::complex<float> *)&res1[0]) = *from1;
|
*reinterpret_cast<std::complex<float> *>(&res1) = *from1;
|
||||||
res0 = vec_perm(res0, res1, p16uc_TRANSPOSE64_HI);
|
res0 = vec_perm(res0, res1, p16uc_TRANSPOSE64_HI);
|
||||||
#endif
|
#endif
|
||||||
return Packet2cf(res0);
|
return Packet2cf(res0);
|
||||||
|
@ -486,19 +486,28 @@ struct dhs_cpack {
|
|||||||
if(((StorageOrder == ColMajor) && UseLhs) || (((StorageOrder == RowMajor) && !UseLhs)))
|
if(((StorageOrder == ColMajor) && UseLhs) || (((StorageOrder == RowMajor) && !UseLhs)))
|
||||||
{
|
{
|
||||||
if (UseLhs) {
|
if (UseLhs) {
|
||||||
cblock.packet[0] = pload<PacketC>(&lhs(j + 0, i));
|
cblock.packet[0] = lhs.template loadPacket<PacketC>(j + 0, i);
|
||||||
cblock.packet[1] = pload<PacketC>(&lhs(j + 2, i));
|
cblock.packet[1] = lhs.template loadPacket<PacketC>(j + 2, i);
|
||||||
} else {
|
} else {
|
||||||
cblock.packet[0] = pload<PacketC>(&lhs(i, j + 0));
|
cblock.packet[0] = lhs.template loadPacket<PacketC>(i, j + 0);
|
||||||
cblock.packet[1] = pload<PacketC>(&lhs(i, j + 2));
|
cblock.packet[1] = lhs.template loadPacket<PacketC>(i, j + 2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const std::complex<Scalar> *lhs0, *lhs1;
|
||||||
if (UseLhs) {
|
if (UseLhs) {
|
||||||
cblock.packet[0] = pload2(&lhs(j + 0, i), &lhs(j + 1, i));
|
lhs0 = &lhs(j + 0, i);
|
||||||
cblock.packet[1] = pload2(&lhs(j + 2, i), &lhs(j + 3, i));
|
lhs1 = &lhs(j + 1, i);
|
||||||
|
cblock.packet[0] = pload2(lhs0, lhs1);
|
||||||
|
lhs0 = &lhs(j + 2, i);
|
||||||
|
lhs1 = &lhs(j + 3, i);
|
||||||
|
cblock.packet[1] = pload2(lhs0, lhs1);
|
||||||
} else {
|
} else {
|
||||||
cblock.packet[0] = pload2(&lhs(i, j + 0), &lhs(i, j + 1));
|
lhs0 = &lhs(i, j + 0);
|
||||||
cblock.packet[1] = pload2(&lhs(i, j + 2), &lhs(i, j + 3));
|
lhs1 = &lhs(i, j + 1);
|
||||||
|
cblock.packet[0] = pload2(lhs0, lhs1);
|
||||||
|
lhs0 = &lhs(i, j + 2);
|
||||||
|
lhs1 = &lhs(i, j + 3);
|
||||||
|
cblock.packet[1] = pload2(lhs0, lhs1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,8 +868,8 @@ struct dhs_cpack<double, Index, DataMapper, Packet, PacketC, StorageOrder, Conju
|
|||||||
PacketBlock<Packet,1> blockr, blocki;
|
PacketBlock<Packet,1> blockr, blocki;
|
||||||
PacketBlock<PacketC,2> cblock;
|
PacketBlock<PacketC,2> cblock;
|
||||||
|
|
||||||
cblock.packet[0] = pload<PacketC>(&lhs(j + 0, i));
|
cblock.packet[0] = lhs.template loadPacket<PacketC>(j + 0, i);
|
||||||
cblock.packet[1] = pload<PacketC>(&lhs(j + 1, i));
|
cblock.packet[1] = lhs.template loadPacket<PacketC>(j + 1, i);
|
||||||
|
|
||||||
blockr.packet[0] = vec_perm(cblock.packet[0].v, cblock.packet[1].v, p16uc_GETREAL64);
|
blockr.packet[0] = vec_perm(cblock.packet[0].v, cblock.packet[1].v, p16uc_GETREAL64);
|
||||||
blocki.packet[0] = vec_perm(cblock.packet[0].v, cblock.packet[1].v, p16uc_GETIMAG64);
|
blocki.packet[0] = vec_perm(cblock.packet[0].v, cblock.packet[1].v, p16uc_GETIMAG64);
|
||||||
@ -1100,7 +1109,7 @@ EIGEN_STRONG_INLINE void pgerc(PacketBlock<Packet,N>* accReal, PacketBlock<Packe
|
|||||||
template<typename Scalar, typename Packet>
|
template<typename Scalar, typename Packet>
|
||||||
EIGEN_STRONG_INLINE Packet ploadLhs(const Scalar* lhs)
|
EIGEN_STRONG_INLINE Packet ploadLhs(const Scalar* lhs)
|
||||||
{
|
{
|
||||||
return *((Packet *)lhs);
|
return *reinterpret_cast<Packet *>(const_cast<Scalar *>(lhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zero the accumulator on PacketBlock.
|
// Zero the accumulator on PacketBlock.
|
||||||
@ -1799,24 +1808,6 @@ EIGEN_STRONG_INLINE void MICRO_COMPLEX_EXTRA_COL(
|
|||||||
else EIGEN_UNUSED_VARIABLE(rhs_ptr_imag);
|
else EIGEN_UNUSED_VARIABLE(rhs_ptr_imag);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Scalar, typename Packetc, typename Index, const Index accCols>
|
|
||||||
EIGEN_STRONG_INLINE void pstore_add_half(std::complex<Scalar>* to, Packetc &from)
|
|
||||||
{
|
|
||||||
#ifdef __VSX__
|
|
||||||
Packetc from2;
|
|
||||||
#ifndef _BIG_ENDIAN
|
|
||||||
__asm__ ("xxswapd %x0, %x0" : : "wa" (from.v));
|
|
||||||
#endif
|
|
||||||
__asm__ ("lxsdx %x0,%y1" : "=wa" (from2.v) : "Z" (*to));
|
|
||||||
from2 += from;
|
|
||||||
__asm__ ("stxsdx %x0,%y1" : : "wa" (from2.v), "Z" (*to));
|
|
||||||
#else
|
|
||||||
std::complex<Scalar> mem[accColsC];
|
|
||||||
pstoreu<std::complex<Scalar> >(mem, from);
|
|
||||||
*to += *mem;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Scalar, typename Packet, typename Packetc, typename DataMapper, typename Index, const Index accRows, const Index accCols, bool ConjugateLhs, bool ConjugateRhs, bool LhsIsReal, bool RhsIsReal>
|
template<typename Scalar, typename Packet, typename Packetc, typename DataMapper, typename Index, const Index accRows, const Index accCols, bool ConjugateLhs, bool ConjugateRhs, bool LhsIsReal, bool RhsIsReal>
|
||||||
EIGEN_STRONG_INLINE void gemm_complex_extra_col(
|
EIGEN_STRONG_INLINE void gemm_complex_extra_col(
|
||||||
const DataMapper& res,
|
const DataMapper& res,
|
||||||
@ -1886,12 +1877,12 @@ EIGEN_STRONG_INLINE void gemm_complex_extra_col(
|
|||||||
|
|
||||||
if ((sizeof(Scalar) == sizeof(float)) && (remaining_rows == 1))
|
if ((sizeof(Scalar) == sizeof(float)) && (remaining_rows == 1))
|
||||||
{
|
{
|
||||||
pstore_add_half<Scalar, Packetc, Index, accCols>(&res(row + 0, col + 0), acc0.packet[0]);
|
res(row + 0, col + 0) += pfirst<Packetc>(acc0.packet[0]);
|
||||||
} else {
|
} else {
|
||||||
acc0.packet[0] += res.template loadPacket<Packetc>(row + 0, col + 0);
|
acc0.packet[0] += res.template loadPacket<Packetc>(row + 0, col + 0);
|
||||||
res.template storePacketBlock<Packetc,1>(row + 0, col + 0, acc0);
|
res.template storePacketBlock<Packetc,1>(row + 0, col + 0, acc0);
|
||||||
if(remaining_rows > accColsC) {
|
if(remaining_rows > accColsC) {
|
||||||
pstore_add_half<Scalar, Packetc, Index, accCols>(&res(row + accColsC, col + 0), acc1.packet[0]);
|
res(row + accColsC, col + 0) += pfirst<Packetc>(acc1.packet[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1997,7 +1988,7 @@ asm("#gemm_complex begin");
|
|||||||
if ((sizeof(Scalar) == sizeof(float)) && (remaining_rows == 1))
|
if ((sizeof(Scalar) == sizeof(float)) && (remaining_rows == 1))
|
||||||
{
|
{
|
||||||
for(Index j = 0; j < 4; j++) {
|
for(Index j = 0; j < 4; j++) {
|
||||||
pstore_add_half<Scalar, Packetc, Index, accCols>(&res(row + 0, col + j), acc0.packet[j]);
|
res(row + 0, col + j) += pfirst<Packetc>(acc0.packet[j]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(Index j = 0; j < 4; j++) {
|
for(Index j = 0; j < 4; j++) {
|
||||||
@ -2005,7 +1996,7 @@ asm("#gemm_complex begin");
|
|||||||
acc2.packet[0] = res.template loadPacket<Packetc>(row + 0, col + j) + acc0.packet[j];
|
acc2.packet[0] = res.template loadPacket<Packetc>(row + 0, col + j) + acc0.packet[j];
|
||||||
res.template storePacketBlock<Packetc,1>(row + 0, col + j, acc2);
|
res.template storePacketBlock<Packetc,1>(row + 0, col + j, acc2);
|
||||||
if(remaining_rows > accColsC) {
|
if(remaining_rows > accColsC) {
|
||||||
pstore_add_half<Scalar, Packetc, Index, accCols>(&res(row + accColsC, col + j), acc1.packet[j]);
|
res(row + accColsC, col + j) += pfirst<Packetc>(acc1.packet[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ EIGEN_STRONG_INLINE void bcouple_common<Packet2d, Packet1cd>(PacketBlock<Packet2
|
|||||||
template<typename Scalar, typename Packet>
|
template<typename Scalar, typename Packet>
|
||||||
EIGEN_STRONG_INLINE Packet ploadRhs(const Scalar* rhs)
|
EIGEN_STRONG_INLINE Packet ploadRhs(const Scalar* rhs)
|
||||||
{
|
{
|
||||||
return *((Packet *)rhs);
|
return *reinterpret_cast<Packet *>(const_cast<Scalar *>(rhs));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user