From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3591 invoked by alias); 10 Aug 2006 18:15:32 -0000 Received: (qmail 3563 invoked by uid 48); 10 Aug 2006 18:15:25 -0000 Date: Thu, 10 Aug 2006 18:15:00 -0000 Subject: [Bug middle-end/28685] New: Multiple comparisons are not simplified X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "uros at kss-loka dot si" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-08/txt/msg00797.txt.bz2 List-Id: 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) { : return (a == b | a < b) != 0; } ;; Function test_ (test_) Analyzing Edge Insertions. test_ (a, b) { : 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