Commit 2147aaf3 authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'more_clang_fixes' into 'master'

address more problems with clang (and follow its optimization hints)

See merge request !35
parents 80bb41a0 99599e15
......@@ -110,8 +110,9 @@ constexpr bool FORWARD = true,
#if defined(__INTEL_COMPILER)
// do nothing. This is necessary because this compiler also sets __GNUC__.
#elif defined(__clang__)
#ifdef __APPLE__
# if (__clang_major__ > 9) || (__clang_major__ == 9 && __clang_minor__ >= 3)
// AppleClang has their own version numbering
#ifdef __apple_build_version__
# if (__clang_major__ > 9) || (__clang_major__ == 9 && __clang_minor__ >= 1)
# undef POCKETFFT_NO_VECTORS
# endif
#elif __clang_major__ >= 5
......@@ -216,8 +217,6 @@ template<typename T> struct cmplx {
cmplx(T r_, T i_) : r(r_), i(i_) {}
void Set(T r_, T i_) { r=r_; i=i_; }
void Set(T r_) { r=r_; i=T(0); }
void Split(T &r_, T &i_) const { r_=r; i_=i; }
void SplitConj(T &r_, T &i_) const { r_=r; i_=-i; }
cmplx &operator+= (const cmplx &other)
{ r+=other.r; i+=other.i; return *this; }
template<typename T2>cmplx &operator*= (T2 other)
......@@ -3203,11 +3202,17 @@ template<typename T> POCKETFFT_NOINLINE void general_c2r(
if (forward)
for (; i<len-1; i+=2, ++ii)
for (size_t j=0; j<vlen; ++j)
in[it.iofs(j,ii)].SplitConj(tdatav[i][j], tdatav[i+1][j]);
{
tdatav[i ][j] = in[it.iofs(j,ii)].r;
tdatav[i+1][j] = -in[it.iofs(j,ii)].i;
}
else
for (; i<len-1; i+=2, ++ii)
for (size_t j=0; j<vlen; ++j)
in[it.iofs(j,ii)].Split(tdatav[i][j], tdatav[i+1][j]);
{
tdatav[i ][j] = in[it.iofs(j,ii)].r;
tdatav[i+1][j] = in[it.iofs(j,ii)].i;
}
if (i<len)
for (size_t j=0; j<vlen; ++j)
tdatav[i][j] = in[it.iofs(j,ii)].r;
......@@ -3225,10 +3230,16 @@ template<typename T> POCKETFFT_NOINLINE void general_c2r(
size_t i=1, ii=1;
if (forward)
for (; i<len-1; i+=2, ++ii)
in[it.iofs(ii)].SplitConj(tdata[i], tdata[i+1]);
{
tdata[i ] = in[it.iofs(ii)].r;
tdata[i+1] = -in[it.iofs(ii)].i;
}
else
for (; i<len-1; i+=2, ++ii)
in[it.iofs(ii)].Split(tdata[i], tdata[i+1]);
{
tdata[i ] = in[it.iofs(ii)].r;
tdata[i+1] = in[it.iofs(ii)].i;
}
if (i<len)
tdata[i] = in[it.iofs(ii)].r;
}
......
......@@ -130,7 +130,7 @@ template<typename T> py::array c2c_internal(const py::array &in,
T fct = norm_fct<T>(inorm, dims, axes);
pocketfft::c2c(dims, s_in, s_out, axes, forward, d_in, d_out, fct, nthreads);
}
return res;
return move(res);
}
template<typename T> py::array c2c_sym_internal(const py::array &in,
......@@ -159,7 +159,7 @@ template<typename T> py::array c2c_sym_internal(const py::array &in,
iter.advance();
}
}
return res;
return move(res);
}
py::array c2c(const py::array &a, const py::object &axes_, bool forward,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment