public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/18146] New: if-conversion is not performed for some reason
@ 2004-10-25 16:43 kazu at cs dot umass dot edu
  2004-10-25 17:01 ` [Bug rtl-optimization/18146] " pinskia at gcc dot gnu dot org
  2005-04-25  2:14 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 5+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-10-25 16:43 UTC (permalink / raw)
  To: gcc-bugs

Consider:

int
foo (int a)
{
  switch (a)
    {
    case 1:
    case 3:
    case 5:
      return 1;
    default:
      return 0;
    }
}

./cc1 -O2 -fomit-frame-pointer -mregparm=3 -march=athlon-xp generates

foo:
	cmpl	$5, %eax
	movl	%eax, %ecx
	ja	.L2
	movl	$1, %eax
	movl	$1, %edx
	sall	%cl, %eax
	testb	$42, %al
	jne	.L4
.L2:
	xorl	%edx, %edx
.L4:
	movl	%edx, %eax
	ret

Note that if-conversion is not performed at the end of this function.

-- 
           Summary: if-conversion is not performed for some reason
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18146


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/18146] if-conversion is not performed for some reason
  2004-10-25 16:43 [Bug rtl-optimization/18146] New: if-conversion is not performed for some reason kazu at cs dot umass dot edu
@ 2004-10-25 17:01 ` pinskia at gcc dot gnu dot org
  2005-04-25  2:14 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-25 17:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-25 17:01 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-25 17:01:28
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18146


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/18146] if-conversion is not performed for some reason
  2004-10-25 16:43 [Bug rtl-optimization/18146] New: if-conversion is not performed for some reason kazu at cs dot umass dot edu
  2004-10-25 17:01 ` [Bug rtl-optimization/18146] " pinskia at gcc dot gnu dot org
@ 2005-04-25  2:14 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-25  2:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-25 02:14 -------
We get now on the mainline:
foo:
        cmpl    $5, %eax
        movl    %eax, %ecx
        ja      .L2
        movl    $1, %eax
        movl    $1, %edx
        sall    %cl, %eax
        testb   $42, %al
        je      .L2
        movl    %edx, %eax
        ret
        .p2align 4,,7
.L2:
        xorl    %edx, %edx
        movl    %edx, %eax
        ret

I think the problem is really that we have multiple predecessors or something like that.  If we lowed the 
switch at the tree level, then PHI-OPT would catch this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-01-24 00:57:13         |2005-04-25 02:14:13
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18146


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/18146] if-conversion is not performed for some reason
       [not found] <bug-18146-5009@http.gcc.gnu.org/bugzilla/>
  2007-07-25 19:44 ` steven at gcc dot gnu dot org
@ 2008-09-09  1:45 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-09  1:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-09-09 01:44 -------
It was not fixed by the cfglayout changes.  In fact tree switch conversion
makes the code even worse even though we don't need it really.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18146


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug rtl-optimization/18146] if-conversion is not performed for some reason
       [not found] <bug-18146-5009@http.gcc.gnu.org/bugzilla/>
@ 2007-07-25 19:44 ` steven at gcc dot gnu dot org
  2008-09-09  1:45 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 5+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-07-25 19:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from steven at gcc dot gnu dot org  2007-07-25 19:44 -------
This may be fixed now by my cfglayout work.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18146


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-09-09  1:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-25 16:43 [Bug rtl-optimization/18146] New: if-conversion is not performed for some reason kazu at cs dot umass dot edu
2004-10-25 17:01 ` [Bug rtl-optimization/18146] " pinskia at gcc dot gnu dot org
2005-04-25  2:14 ` pinskia at gcc dot gnu dot org
     [not found] <bug-18146-5009@http.gcc.gnu.org/bugzilla/>
2007-07-25 19:44 ` steven at gcc dot gnu dot org
2008-09-09  1:45 ` pinskia at gcc dot gnu dot 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).