This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/28685] New: Multiple comparisons are not simplified
- From: "uros at kss-loka dot si" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Aug 2006 18:15:25 -0000
- Subject: [Bug middle-end/28685] New: Multiple comparisons are not simplified
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
These two testcases should produce equivalent code:
int test(int a, int b)
{
int lt = a < b;
int eq = a == b;
return (lt || eq);
}
int test_(int a, int b)
{
return (a < b || a == b);
}
However, the optimized tree code is:
;; Function test (test)
Analyzing Edge Insertions.
test (a, b)
{
<bb 2>:
return (a == b | a < b) != 0;
}
;; Function test_ (test_)
Analyzing Edge Insertions.
test_ (a, b)
{
<bb 2>:
return a <= b;
}
And the resultinh x86_64 asm is unoptimal for test() function:
test:
cmpl %esi, %edi
sete %dl
cmpl %esi, %edi
setl %al
orl %edx, %eax
movzbl %al, %eax
ret
test_:
xorl %eax, %eax
cmpl %esi, %edi
setle %al
ret
--
Summary: Multiple comparisons are not simplified
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: uros at kss-loka dot si
GCC build triplet: x86_64-pc-linux-gnu
GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28685