[Bug fortran/87804] Omp simd loop with sin calls not vectorized when inside omp parallel region and the sin parameter uses value from shared array

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 30 11:07:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87804

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-10-30
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  The issue is two-fold, first the array 'b' has unknown stride
because IPA cannot look through __builtin_GOMP_parallel, second dsin ()
ends up as clobbering memory - you probably have to mark it as pure,
then we end up with a vectorized variant:

.L4:
        movdqa  .LC2(%rip), %xmm3
        movdqa  48(%rsp), %xmm1
        addq    $32, %r14
        paddd   %xmm0, %xmm3
        paddd   %xmm0, %xmm1
        movaps  %xmm3, (%rsp)
        cvtdq2pd        %xmm1, %xmm0
        movaps  %xmm1, 32(%rsp)
        call    _ZGVbN2v_sin
        movdqa  32(%rsp), %xmm1
        movaps  %xmm0, 16(%rsp)
        pshufd  $238, %xmm1, %xmm0
        cvtdq2pd        %xmm0, %xmm0
        call    _ZGVbN2v_sin
        movapd  16(%rsp), %xmm2
        movaps  %xmm0, -16(%r14)
        movdqa  (%rsp), %xmm0
        movaps  %xmm2, -32(%r14)
        cmpq    %r14, %rbx
        jne     .L4

program test

      interface
        pure function DSIN(x) bind(C, NAME="sin")
          use,intrinsic :: iso_c_binding
...

Does that fix the issue?


More information about the Gcc-bugs mailing list