<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 - [ppc] redundant zero extension when returning bool value"
href="https://bugs.llvm.org/show_bug.cgi?id=32442">32442</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ppc] redundant zero extension when returning bool value
</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: 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></table>
<p>
<div>
<pre>Compile the following code with options -m64 -O2 -mvsx -mcpu=power8
bool foo(int i, int* p) {
if (i==0)
return false;
*p = i;
return true;
}
LLVM generates:
_Z3fooiPi: # @_Z3fooiPi
.Lfunc_begin0:
# BB#0: # %entry
cmplwi 3, 0
beq 0, .LBB0_2
# BB#1: # %if.end
stw 3, 0(4)
li 3, 1
clrldi 3, 3, 32 // redundant
blr
.LBB0_2:
li 3, 0
clrldi 3, 3, 32 // redundant
blr
The problem is when PPCBoolRetToInt.cpp converts the old the old cmp/isel
behavior into today's integer operation, it uses i32 type, on ppc64, it needs
to be zero extended to 64bit before return. We should use i64 on ppc64 and i32
on ppc32.</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>