public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
       [not found] <bug-19719-6649@http.gcc.gnu.org/bugzilla/>
@ 2005-10-23  0:04 ` pinskia at gcc dot gnu dot org
  2006-04-06 20:58 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-23  0:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2005-10-23 00:04 -------
I am no longer working on this.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
       [not found] <bug-19719-6649@http.gcc.gnu.org/bugzilla/>
  2005-10-23  0:04 ` [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments pinskia at gcc dot gnu dot org
@ 2006-04-06 20:58 ` pinskia at gcc dot gnu dot org
  2006-04-11 21:24 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-06 20:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2006-04-06 20:58 -------
I am working on this again :).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
       [not found] <bug-19719-6649@http.gcc.gnu.org/bugzilla/>
  2005-10-23  0:04 ` [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments pinskia at gcc dot gnu dot org
  2006-04-06 20:58 ` pinskia at gcc dot gnu dot org
@ 2006-04-11 21:24 ` pinskia at gcc dot gnu dot org
  2006-10-24 13:14 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-11 21:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2006-04-11 21:24 -------
Bootstrapping the fix right now.


-- 


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
       [not found] <bug-19719-6649@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-04-11 21:24 ` pinskia at gcc dot gnu dot org
@ 2006-10-24 13:14 ` rguenth at gcc dot gnu dot org
  2006-10-26 12:57 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-24 13:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2006-10-24 13:14 -------
Tree if-conversion is now converting one jump.  Andrew, I guess you are not
working on this anymore? ;)


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2006-09-03 21:50:23         |2006-10-24 13:14:15
               date|                            |


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
       [not found] <bug-19719-6649@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-10-24 13:14 ` rguenth at gcc dot gnu dot org
@ 2006-10-26 12:57 ` pinskia at gcc dot gnu dot org
  2007-05-28 21:21 ` pinskia at gcc dot gnu dot org
  2009-04-22 21:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-26 12:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2006-10-26 12:57 -------
(In reply to comment #9)
> Tree if-conversion is now converting one jump.  Andrew, I guess you are not
> working on this anymore? ;)

I am about to fix this today, I had started to work on it yesterday also.


-- 


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
       [not found] <bug-19719-6649@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2006-10-26 12:57 ` pinskia at gcc dot gnu dot org
@ 2007-05-28 21:21 ` pinskia at gcc dot gnu dot org
  2009-04-22 21:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-28 21:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2007-05-28 21:21 -------
No longer working on this one.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
       [not found] <bug-19719-6649@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2007-05-28 21:21 ` pinskia at gcc dot gnu dot org
@ 2009-04-22 21:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-22 21:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pinskia at gcc dot gnu dot org  2009-04-22 21:25 -------
On the trunk we get:
f:
        cmpb    $1, 4(%esp)
        sbbl    %eax, %eax
        notl    %eax
        andb    8(%esp), %al
        ret

With the default arguments on i686-linux-gnu.

With -march=i686:
f:
        xorl    %eax, %eax
        cmpb    $0, 4(%esp)
        cmovne  8(%esp), %eax
        ret
With -march=i386:
        movb    8(%esp), %al
        cmpb    $0, 4(%esp)
        jne     .L2
        xorl    %eax, %eax
.L2:
        ret

So Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
  2005-01-31  6:11 [Bug rtl-optimization/19719] New: " yuri at tsoft dot com
                   ` (3 preceding siblings ...)
  2005-05-16 13:52 ` rguenth at gcc dot gnu dot org
@ 2005-05-16 21:27 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-16 21:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-16 21:27 -------
I have a patch for this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
  2005-01-31  6:11 [Bug rtl-optimization/19719] New: " yuri at tsoft dot com
                   ` (2 preceding siblings ...)
  2005-05-08 17:50 ` pinskia at gcc dot gnu dot org
@ 2005-05-16 13:52 ` rguenth at gcc dot gnu dot org
  2005-05-16 21:27 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-05-16 13:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-05-16 13:52 -------
It's a problem of tree-lowering.  In .t02.original we still have

  return <retval> = (int) (a && b);

in .t03.generic it's

bool doAnd(bool, bool) (a, b)
{
  int D.1578;
  bool iftmp.0;
  bool D.1582;
  bool D.1583;

  D.1582 = !a;
  if (D.1582)
    {
      goto <D1580>;
    }
  else
    {

    }
  D.1583 = !b;
  if (D.1583)
    {
      goto <D1580>;
    }
  else
    {

    }
  iftmp.0 = 1;
  goto <D1581>;
  <D1580>:;
  iftmp.0 = 0;
  <D1581>:;
  D.1578 = (int) iftmp.0;
  return D.1578;
}


Note that changing the function to

bool f(bool b1, bool b2) { int b1i = b1; int b2i = b2; return (!!b1i && !!b2i); }

results in the much better

bool manualAnd(bool, bool) (a, b)
{
  int D.1590;
  bool D.1591;
  bool D.1592;
  bool D.1593;
  
  {
    int ai;
    int bi;

    ai = (int) a;
    bi = (int) b;
    D.1591 = ai != 0;
    D.1592 = bi != 0;
    D.1593 = D.1591 && D.1592;
    D.1590 = (int) D.1593;
    return D.1590;
  }
}


-- 


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
  2005-01-31  6:11 [Bug rtl-optimization/19719] New: " yuri at tsoft dot com
  2005-01-31  6:47 ` [Bug tree-optimization/19719] " pinskia at gcc dot gnu dot org
  2005-05-04  1:52 ` pinskia at gcc dot gnu dot org
@ 2005-05-08 17:50 ` pinskia at gcc dot gnu dot org
  2005-05-16 13:52 ` rguenth at gcc dot gnu dot org
  2005-05-16 21:27 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-08 17:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-08 17:49 -------
On the mainline we get:
        xorl    %eax, %eax
        movzbl  8(%esp), %edx
        cmpb    $0, 4(%esp)
        je      .L4
        testb   %dl, %dl
        setne   %al
.L4:
        movzbl  %al, %eax
        ret

One thing to improve this is to change:
        testb   %dl, %dl
        setne   %al
to:
        movl    %edx, %eax

-- 


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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
  2005-01-31  6:11 [Bug rtl-optimization/19719] New: " yuri at tsoft dot com
  2005-01-31  6:47 ` [Bug tree-optimization/19719] " pinskia at gcc dot gnu dot org
@ 2005-05-04  1:52 ` pinskia at gcc dot gnu dot org
  2005-05-08 17:50 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-04  1:52 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 19719 depends on bug 15618, which changed state.

Bug 15618 Summary: Missed bool optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15618

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

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


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

* [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments
  2005-01-31  6:11 [Bug rtl-optimization/19719] New: " yuri at tsoft dot com
@ 2005-01-31  6:47 ` pinskia at gcc dot gnu dot org
  2005-05-04  1:52 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-31  6:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-31 06:47 -------
Confirmed.
Part of the problem is recorded in PR 15618.
Note on the tcb we get better code at least for PPC:
        cmpwi cr7,r3,0
        subfic r0,r4,0
        adde r4,r0,r4
        li r3,0
        beqlr- cr7
        xori r3,r4,1
        blr

VS (old code):
_f:
        cmpwi cr7,r3,0
        cmpwi cr6,r4,0
        li r3,1
        beq- cr7,L2
        bnelr+ cr6
L2:
        li r3,0
        blr

But we should be able to get when PR 15618 gets fixed:
        cmpwi cr7,r3,0
        li r3,0
        beqlr- cr7
        xori r3,r4,1
        blr
There is most likely a better way to optimize this on ppc but I cannot think of it right now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |15618
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
          Component|rtl-optimization            |tree-optimization
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-31 06:47:35
               date|                            |


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


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

end of thread, other threads:[~2009-04-22 21:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-19719-6649@http.gcc.gnu.org/bugzilla/>
2005-10-23  0:04 ` [Bug tree-optimization/19719] missed optimization on boolean operation with boolean arguments pinskia at gcc dot gnu dot org
2006-04-06 20:58 ` pinskia at gcc dot gnu dot org
2006-04-11 21:24 ` pinskia at gcc dot gnu dot org
2006-10-24 13:14 ` rguenth at gcc dot gnu dot org
2006-10-26 12:57 ` pinskia at gcc dot gnu dot org
2007-05-28 21:21 ` pinskia at gcc dot gnu dot org
2009-04-22 21:25 ` pinskia at gcc dot gnu dot org
2005-01-31  6:11 [Bug rtl-optimization/19719] New: " yuri at tsoft dot com
2005-01-31  6:47 ` [Bug tree-optimization/19719] " pinskia at gcc dot gnu dot org
2005-05-04  1:52 ` pinskia at gcc dot gnu dot org
2005-05-08 17:50 ` pinskia at gcc dot gnu dot org
2005-05-16 13:52 ` rguenth at gcc dot gnu dot org
2005-05-16 21:27 ` 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).