<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 --- - [Combine] !((A > 0) && (B > 0)) -> (A <= 0 || B <= 0) missed when A has multiple users"
href="https://llvm.org/bugs/show_bug.cgi?id=26083">26083</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[Combine] !((A > 0) && (B > 0)) -> (A <= 0 || B <= 0) missed when A has multiple users
</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>Windows NT
</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>mcrosier@codeaurora.org
</td>
</tr>
<tr>
<th>CC</th>
<td>bmakam@codeaurora.org, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Test case:
void foo(int A, int B);
void test(int A, int B, int C) {
foo(!(A > 0 && B > 0),
!(A > 0 && C > 0));
}
When targeting AArch64 at -O3 I get the following assembly:
test1: // @test1
cmp w0, #0 // =0
cset w8, gt
cmp w1, #0 // =0
cset w9, gt
cmp w2, #0 // =0
cset w10, gt
and w9, w8, w9
and w8, w8, w10
eor w0, w9, #0x1
eor w1, w8, #0x1
b foo
However, we should be able to generate something like this assembly:
cmp w0, #1 // =1
cset w8, lt
cmp w1, #1 // =1
cset w9, lt
cmp w2, #1 // =1
orr w0, w8, w9
cset w9, lt
orr w1, w8, w9
b foo
which would replace 2 ANDs and 2 EORs with 2 ORs. My example is for AArch64,
but I can't imagine this is a target-specific combine.</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>