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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
Disable (define_insn "*sse3_haddv2df3_low" and (define_insn
"*sse3_hsubv2df3_low" seems to be ok.
But for foo1.

v2df foo1 (v2df x, v2df y)
{
  v2df a;
  a[0] = x[0] + x[1];
  a[1] = y[0] + y[1];
  return a;
}

it's 

  vhaddpd %xmm1, %xmm0, %xmm0
  ret

vs 

        movapd  xmm2, xmm0
        unpckhpd        xmm2, xmm2
        addsd   xmm0, xmm2
        movapd  xmm2, xmm1
        unpckhpd        xmm1, xmm1
        addsd   xmm1, xmm2
        unpcklpd        xmm0, xmm1
        ret

and note w/o vhaddpd, codegen can be optimized to 

        movapd  xmm2, xmm0
        unpcklpd        xmm2, xmm1
        unpckhpd        xmm0, xmm1
        addpd   xmm0, xmm2
        ret

Guess maybe it's better done in gimple level?

Reply via email to