This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/37049] New: Unaligned move used on aligned destination of push insn


[hjl@gnu-3 gcc]$ cat /tmp/push-1.c 
/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-w -msse2 -Os" } */

typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));

extern void foo (__m128 x, __m128 y ,__m128 z ,__m128 a, int size);

void
bar (void)
{
  __m128 x = { 1.0 };
  foo (x, x, x, x, 5);
}

/* { dg-final { scan-assembler-not "movups" } } */
[hjl@gnu-3 gcc]$ ./xgcc -B./ -Os -m32 -msse2 -S /tmp/push-1.c
[hjl@gnu-3 gcc]$ cat push-1.s 
        .file   "push-1.c"
        .text
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $20, %esp
        movss   .LC0, %xmm0
        pushl   $5
        subl    $16, %esp
        movups  %xmm0, (%esp)
        movaps  %xmm0, %xmm2
        movaps  %xmm0, %xmm1
        call    foo
        addl    $32, %esp
        leave
        ret

-mno-accumulate-outgoing-args will push argument onto stack.
Since there is no push insn for __m128, ix86_expand_push is
called to emulate push __m128. But it doesn't set proper
alignment. As the result, unaligned move insn is generated
even though memory is aligned.  Since ix86_expand_push is
used to push a value onto an aligned location on the stack,
the alignment of destination should be at least aligned to
function argument boundary, which is the minimum alignment
of push destination.


-- 
           Summary: Unaligned move used on aligned  destination of push insn
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]