[llvm-bugs] [Bug 26083] New: [Combine] !((A > 0) && (B > 0)) -> (A <= 0 || B <= 0) missed when A has multiple users
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 8 11:57:50 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26083
Bug ID: 26083
Summary: [Combine] !((A > 0) && (B > 0)) -> (A <= 0 || B <= 0)
missed when A has multiple users
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: mcrosier at codeaurora.org
CC: bmakam at codeaurora.org, llvm-bugs at lists.llvm.org
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160108/bc55f620/attachment.html>
More information about the llvm-bugs
mailing list