<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 - Inefficient codegen for and(not(shl(shr)))"
href="https://bugs.llvm.org/show_bug.cgi?id=39030">39030</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Inefficient codegen for and(not(shl(shr)))
</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: AArch64
</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>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>typedef unsigned long T;
// typedef long T;
T f(T a, T b) {
return b & ~((a >> 56) << 10);
}
With T = long, the source above generates
asr x8, x0, #56
bic x0, x1, x8, lsl #10
ret
With T = unsigned long, we produce much longer code
lsr x8, x0, #46
mvn w8, w8
orr x8, x8, #0xfffffffffffc03ff
and x0, x8, x1
ret
A similar lsr + bic sequence is possible here too, but the BIC pattern does not
match because of the following generic transform (in DAGCombiner.cpp):
// fold (shl (srl x, c1), c2) -> (and (shl x, (sub c2, c1), MASK) or
// (and (srl x, (sub c1, c2), MASK)
Maybe this combine should not be used if it feeds into AND and TLI.hasAndNot()?</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>