<html>
<head>
<base href="https://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 --- - [ppc] ISEL instruction should take advantage r0=0 if it is the first src operand"
href="https://llvm.org/bugs/show_bug.cgi?id=31065">31065</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ppc] ISEL instruction should take advantage r0=0 if it is the first src operand
</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>Backend: PowerPC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>carrot@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Compile the source code with options -m64 -O2
bool foo(int a, int b)
{
return a > b;
}
bool bar(int a, int b)
{
return a < b;
}
I got
_Z3fooii: # @_Z3fooii
.Lfunc_begin0:
# BB#0: # %entry
li 5, 0 // unnecessary
cmpw 0, 3, 4
li 12, 1
isel 3, 12, 5, 1 // isel 3, 0, 12, 0
blr
_Z3barii: # @_Z3barii
.Lfunc_begin1:
# BB#0: # %entry
li 5, 0 // unnecessary
cmpw 0, 3, 4
li 12, 1
isel 3, 12, 5, 0 // isel 3, 0, 12, 1
blr
For ISEL instruction, if r0 is the first source operand, it is treated as 0. So
we can change the generated instructions as in comments, then "li 5, 0" can be
removed.
There are more complex cases that involves composition of several comparisons
and cross BBs.</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>