public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/28685]  New: Multiple comparisons are not simplified
@ 2006-08-10 18:15 uros at kss-loka dot si
  2006-08-10 18:18 ` [Bug middle-end/28685] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 24+ messages in thread
From: uros at kss-loka dot si @ 2006-08-10 18:15 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 24+ messages in thread
[parent not found: <bug-28685-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2014-10-31  4:02 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-10 18:15 [Bug middle-end/28685] New: Multiple comparisons are not simplified uros at kss-loka dot si
2006-08-10 18:18 ` [Bug middle-end/28685] " pinskia at gcc dot gnu dot org
2008-04-30 15:13 ` rguenth at gcc dot gnu dot org
2008-09-06 16:34 ` ubizjak at gmail dot com
2008-10-12 20:46 ` rguenth at gcc dot gnu dot org
2009-04-24  9:24 ` rguenth at gcc dot gnu dot org
2009-04-24  9:25 ` rguenth at gcc dot gnu dot org
2009-06-24  7:49 ` steven at gcc dot gnu dot org
2009-06-24  9:15 ` rguenth at gcc dot gnu dot org
2009-09-17 10:25 ` ubizjak at gmail dot com
2010-05-07  2:32 ` sandra at codesourcery dot com
2010-05-08  3:44 ` sandra at codesourcery dot com
2010-05-08 15:54 ` sandra at gcc dot gnu dot org
2010-05-24 13:22 ` sandra at codesourcery dot com
2010-05-25  8:12 ` rguenther at suse dot de
2010-06-01  2:24 ` sandra at codesourcery dot com
2010-06-08 18:16 ` sandra at gcc dot gnu dot org
     [not found] <bug-28685-4@http.gcc.gnu.org/bugzilla/>
2012-01-12  1:07 ` pinskia at gcc dot gnu.org
2012-02-05 12:42 ` ubizjak at gmail dot com
2012-02-06 21:37 ` ubizjak at gmail dot com
2012-04-22 12:42 ` ubizjak at gmail dot com
2012-04-22 12:46 ` ubizjak at gmail dot com
2012-04-22 12:48 ` ubizjak at gmail dot com
2014-10-31  4:02 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).