Source:

#include <emmintrin.h>

struct a1 { char l[16];};
struct a2 { __m128i l; };

void f1(struct a1 *a, struct a1 *b)
{
    *a = *b;
}

void f2(struct a2 *a, struct a2 *b)
{
    *a = *b;
}

> /usr/local/gcc45/bin/gcc -O3 -fomit-frame-pointer -S copy_gcc.c
_f1:
        movq    (%rsi), %rax
        movq    %rax, (%rdi)
        movq    8(%rsi), %rax
        movq    %rax, 8(%rdi)
        ret

_f2:
        movdqa  (%rsi), %xmm0
        movdqa  %xmm0, (%rdi)
        ret

Both are appropriately aligned and should use movdqa. This might not show up in
generic code, but I could have used it in an ffmpeg optimization.


-- 
           Summary: Structure copies not vectorized
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: astrange at ithinksw dot com
  GCC host triplet: x86_64-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43225

Reply via email to