https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98563
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #7)
> I'm afraid no.
> The vectorization can handle addresses into the simd arrays, but right now
> only if it accesses the whole element, i.e. when we can turn the simd array
> into a vector register (or set thereof) that hold the variable.
> In this case that is not the case, as in the end it uses the real and imag
> parts separately.
> So, either it can be handled in SRA, or we'd need to teach the vectorizer to
> permute those fur us.
Hmm, I see. The vectorizer can in theory handle "existing" vectors (currently
only enabled for basic-block SLP though). But of course the first hurdle is
to not treat those as memory accesses (thus ignore the data-ref analysis
failure or somehow make that treat the SIMD_LANE indexing "nicely").
When we see
_13 = .GOMP_SIMD_LANE (simduid.0_12(D), 0);
can we compute how _13 evolves with loop iteration? Thus, can we
SCEV analyze it? Isn't it sth like { .GOMP_SIMD_LANE_START (simduid.0_12(D),
.GOMP_SIMD_LANE_STEP (simduid.0_12(D), 0) } thus an affine evolution
in the end?
Simplified C testcase:
typedef _Complex double cplx;
void foo (cplx *);
void test(cplx* __restrict__ a, const cplx* b, double c, int N)
{
cplx tem;
#pragma omp simd private (tem)
for (int i=0; i<8*N; i++) {
__real tem = __real b[i];
__imag tem = __imag b[i];
__real a[i] = __real tem;
__imag a[i] = __imag tem;
}
foo (&tem);
}
which we miscompile (well, I guess I did sth wrong with the use after
the loop but to trigger GOMP_SIMD_LANE the temporary seems to need to
have its address taken).