<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 --- - Instrinsics don't honour -mregparm=3 on i386"
href="http://llvm.org/bugs/show_bug.cgi?id=18415">18415</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Instrinsics don't honour -mregparm=3 on i386
</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>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Target Description Classes
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dwmw2@infradead.org
</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>Consider the following test case.
void *foo(void *dest, const void *src, int n);
void *memcpy(void *dest, const void *src, int n);
void use_foo(void *dest, const void *src, int n)
{
foo(dest, src, n);
}
void use_builtin(void *dest, const void *src, int n)
{
__builtin_memcpy(dest, src, n);
}
int use_memcpy(void *dest, const void *src, int n)
{
memcpy(dest, src, n);
}
Compile with:
clang -S -o- -m32 foo.c -Os -mregparm=3
We expect each function to look something like this:
use_foo: # @use_foo
# BB#0: # %entry
jmp foo # TAILCALL
But the call to __builtin_memcpy() will put its arguments on the *stack*,
ignoring the fact that it was told mregparm=3:
use_builtin: # @use_builtin
# BB#0: # %entry
subl $12, %esp
movl %ecx, 8(%esp)
movl %edx, 4(%esp)
movl %eax, (%esp)
calll memcpy
addl $12, %esp
retl
Depending on whether we add -ffreestanding/-fno-builtin, the call to plain
"memcpy" may do one or the other.</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>