public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation.
       [not found] <bug-15256-4@http.gcc.gnu.org/bugzilla/>
@ 2011-05-06 13:15 ` rguenth at gcc dot gnu.org
  2011-05-11 14:36 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-06 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-06 13:12:37 UTC ---
I also see related missed optimizations when lowering regular bitfield
ops:

  <unnamed-unsigned:8> BF.15;
  <unnamed-unsigned:8> BF.14;
  <unnamed-unsigned:8> BF.13;
  <unnamed-unsigned:8> BF.12;
  <unnamed-unsigned:8> BF.11;
  <unnamed-unsigned:8> BF.10;
  <unnamed-unsigned:32> D.2191;
  <unnamed-unsigned:32> BF.9;

<bb 2>:
  BF.9_2 = MEM[(struct S *)this_1(D)];
  D.2191_3 = BF.9_2 & 4294967292;
  BF.9_4 = D.2191_3 | 1;
  MEM[(struct S *)this_1(D)] = BF.9_4;
  BF.10_5 = MEM[(struct S *)this_1(D)];
  BF.10_6 = BF.10_5 | 4;
  BF.11_8 = BF.10_6 & 247;
  BF.12_10 = BF.11_8 | 16;
  BF.13_12 = BF.12_10 & 223;
  BF.14_14 = BF.13_12 | 64;
  BF.15_16 = BF.14_14 & 127;
  MEM[(struct S *)this_1(D)] = BF.15_16;
  return;

we should be able to optimize the |& chain easily (in forwprop, or in
reassoc by noting that we can associate |s last and &s first).


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

* [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation.
       [not found] <bug-15256-4@http.gcc.gnu.org/bugzilla/>
  2011-05-06 13:15 ` [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation rguenth at gcc dot gnu.org
@ 2011-05-11 14:36 ` rguenth at gcc dot gnu.org
  2012-02-15  7:48 ` pinskia at gcc dot gnu.org
  2014-10-31  4:01 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-11 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-11 14:13:47 UTC ---
Author: rguenth
Date: Wed May 11 14:13:38 2011
New Revision: 173659

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173659
Log:
2011-05-11  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/15256
    * tree-ssa-forwprop.c (simplify_bitwise_binary): Canonicalize
    (A & B) | C, combine (A op CST1) op CST2.
    (tree_ssa_forward_propagate_single_use_vars): Only bother to
    visit assigns that have uses.

    * gcc.dg/tree-ssa/forwprop-14.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-14.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-forwprop.c


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

* [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation.
       [not found] <bug-15256-4@http.gcc.gnu.org/bugzilla/>
  2011-05-06 13:15 ` [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation rguenth at gcc dot gnu.org
  2011-05-11 14:36 ` rguenth at gcc dot gnu.org
@ 2012-02-15  7:48 ` pinskia at gcc dot gnu.org
  2014-10-31  4:01 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-15  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rguenth at gcc dot gnu.org  |pinskia at gcc dot gnu.org

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-15 07:47:54 UTC ---
First we want to fold "(eax & 1) ^ 1" into "(~eax) & 1)" and then we can fold:
"(eax_1 & ~N) | (~eax_1 & N)" into eax ^ N .


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

* [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation.
       [not found] <bug-15256-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-02-15  7:48 ` pinskia at gcc dot gnu.org
@ 2014-10-31  4:01 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-10-31  4:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15256
Bug 15256 depends on bug 15459, which changed state.

Bug 15459 Summary: [meta-bug] there should be a tree combiner like the rtl one
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15459

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


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

* [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation.
  2004-05-03  8:03 [Bug optimization/15256] New: " kazu at cs dot umass dot edu
  2004-05-18 22:56 ` [Bug tree-optimization/15256] " segher at kernel dot crashing dot org
  2004-05-24 21:25 ` pinskia at gcc dot gnu dot org
@ 2005-05-01  4:16 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-01  4:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-01 04:16 -------
If fold optimized the following function:

unsigned int
foo (unsigned int eax)
{
  return (eax & 1) ^ 1 | (eax & 0xfffffffe);
}

Then the tree combiner might be able to optimize the orginal one.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|19466                       |15459, 19987
              nThis|                            |
   Last reconfirmed|2004-11-22 02:00:52         |2005-05-01 04:16:44
               date|                            |


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


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

* [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation.
  2004-05-03  8:03 [Bug optimization/15256] New: " kazu at cs dot umass dot edu
  2004-05-18 22:56 ` [Bug tree-optimization/15256] " segher at kernel dot crashing dot org
@ 2004-05-24 21:25 ` pinskia at gcc dot gnu dot org
  2005-05-01  4:16 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 21:25 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.5.0                       |---


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


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

* [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation.
  2004-05-03  8:03 [Bug optimization/15256] New: " kazu at cs dot umass dot edu
@ 2004-05-18 22:56 ` segher at kernel dot crashing dot org
  2004-05-24 21:25 ` pinskia at gcc dot gnu dot org
  2005-05-01  4:16 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 7+ messages in thread
From: segher at kernel dot crashing dot org @ 2004-05-18 22:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From segher at kernel dot crashing dot org  2004-05-18 11:45 -------
Subject: Re:  New: [tree-ssa] Optimize manual bitfield manipilation.

The generic rule is

X | (Y ^ Z) == (X | Y) ^ Z      if X & (Y ^ Z) == 0

(because then it is just X ^ Y ^ Z -- dunno if you want to go
that far -- but that sure would be nice).

Segher

(everything should be canonicalized to (n)ands (and maybe xors)...
or == doubt == wrong).



-- 


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


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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-15256-4@http.gcc.gnu.org/bugzilla/>
2011-05-06 13:15 ` [Bug tree-optimization/15256] [tree-ssa] Optimize manual bitfield manipilation rguenth at gcc dot gnu.org
2011-05-11 14:36 ` rguenth at gcc dot gnu.org
2012-02-15  7:48 ` pinskia at gcc dot gnu.org
2014-10-31  4:01 ` pinskia at gcc dot gnu.org
2004-05-03  8:03 [Bug optimization/15256] New: " kazu at cs dot umass dot edu
2004-05-18 22:56 ` [Bug tree-optimization/15256] " segher at kernel dot crashing dot org
2004-05-24 21:25 ` pinskia at gcc dot gnu dot org
2005-05-01  4:16 ` 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).