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

--- Comment #3 from mjr19 at cam dot ac.uk ---
Odd. I see, when the comment character is removed from the first line of the
loop,

gfortran-16 -O3 -mavx2 -fopenmp-simd -S v8.f90

.L4:
        vmovupd (%rcx,%rax), %ymm0
        vsubpd  (%rdx,%rax), %ymm0, %ymm0
        vpermilpd       $5, %ymm0, %ymm0
        vaddsubpd       %ymm0, %ymm1, %ymm0
        vmovupd %ymm0, (%rdx,%rax)
        addq    $32, %rax
        cmpq    %rsi, %rax
        jne     .L4

and

gfortran-16 -O3 -ffast-math -mavx2 -fopenmp-simd -S v8.f90

.L4:
        vmovupd (%rdx,%rax), %ymm1
        vaddpd  %ymm1, %ymm2, %ymm0
        vsubpd  %ymm1, %ymm2, %ymm1
        vshufpd $5, %ymm1, %ymm0, %ymm0
        vpermilpd       $5, (%rcx,%rax), %ymm1
        vaddsubpd       %ymm1, %ymm0, %ymm0
        vmovupd %ymm0, (%rdx,%rax)
        addq    $32, %rax
        cmpq    %rsi, %rax
        jne     .L4

The -ffast-math version is not as bad as it looks. On machines I have tried, it
has either been equally fast, or about 5% slower, than the more concise code. I
have yet to find a machine on which it is quicker, but maybe I should stop
worrying if the performance difference is so slight.

Reply via email to