public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <bug-9814-5514@http.gcc.gnu.org/bugzilla/>
@ 2005-12-07  3:12 ` pinskia at gcc dot gnu dot org
  2006-11-18  1:27 ` steven at gcc dot gnu dot org
  2006-11-18  1:34 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-07  3:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2005-12-07 03:12 -------
Once fold does (a&b)!=0?a|b:a to a and PR 25290 is fixed then this will be
caught at the tree level. There are most likely others like this too.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |25290


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


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

* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <bug-9814-5514@http.gcc.gnu.org/bugzilla/>
  2005-12-07  3:12 ` [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away pinskia at gcc dot gnu dot org
@ 2006-11-18  1:27 ` steven at gcc dot gnu dot org
  2006-11-18  1:34 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-11-18  1:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from steven at gcc dot gnu dot org  2006-11-18 01:27 -------
Shouldn't this be fixed by Roger Sayle's recent fold-const.c patch?


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sayle at gcc dot gnu dot org
             Status|NEW                         |WAITING


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


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

* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <bug-9814-5514@http.gcc.gnu.org/bugzilla/>
  2005-12-07  3:12 ` [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away pinskia at gcc dot gnu dot org
  2006-11-18  1:27 ` steven at gcc dot gnu dot org
@ 2006-11-18  1:34 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-18  1:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-11-18 01:34 -------
(In reply to comment #8)
> Shouldn't this be fixed by Roger Sayle's recent fold-const.c patch?

No, in fact the generic (the one where 2 is turned into a variable) is not
optimized either.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
   Last reconfirmed|2006-09-17 09:19:25         |2006-11-18 01:34:36
               date|                            |


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


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

* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <bug-9814-4@http.gcc.gnu.org/bugzilla/>
@ 2011-05-22 15:14 ` steven at gcc dot gnu.org
  0 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu.org @ 2011-05-22 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #10 from Steven Bosscher <steven at gcc dot gnu.org> 2011-05-22 14:54:53 UTC ---
Works overall, fails at GIMPLE level:

$ ./cc1 -quiet -m32 -fomit-frame-pointer -O2 t.c -fdump-tree-optimized
$ cat t.s
    .file    "t.c"
    .text
    .p2align 4,,15
    .globl    k
    .type    k, @function
k:
.LFB0:
    .cfi_startproc
    movl    4(%esp), %eax
    ret
    .cfi_endproc
.LFE0:
    .size    k, .-k
    .ident    "GCC: (GNU) 4.6.0 20110312 (experimental) [trunk revision
170907]"
    .section    .note.GNU-stack,"",@progbits
$ cat t.c.143t.optimized 

;; Function k (k)

k (int l)
{
  int D.1979;

<bb 2>:
  D.1979_3 = l_2(D) & 2;
  if (D.1979_3 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  l_4 = l_2(D) | 2;

<bb 4>:
  # l_1 = PHI <l_2(D)(2), l_4(3)>
  return l_1;

}

But there is already a (series of) bug report(s) for missed bit folding
optimizations on GIMPLE.


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

* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <20030223074600.9814.181096@bugs.debian.org>
                   ` (3 preceding siblings ...)
  2005-05-27  2:51 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-27  4:37 ` roger at eyesopen dot com
  4 siblings, 0 replies; 9+ messages in thread
From: roger at eyesopen dot com @ 2005-05-27  4:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From roger at eyesopen dot com  2005-05-27 02:55 -------
This optimization is now performed at the RTL-level, but it would be nice if
this (and several other of ifcvt.c's noce_try_foo optimizations) could be
caught earlier during tree-ssa.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|roger at eyesopen dot com   |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW
           Keywords|patch                       |


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


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

* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <20030223074600.9814.181096@bugs.debian.org>
                   ` (2 preceding siblings ...)
  2005-05-22 19:25 ` roger at eyesopen dot com
@ 2005-05-27  2:51 ` cvs-commit at gcc dot gnu dot org
  2005-05-27  4:37 ` roger at eyesopen dot com
  4 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-27  2:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-27 02:46 -------
Subject: Bug 9814

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2005-05-27 02:46:01

Modified files:
	gcc            : ChangeLog ifcvt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr9814-1.c 

Log message:
	PR tree-optimization/9814
	* ifcvt.c (noce_emit_move_insn): If we fail to recognize the move
	instruction, add the necessary clobbers by re-expanding the RTL
	for arithmetic operations via optab.c's expand_unop/expand_binop.
	(noce_try_bitop): New function to optimize bit manipulation idioms
	of the form "if (x & C) x = x op C" and "if (!(x & C) x = x op C".
	(noce_process_if_block): Call noce_try_bitop.
	
	* gcc.dg/pr9814-1.c: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8916&r2=2.8917
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ifcvt.c.diff?cvsroot=gcc&r1=1.187&r2=1.188
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5540&r2=1.5541
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr9814-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <20030223074600.9814.181096@bugs.debian.org>
  2004-06-04  5:41 ` pinskia at gcc dot gnu dot org
  2005-01-23 15:25 ` steven at gcc dot gnu dot org
@ 2005-05-22 19:25 ` roger at eyesopen dot com
  2005-05-27  2:51 ` cvs-commit at gcc dot gnu dot org
  2005-05-27  4:37 ` roger at eyesopen dot com
  4 siblings, 0 replies; 9+ messages in thread
From: roger at eyesopen dot com @ 2005-05-22 19:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From roger at eyesopen dot com  2005-05-22 19:25 -------
I posted a patch here: http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01956.html
to implement this in the RTL optimizers.  Better to get it linked to the PR,
than slip through the cracks.  The proposed change to noce_emit_move_insn is
also related to another missed optimization PR, whose number I can no longer
remember.  Something to do with synthesized insn not getting recognized without
the needed clobbers.

I agree with Kazu that these transformations should also be implemented at the
tree-ssa level. I think once I commit the RTL solution to mainline CVS (so these
optimizations are performed somewhere), I'll unassign the PR (from myself), and
leave the tree-optimization PR open as an enhancement request.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <20030223074600.9814.181096@bugs.debian.org>
  2004-06-04  5:41 ` pinskia at gcc dot gnu dot org
@ 2005-01-23 15:25 ` steven at gcc dot gnu dot org
  2005-05-22 19:25 ` roger at eyesopen dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-23 15:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-23 15:25 -------
This is a NOP for me on AMD64 but not on i686. 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   GCC host triplet|i386-linux                  |
 GCC target triplet|                            |ix86


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


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

* [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away
       [not found] <20030223074600.9814.181096@bugs.debian.org>
@ 2004-06-04  5:41 ` pinskia at gcc dot gnu dot org
  2005-01-23 15:25 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-04  5:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-04 05:41 -------
I think this can be done on the tree using <http://gcc.gnu.org/ml/gcc-patches/2004-06/
msg00153.html> and not changing (a&2) == 0 into (a>>1) & 1 until late.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
          Component|rtl-optimization            |tree-optimization


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


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

end of thread, other threads:[~2011-05-22 15:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-9814-5514@http.gcc.gnu.org/bugzilla/>
2005-12-07  3:12 ` [Bug tree-optimization/9814] gcc fails to optimise if (l&2) l|=2 away pinskia at gcc dot gnu dot org
2006-11-18  1:27 ` steven at gcc dot gnu dot org
2006-11-18  1:34 ` pinskia at gcc dot gnu dot org
     [not found] <bug-9814-4@http.gcc.gnu.org/bugzilla/>
2011-05-22 15:14 ` steven at gcc dot gnu.org
     [not found] <20030223074600.9814.181096@bugs.debian.org>
2004-06-04  5:41 ` pinskia at gcc dot gnu dot org
2005-01-23 15:25 ` steven at gcc dot gnu dot org
2005-05-22 19:25 ` roger at eyesopen dot com
2005-05-27  2:51 ` cvs-commit at gcc dot gnu dot org
2005-05-27  4:37 ` roger at eyesopen dot com

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).