<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 --- - Missing optimization"
href="http://llvm.org/bugs/show_bug.cgi?id=21749">21749</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missing optimization
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>eugeni.stepanov@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>long a, b, c;
void f(long x) {
a = x ^ 0x1;
b = x ^ 0x2;
c = x;
}
On x86_64 with -O2, clang generates the following:
0000000000000000 <_Z1fl>:
0: 48 89 f8 mov %rdi,%rax
3: 48 83 f0 01 xor $0x1,%rax
7: 48 89 05 00 00 00 00 mov %rax,0x0(%rip) # e <_Z1fl+0xe>
e: 48 89 f8 mov %rdi,%rax
11: 48 83 f0 02 xor $0x2,%rax
15: 48 89 05 00 00 00 00 mov %rax,0x0(%rip) # 1c
<_Z1fl+0x1c>
1c: 48 89 3d 00 00 00 00 mov %rdi,0x0(%rip) # 23
<_Z1fl+0x23>
23: c3 retq
This:
mov %rdi,%rax
xor $0x2,%rax
could be written as:
xor $0x3, %rax
This costs 1.5% code size with MemorySanitizer instrumentation, but we have a
workaround.</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>