<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - [GlobalISel][x86_64] 4th argument clobbered by shifts of 5th arg"
href="https://bugs.llvm.org/show_bug.cgi?id=38306">38306</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[GlobalISel][x86_64] 4th argument clobbered by shifts of 5th arg
</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>Windows NT
</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>GlobalISel
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>aivchenk@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>int foo(int a, int b, int c, int d, short e)
{
return a + b + c + d + e;
}
int main() {
int a = 1;
int b = 1;
int c = 1;
int d = 1;
int e = 1;
return foo(a, b, c, d, e);
}
<span class="quote">> clang test.c -mllvm -global-isel
> ./a.out
> echo $?</span >
20
<span class="quote">> clang test.c
> ./a.out
> echo $?</span >
5
global isel generated:
..
movl -8(%rbp), %edi
movl -12(%rbp), %esi
movl -16(%rbp), %edx
movl -20(%rbp), %ecx
movl -24(%rbp), %eax
movl $16, %r8d
movl %r8d, %ecx << Already set up argument is clobbered by this
# kill: def $cl killed $ecx
shll %cl, %eax
movl %r8d, %ecx
# kill: def $cl killed $ecx
sarl %cl, %eax
movl %eax, %r8d
callq foo
..
fast isel generated:
..
movl -8(%rbp), %edi
movl -12(%rbp), %esi
movl -16(%rbp), %edx
movl -20(%rbp), %ecx
movl -24(%rbp), %eax
movw %ax, %r8w
movswl %r8w, %r8d
callq foo
..</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>