[Bug tree-optimization/88828] Inefficient update of the first element of vector registers

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 23 21:36:00 GMT 2019


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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crazylht at gmail dot com,
                   |                            |xuepeng.guo at intel dot com

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
Another testcase:

[hjl@gnu-cfl-1 pr88828]$ cat y.i
typedef double __v2df __attribute__ ((__vector_size__ (16)));
typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));

__m128d
_mm_add_sd (__m128d x, __m128d y)
{
  __m128d z =  __extension__ (__m128d)(__v2df)
    { (((__v2df) x)[0] + ((__v2df) y)[0]), ((__v2df) x)[1] };
  return z;
}
[hjl@gnu-cfl-1 pr88828]$  gcc -S -O2 y.i 
[hjl@gnu-cfl-1 pr88828]$  cat y.s
        .file   "y.i"
        .text
        .p2align 4,,15
        .globl  _mm_add_sd
        .type   _mm_add_sd, @function
_mm_add_sd:
.LFB0:
        .cfi_startproc
        movapd  %xmm0, %xmm2
        addsd   %xmm1, %xmm2
        movsd   %xmm2, %xmm0
        ret
        .cfi_endproc
.LFE0:
        .size   _mm_add_sd, .-_mm_add_sd
        .ident  "GCC: (GNU) 8.2.1 20190109 (Red Hat 8.2.1-7)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-1 pr88828]$ 

I am expecting

        addsd   %xmm1, %xmm0
        retq


More information about the Gcc-bugs mailing list