https://llvm.org/bugs/show_bug.cgi?id=26830

            Bug ID: 26830
           Summary: misaligned placement of function arguments of
                    over-aligned type on the stack (ABI incompatibility)
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: kr...@kde.org
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Testcase:
#include <xmmintrin.h>
struct X { __m128 x; };
X f(X a, X b) { return {_mm_add_ps(a.x, b.x)}; }

Compiles to (-msse -m32 -O2):
00000000 <f(X, X)>:
   0:·       mov    0x4(%esp),%eax
   4:·       movups 0x8(%esp),%xmm0
   9:·       movups 0x18(%esp),%xmm1
   e:·       addps  %xmm0,%xmm1
  11:·       movaps %xmm1,(%eax)
  14:·       ret    $0x4

This is incorrect according to the x86 psABI document, which states that
padding must be added so that the placement of the argument matches its
alignment. GCC compiles the code to:
00000000 <f(X, X)>:
   0:·       movaps 0x24(%esp),%xmm0
   5:·       mov    0x4(%esp),%eax
   9:·       addps  0x14(%esp),%xmm0
   e:·       movaps %xmm0,(%eax)
  11:·       ret    $0x4

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to