<html>
<head>
<base href="http://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 - [X86] SBB/AND used instead of XOR/ADC"
href="http://bugs.llvm.org/show_bug.cgi?id=32690">32690</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86] SBB/AND used instead of XOR/ADC
</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>craig.topper@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>On 32-bit targets this C code
unsigned bar(unsigned bitWidth) {
return ((uint64_t)bitWidth + 63) / 64;
}
Produces this assembly output
_bar: ## @bar
## BB#0: ## %entry
movl 4(%esp), %ecx
addl $63, %ecx
sbbl %eax, %eax
andl $1, %eax
shldl $26, %ecx, %eax
retl
As you can see the carry of the addition into eax is implemented using sbb/and
instead of using xor %eax, %eax and an adc.
Using sbb has an unnecessary dependency on the last writer of eax. While the
xor version would not.</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>