<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 - Failure to use al for sete after cmpxchg"
href="https://bugs.llvm.org/show_bug.cgi?id=46707">46707</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Failure to use al for sete after cmpxchg
</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>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>gabravier@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>int f(unsigned char* addr, unsigned char old_val, unsigned char new_val)
{
auto old_val_cpy = old_val;
__atomic_compare_exchange_n(addr, &old_val, new_val, 0, 0, 0);
return old_val == old_val_cpy;
}
With -O3, LLVM outputs this :
f(unsigned char*, unsigned char, unsigned char):
mov eax, esi
xor ecx, ecx
lock cmpxchg byte ptr [rdi], dl
sete cl
mov eax, ecx
ret
Is there some weird hardware problem that makes the sete slower if used on al
or something ? If not, I see no reason why the sete could not have al as the
operand, which would avoid the mov afterwards.</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>