Skip to content

Spilled XMM is assumed wrongly to be aligned #15018

Open
@llvmbot

Description

Bugzilla Link 14646
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @asl,@dbabokin,@darkbuck

Extended Description

With XMM, loading m in INSTrm should be 16-byte aligned.

    xorps   (%esp), %xmm0           # 16-byte Folded Reload

But This function does not have realignment in prologue. (%esp) might not be 16-aligned.

It causes miscompilation with i686-cygwin vectorizer.

  • Reproducible for i686-freebsd (also possible for netbsd, cygming and win32)
  • It's leaf function. This issue could be suppressed if frame pointer were generated.

/* testcase.c */
typedef long long W attribute((vector_size(16)));
W foo(W a0) {
W r0;
asm volatile("nop":"=x"(r0)::"%xmm1","%xmm2","%xmm3","xmm4","%xmm5","%xmm6","%xmm7");
return a0 ^ r0;
}

llc -mtriple=i686-freebsd -mattr=-avx

foo: # @​foo

BB#0: # %entry

    subl    $28, %esp
    movups  %xmm0, (%esp)           # 16-byte Folded Spill
    #APP
    nop
    #NO_APP
    xorps   (%esp), %xmm0           # 16-byte Folded Reload
    addl    $28, %esp
    ret

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions