[Bug target/82242] x86_64 bad optimization with -march

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 19 06:53:00 GMT 2017


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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Nothing gets vectorized :-(
Note that to fill the vector, this would be better

  std::vector<double> array(size, 1e-9);

In the reduction, we seem to do strange things with the accumulator.

        addsd   (%rax), %xmm1
        addq    $8, %rax
        cmpq    %rbx, %rax
        movsd   %xmm1, (%rsp)
        jne     .L13

or

        vmovq   %rbp, %xmm2
        vaddsd  (%rax), %xmm2, %xmm1
        addq    $8, %rax
        vmovq   %xmm1, %rbp
        cmpq    %rbx, %rax
        jne     .L13

We aren't happy with xmm1, we save the value to memory in the first case, and
to an integer register in the second case where we even restore the value from
that register...


More information about the Gcc-bugs mailing list