1 // This file is part of Eigen, a lightweight C++ template library 2 // for linear algebra. 3 // 4 // Copyright (C) 2010 Gael Guennebaud <gael.guennebaud@inria.fr> 5 // Copyright (C) 2010-2016 Konstantinos Margaritis <markos@freevec.org> 6 // 7 // This Source Code Form is subject to the terms of the Mozilla 8 // Public License v. 2.0. If a copy of the MPL was not distributed 9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 11 #ifndef EIGEN_COMPLEX32_ALTIVEC_H 12 #define EIGEN_COMPLEX32_ALTIVEC_H 13 14 namespace Eigen { 15 16 namespace internal { 17 18 static Packet4ui p4ui_CONJ_XOR = vec_mergeh((Packet4ui)p4i_ZERO, (Packet4ui)p4f_MZERO);//{ 0x00000000, 0x80000000, 0x00000000, 0x80000000 }; 19 #ifdef __VSX__ 20 #if defined(_BIG_ENDIAN) 21 static Packet2ul p2ul_CONJ_XOR1 = (Packet2ul) vec_sld((Packet4ui) p2d_MZERO, (Packet4ui) p2l_ZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 }; 22 static Packet2ul p2ul_CONJ_XOR2 = (Packet2ul) vec_sld((Packet4ui) p2l_ZERO, (Packet4ui) p2d_MZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 }; 23 #else 24 static Packet2ul p2ul_CONJ_XOR1 = (Packet2ul) vec_sld((Packet4ui) p2l_ZERO, (Packet4ui) p2d_MZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 }; 25 static Packet2ul p2ul_CONJ_XOR2 = (Packet2ul) vec_sld((Packet4ui) p2d_MZERO, (Packet4ui) p2l_ZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 }; 26 #endif 27 #endif 28 29 //---------- float ---------- 30 struct Packet2cf 31 { Packet2cfPacket2cf32 EIGEN_STRONG_INLINE explicit Packet2cf() : v(p4f_ZERO) {} Packet2cfPacket2cf33 EIGEN_STRONG_INLINE explicit Packet2cf(const Packet4f& a) : v(a) {} 34 Packet4f v; 35 }; 36 37 template<> struct packet_traits<std::complex<float> > : default_packet_traits 38 { 39 typedef Packet2cf type; 40 typedef Packet2cf half; 41 enum { 42 Vectorizable = 1, 43 AlignedOnScalar = 1, 44 size = 2, 45 HasHalfPacket = 0, 46 47 HasAdd = 1, 48 HasSub = 1, 49 HasMul = 1, 50 HasDiv = 1, 51 HasNegate = 1, 52 HasAbs = 0, 53 HasAbs2 = 0, 54 HasMin = 0, 55 HasMax = 0, 56 #ifdef __VSX__ 57 HasBlend = 1, 58 #endif 59 HasSetLinear = 0 60 }; 61 }; 62 63 template<> struct unpacket_traits<Packet2cf> { typedef std::complex<float> type; enum {size=2, alignment=Aligned16}; typedef Packet2cf half; }; 64 65 template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>& from) 66 { 67 Packet2cf res; 68 if((std::ptrdiff_t(&from) % 16) == 0) 69 res.v = pload<Packet4f>((const float *)&from); 70 else 71 res.v = ploadu<Packet4f>((const float *)&from); 72 res.v = vec_perm(res.v, res.v, p16uc_PSET64_HI); 73 return res; 74 } 75 76 template<> EIGEN_STRONG_INLINE Packet2cf pload<Packet2cf>(const std::complex<float>* from) { return Packet2cf(pload<Packet4f>((const float *) from)); } 77 template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from) { return Packet2cf(ploadu<Packet4f>((const float*) from)); } 78 template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>* from) { return pset1<Packet2cf>(*from); } 79 80 template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { pstore((float*)to, from.v); } 81 template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { pstoreu((float*)to, from.v); } 82 83 template<> EIGEN_DEVICE_FUNC inline Packet2cf pgather<std::complex<float>, Packet2cf>(const std::complex<float>* from, Index stride) 84 { 85 std::complex<float> EIGEN_ALIGN16 af[2]; 86 af[0] = from[0*stride]; 87 af[1] = from[1*stride]; 88 return pload<Packet2cf>(af); 89 } 90 template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::complex<float>* to, const Packet2cf& from, Index stride) 91 { 92 std::complex<float> EIGEN_ALIGN16 af[2]; 93 pstore<std::complex<float> >((std::complex<float> *) af, from); 94 to[0*stride] = af[0]; 95 to[1*stride] = af[1]; 96 } 97 98 template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(a.v + b.v); } 99 template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(a.v - b.v); } 100 template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(pnegate(a.v)); } 101 template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a) { return Packet2cf(pxor<Packet4f>(a.v, reinterpret_cast<Packet4f>(p4ui_CONJ_XOR))); } 102 103 template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b) 104 { 105 Packet4f v1, v2; 106 107 // Permute and multiply the real parts of a and b 108 v1 = vec_perm(a.v, a.v, p16uc_PSET32_WODD); 109 // Get the imaginary parts of a 110 v2 = vec_perm(a.v, a.v, p16uc_PSET32_WEVEN); 111 // multiply a_re * b 112 v1 = vec_madd(v1, b.v, p4f_ZERO); 113 // multiply a_im * b and get the conjugate result 114 v2 = vec_madd(v2, b.v, p4f_ZERO); 115 v2 = reinterpret_cast<Packet4f>(pxor(v2, reinterpret_cast<Packet4f>(p4ui_CONJ_XOR))); 116 // permute back to a proper order 117 v2 = vec_perm(v2, v2, p16uc_COMPLEX32_REV); 118 119 return Packet2cf(padd<Packet4f>(v1, v2)); 120 } 121 122 template<> EIGEN_STRONG_INLINE Packet2cf pand <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pand<Packet4f>(a.v, b.v)); } 123 template<> EIGEN_STRONG_INLINE Packet2cf por <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(por<Packet4f>(a.v, b.v)); } 124 template<> EIGEN_STRONG_INLINE Packet2cf pxor <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pxor<Packet4f>(a.v, b.v)); } 125 template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pandnot<Packet4f>(a.v, b.v)); } 126 127 template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> * addr) { EIGEN_PPC_PREFETCH(addr); } 128 129 template<> EIGEN_STRONG_INLINE std::complex<float> pfirst<Packet2cf>(const Packet2cf& a) 130 { 131 std::complex<float> EIGEN_ALIGN16 res[2]; 132 pstore((float *)&res, a.v); 133 134 return res[0]; 135 } 136 137 template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a) 138 { 139 Packet4f rev_a; 140 rev_a = vec_perm(a.v, a.v, p16uc_COMPLEX32_REV2); 141 return Packet2cf(rev_a); 142 } 143 144 template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packet2cf& a) 145 { 146 Packet4f b; 147 b = vec_sld(a.v, a.v, 8); 148 b = padd<Packet4f>(a.v, b); 149 return pfirst<Packet2cf>(Packet2cf(b)); 150 } 151 152 template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs) 153 { 154 Packet4f b1, b2; 155 #ifdef _BIG_ENDIAN 156 b1 = vec_sld(vecs[0].v, vecs[1].v, 8); 157 b2 = vec_sld(vecs[1].v, vecs[0].v, 8); 158 #else 159 b1 = vec_sld(vecs[1].v, vecs[0].v, 8); 160 b2 = vec_sld(vecs[0].v, vecs[1].v, 8); 161 #endif 162 b2 = vec_sld(b2, b2, 8); 163 b2 = padd<Packet4f>(b1, b2); 164 165 return Packet2cf(b2); 166 } 167 168 template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const Packet2cf& a) 169 { 170 Packet4f b; 171 Packet2cf prod; 172 b = vec_sld(a.v, a.v, 8); 173 prod = pmul<Packet2cf>(a, Packet2cf(b)); 174 175 return pfirst<Packet2cf>(prod); 176 } 177 178 template<int Offset> 179 struct palign_impl<Offset,Packet2cf> 180 { 181 static EIGEN_STRONG_INLINE void run(Packet2cf& first, const Packet2cf& second) 182 { 183 if (Offset==1) 184 { 185 #ifdef _BIG_ENDIAN 186 first.v = vec_sld(first.v, second.v, 8); 187 #else 188 first.v = vec_sld(second.v, first.v, 8); 189 #endif 190 } 191 } 192 }; 193 194 template<> struct conj_helper<Packet2cf, Packet2cf, false,true> 195 { 196 EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const 197 { return padd(pmul(x,y),c); } 198 199 EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const 200 { 201 return internal::pmul(a, pconj(b)); 202 } 203 }; 204 205 template<> struct conj_helper<Packet2cf, Packet2cf, true,false> 206 { 207 EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const 208 { return padd(pmul(x,y),c); } 209 210 EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const 211 { 212 return internal::pmul(pconj(a), b); 213 } 214 }; 215 216 template<> struct conj_helper<Packet2cf, Packet2cf, true,true> 217 { 218 EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const 219 { return padd(pmul(x,y),c); } 220 221 EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const 222 { 223 return pconj(internal::pmul(a, b)); 224 } 225 }; 226 227 template<> struct conj_helper<Packet4f, Packet2cf, false,false> 228 { 229 EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet4f& x, const Packet2cf& y, const Packet2cf& c) const 230 { return padd(c, pmul(x,y)); } 231 232 EIGEN_STRONG_INLINE Packet2cf pmul(const Packet4f& x, const Packet2cf& y) const 233 { return Packet2cf(internal::pmul<Packet4f>(x, y.v)); } 234 }; 235 236 template<> struct conj_helper<Packet2cf, Packet4f, false,false> 237 { 238 EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet4f& y, const Packet2cf& c) const 239 { return padd(c, pmul(x,y)); } 240 241 EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& x, const Packet4f& y) const 242 { return Packet2cf(internal::pmul<Packet4f>(x.v, y)); } 243 }; 244 245 template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b) 246 { 247 // TODO optimize it for AltiVec 248 Packet2cf res = conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a, b); 249 Packet4f s = pmul<Packet4f>(b.v, b.v); 250 return Packet2cf(pdiv(res.v, padd<Packet4f>(s, vec_perm(s, s, p16uc_COMPLEX32_REV)))); 251 } 252 253 template<> EIGEN_STRONG_INLINE Packet2cf pcplxflip<Packet2cf>(const Packet2cf& x) 254 { 255 return Packet2cf(vec_perm(x.v, x.v, p16uc_COMPLEX32_REV)); 256 } 257 258 EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet2cf,2>& kernel) 259 { 260 Packet4f tmp = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_HI); 261 kernel.packet[1].v = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_LO); 262 kernel.packet[0].v = tmp; 263 } 264 265 #ifdef __VSX__ 266 template<> EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, const Packet2cf& elsePacket) { 267 Packet2cf result; 268 result.v = reinterpret_cast<Packet4f>(pblend<Packet2d>(ifPacket, reinterpret_cast<Packet2d>(thenPacket.v), reinterpret_cast<Packet2d>(elsePacket.v))); 269 return result; 270 } 271 #endif 272 273 //---------- double ---------- 274 #ifdef __VSX__ 275 struct Packet1cd 276 { 277 EIGEN_STRONG_INLINE Packet1cd() {} 278 EIGEN_STRONG_INLINE explicit Packet1cd(const Packet2d& a) : v(a) {} 279 Packet2d v; 280 }; 281 282 template<> struct packet_traits<std::complex<double> > : default_packet_traits 283 { 284 typedef Packet1cd type; 285 typedef Packet1cd half; 286 enum { 287 Vectorizable = 1, 288 AlignedOnScalar = 0, 289 size = 1, 290 HasHalfPacket = 0, 291 292 HasAdd = 1, 293 HasSub = 1, 294 HasMul = 1, 295 HasDiv = 1, 296 HasNegate = 1, 297 HasAbs = 0, 298 HasAbs2 = 0, 299 HasMin = 0, 300 HasMax = 0, 301 HasSetLinear = 0 302 }; 303 }; 304 305 template<> struct unpacket_traits<Packet1cd> { typedef std::complex<double> type; enum {size=1, alignment=Aligned16}; typedef Packet1cd half; }; 306 307 template<> EIGEN_STRONG_INLINE Packet1cd pload <Packet1cd>(const std::complex<double>* from) { return Packet1cd(pload<Packet2d>((const double*)from)); } 308 template<> EIGEN_STRONG_INLINE Packet1cd ploadu<Packet1cd>(const std::complex<double>* from) { return Packet1cd(ploadu<Packet2d>((const double*)from)); } 309 template<> EIGEN_STRONG_INLINE void pstore <std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { pstore((double*)to, from.v); } 310 template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double> * to, const Packet1cd& from) { pstoreu((double*)to, from.v); } 311 312 template<> EIGEN_STRONG_INLINE Packet1cd pset1<Packet1cd>(const std::complex<double>& from) 313 { /* here we really have to use unaligned loads :( */ return ploadu<Packet1cd>(&from); } 314 315 template<> EIGEN_DEVICE_FUNC inline Packet1cd pgather<std::complex<double>, Packet1cd>(const std::complex<double>* from, Index stride) 316 { 317 std::complex<double> EIGEN_ALIGN16 af[2]; 318 af[0] = from[0*stride]; 319 af[1] = from[1*stride]; 320 return pload<Packet1cd>(af); 321 } 322 template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<double>, Packet1cd>(std::complex<double>* to, const Packet1cd& from, Index stride) 323 { 324 std::complex<double> EIGEN_ALIGN16 af[2]; 325 pstore<std::complex<double> >(af, from); 326 to[0*stride] = af[0]; 327 to[1*stride] = af[1]; 328 } 329 330 template<> EIGEN_STRONG_INLINE Packet1cd padd<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(a.v + b.v); } 331 template<> EIGEN_STRONG_INLINE Packet1cd psub<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(a.v - b.v); } 332 template<> EIGEN_STRONG_INLINE Packet1cd pnegate(const Packet1cd& a) { return Packet1cd(pnegate(Packet2d(a.v))); } 333 template<> EIGEN_STRONG_INLINE Packet1cd pconj(const Packet1cd& a) { return Packet1cd(pxor(a.v, reinterpret_cast<Packet2d>(p2ul_CONJ_XOR2))); } 334 335 template<> EIGEN_STRONG_INLINE Packet1cd pmul<Packet1cd>(const Packet1cd& a, const Packet1cd& b) 336 { 337 Packet2d a_re, a_im, v1, v2; 338 339 // Permute and multiply the real parts of a and b 340 a_re = vec_perm(a.v, a.v, p16uc_PSET64_HI); 341 // Get the imaginary parts of a 342 a_im = vec_perm(a.v, a.v, p16uc_PSET64_LO); 343 // multiply a_re * b 344 v1 = vec_madd(a_re, b.v, p2d_ZERO); 345 // multiply a_im * b and get the conjugate result 346 v2 = vec_madd(a_im, b.v, p2d_ZERO); 347 v2 = reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4ui>(v2), reinterpret_cast<Packet4ui>(v2), 8)); 348 v2 = pxor(v2, reinterpret_cast<Packet2d>(p2ul_CONJ_XOR1)); 349 350 return Packet1cd(padd<Packet2d>(v1, v2)); 351 } 352 353 template<> EIGEN_STRONG_INLINE Packet1cd pand <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(pand(a.v,b.v)); } 354 template<> EIGEN_STRONG_INLINE Packet1cd por <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(por(a.v,b.v)); } 355 template<> EIGEN_STRONG_INLINE Packet1cd pxor <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(pxor(a.v,b.v)); } 356 template<> EIGEN_STRONG_INLINE Packet1cd pandnot<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(pandnot(a.v, b.v)); } 357 358 template<> EIGEN_STRONG_INLINE Packet1cd ploaddup<Packet1cd>(const std::complex<double>* from) { return pset1<Packet1cd>(*from); } 359 360 template<> EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double> * addr) { EIGEN_PPC_PREFETCH(addr); } 361 362 template<> EIGEN_STRONG_INLINE std::complex<double> pfirst<Packet1cd>(const Packet1cd& a) 363 { 364 std::complex<double> EIGEN_ALIGN16 res[2]; 365 pstore<std::complex<double> >(res, a); 366 367 return res[0]; 368 } 369 370 template<> EIGEN_STRONG_INLINE Packet1cd preverse(const Packet1cd& a) { return a; } 371 372 template<> EIGEN_STRONG_INLINE std::complex<double> predux<Packet1cd>(const Packet1cd& a) { return pfirst(a); } 373 template<> EIGEN_STRONG_INLINE Packet1cd preduxp<Packet1cd>(const Packet1cd* vecs) { return vecs[0]; } 374 375 template<> EIGEN_STRONG_INLINE std::complex<double> predux_mul<Packet1cd>(const Packet1cd& a) { return pfirst(a); } 376 377 template<int Offset> 378 struct palign_impl<Offset,Packet1cd> 379 { 380 static EIGEN_STRONG_INLINE void run(Packet1cd& /*first*/, const Packet1cd& /*second*/) 381 { 382 // FIXME is it sure we never have to align a Packet1cd? 383 // Even though a std::complex<double> has 16 bytes, it is not necessarily aligned on a 16 bytes boundary... 384 } 385 }; 386 387 template<> struct conj_helper<Packet1cd, Packet1cd, false,true> 388 { 389 EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const 390 { return padd(pmul(x,y),c); } 391 392 EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const 393 { 394 return internal::pmul(a, pconj(b)); 395 } 396 }; 397 398 template<> struct conj_helper<Packet1cd, Packet1cd, true,false> 399 { 400 EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const 401 { return padd(pmul(x,y),c); } 402 403 EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const 404 { 405 return internal::pmul(pconj(a), b); 406 } 407 }; 408 409 template<> struct conj_helper<Packet1cd, Packet1cd, true,true> 410 { 411 EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const 412 { return padd(pmul(x,y),c); } 413 414 EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const 415 { 416 return pconj(internal::pmul(a, b)); 417 } 418 }; 419 template<> struct conj_helper<Packet2d, Packet1cd, false,false> 420 { 421 EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet2d& x, const Packet1cd& y, const Packet1cd& c) const 422 { return padd(c, pmul(x,y)); } 423 424 EIGEN_STRONG_INLINE Packet1cd pmul(const Packet2d& x, const Packet1cd& y) const 425 { return Packet1cd(internal::pmul<Packet2d>(x, y.v)); } 426 }; 427 428 template<> struct conj_helper<Packet1cd, Packet2d, false,false> 429 { 430 EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet2d& y, const Packet1cd& c) const 431 { return padd(c, pmul(x,y)); } 432 433 EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& x, const Packet2d& y) const 434 { return Packet1cd(internal::pmul<Packet2d>(x.v, y)); } 435 }; 436 437 template<> EIGEN_STRONG_INLINE Packet1cd pdiv<Packet1cd>(const Packet1cd& a, const Packet1cd& b) 438 { 439 // TODO optimize it for AltiVec 440 Packet1cd res = conj_helper<Packet1cd,Packet1cd,false,true>().pmul(a,b); 441 Packet2d s = pmul<Packet2d>(b.v, b.v); 442 return Packet1cd(pdiv(res.v, padd<Packet2d>(s, vec_perm(s, s, p16uc_REVERSE64)))); 443 } 444 445 EIGEN_STRONG_INLINE Packet1cd pcplxflip/*<Packet1cd>*/(const Packet1cd& x) 446 { 447 return Packet1cd(preverse(Packet2d(x.v))); 448 } 449 450 EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet1cd,2>& kernel) 451 { 452 Packet2d tmp = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_HI); 453 kernel.packet[1].v = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_LO); 454 kernel.packet[0].v = tmp; 455 } 456 #endif // __VSX__ 457 } // end namespace internal 458 459 } // end namespace Eigen 460 461 #endif // EIGEN_COMPLEX32_ALTIVEC_H 462