<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - LLVM seems to be lowering unaligned memcpy as movaps on x86-32 + sse2"
href="http://llvm.org/bugs/show_bug.cgi?id=15348">15348</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM seems to be lowering unaligned memcpy as movaps on x86-32 + sse2
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chandlerc@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>My test case is currently C++, and triggered due to r175389 emitting memcpy
more often. It was reduced (very greatly) from TargetInfo in a bootstrap...
% cat bitfield.cpp
struct S {
S() {}
S(const S&) {}
~S() {}
void *ptr1, *ptr2;
unsigned long x;
};
struct X {
unsigned b00 : 1;
unsigned b01 : 1;
unsigned b02 : 1;
unsigned b03 : 1;
unsigned b04 : 1;
unsigned b05 : 1;
unsigned b06 : 1;
unsigned b07 : 1;
unsigned b08 : 1;
unsigned b09 : 1;
unsigned b10 : 1;
unsigned b11 : 1;
unsigned b12 : 1;
unsigned b13 : 1;
unsigned b14 : 1;
unsigned b15 : 1;
unsigned u;
unsigned b16 : 1;
unsigned b17 : 1;
unsigned b18 : 1;
unsigned b19 : 1;
unsigned u2;
unsigned b20 : 1;
unsigned b21 : 1;
unsigned b22 : 1;
unsigned b23 : 1;
S s;
enum { A, B, C } e1;
enum { AA, BB, CC } e2;
};
X f(const X &x) { return x; }
int main() {
X x;
X y = f(x);
}
% ./bin/clang++ -m32 -march=pentium3 -msse2 -O0 -std=c++03 -o bitfield
bitfield.cpp
% ./bitfield
zsh: segmentation fault ./bitfield
% gdb --args ./bitfield
(gdb) r
Starting program: ./bitfield
Program received signal SIGSEGV, Segmentation fault.
0x08048774 in X::X(X const&) ()
(gdb) disass
Dump of assembler code for function _ZN1XC2ERKS_:
0x08048750 <+0>: push %ebp
0x08048751 <+1>: mov %esp,%ebp
0x08048753 <+3>: push %ebx
0x08048754 <+4>: sub $0x14,%esp
0x08048757 <+7>: mov 0xc(%ebp),%eax
0x0804875a <+10>: mov 0x8(%ebp),%ecx
0x0804875d <+13>: mov %ecx,-0x8(%ebp)
0x08048760 <+16>: mov %eax,-0xc(%ebp)
0x08048763 <+19>: mov -0x8(%ebp),%eax
0x08048766 <+22>: mov %eax,%ecx
0x08048768 <+24>: mov -0xc(%ebp),%edx
0x0804876b <+27>: mov 0x10(%edx),%bl
0x0804876e <+30>: mov %bl,0x10(%ecx)
0x08048771 <+33>: movaps (%edx),%xmm0
=> 0x08048774 <+36>: movaps %xmm0,(%ecx)
0x08048777 <+39>: mov %eax,%ecx
0x08048779 <+41>: add $0x14,%ecx
0x0804877f <+47>: mov -0xc(%ebp),%edx
0x08048782 <+50>: add $0x14,%edx
0x08048788 <+56>: mov %ecx,(%esp)
0x0804878b <+59>: mov %edx,0x4(%esp)
0x0804878f <+63>: mov %eax,-0x10(%ebp)
0x08048792 <+66>: call 0x80487b0 <_ZN1SC1ERKS_>
0x08048797 <+71>: mov -0xc(%ebp),%eax
0x0804879a <+74>: mov 0x20(%eax),%ecx
0x0804879d <+77>: mov -0x10(%ebp),%edx
0x080487a0 <+80>: mov %ecx,0x20(%edx)
0x080487a3 <+83>: mov 0x24(%eax),%eax
0x080487a6 <+86>: mov %eax,0x24(%edx)
0x080487a9 <+89>: add $0x14,%esp
0x080487ac <+92>: pop %ebx
0x080487ad <+93>: pop %ebp
0x080487ae <+94>: ret
End of assembler dump.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>