[LLVMbugs] [Bug 22756] New: movaps used for unaligned memory -march=slm -m32

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 2 10:56:58 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22756

            Bug ID: 22756
           Summary: movaps used for unaligned memory -march=slm -m32
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chh at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Built and run on Linux host:
  clang++ -march=slm -m32 -O2  -S -o /tmp/p0.s /tmp/p0.cpp


$ cat /tmp/p0.cpp
typedef struct my_attr_t {
  int flags;
  void* stack_base;
  int stack_size;
  int guard_size;
  int sched_policy;
  int sched_priority;
} my_attr_t;
extern "C" void foo0();
extern "C" void foo1(my_attr_t*);
extern "C" void foo2(unsigned);
extern "C" void my_test1(my_attr_t const *attr) {
  my_attr_t tmp;
  foo0();
  foo2(sizeof(tmp));
  foo1(&tmp);
  tmp = *attr;  // *attr might not be aligned.
  foo1(&tmp);
}


$ cat /tmp/p1.s
    .text
    .file    "/tmp/p0.cpp"
    .globl    my_test1
    .align    16, 0x90
    .type    my_test1, at function
my_test1:                               # @my_test1
    .cfi_startproc
# BB#0:                                 # %entry
    pushl    %edi
.Ltmp0:
    .cfi_def_cfa_offset 8
    pushl    %esi
.Ltmp1:
    .cfi_def_cfa_offset 12
    subl    $52, %esp
.Ltmp2:
    .cfi_def_cfa_offset 64
.Ltmp3:
    .cfi_offset %esi, -12
.Ltmp4:
    .cfi_offset %edi, -8
    movl    64(%esp), %esi
    calll    foo0
    movl    $24, (%esp)
    calll    foo2
    leal    16(%esp), %edi
    movl    %edi, (%esp)
    calll    foo1
    movsd    16(%esi), %xmm0         # xmm0 = mem[0],zero
    movsd    %xmm0, 32(%esp)
    movups    (%esi), %xmm0
    movl    %edi, (%esp)
    movaps    %xmm0, 16(%esp)         # ERROR, should be movups
    calll    foo1
    addl    $52, %esp
    popl    %esi
    popl    %edi
    retl
.Ltmp5:
    .size    my_test1, .Ltmp5-my_test1
    .cfi_endproc


    .ident    "clang version 3.7.0 (http://llvm.org/git/clang.git
3e1cca7ad0cc730b54c1a2057f9ce36a85eab75a) (llvm/trunk 230778)"
    .section    ".note.GNU-stack","", at progbits



The passed in attr pointer could point to a 4-byte aligned my_attr_t subobject
inside other object.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150302/c573bef0/attachment.html>


More information about the llvm-bugs mailing list