public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/18589] could optimize FP multiplies better
       [not found] <bug-18589-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-05 23:07 ` pinskia at gcc dot gnu.org
  2012-01-09 12:21 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-05 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-12-21 03:49:53         |2012-01-04

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-05 23:06:56 UTC ---
The tree level on the trunk we get:
  powmult.2_10 = foo_1(D) * foo_1(D);
  D.1709_4 = bar_3(D) * bar_3(D);
  D.1710_5 = D.1709_4 * bar_3(D);
  D.1711_6 = D.1710_5 * bar_3(D);
  powmult.2_9 = D.1711_6 * powmult.2_10;
  D.1707_7 = powmult.2_9 * powmult.2_10;
--- CUT ---
which is just as bad.


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

* [Bug tree-optimization/18589] could optimize FP multiplies better
       [not found] <bug-18589-4@http.gcc.gnu.org/bugzilla/>
  2012-01-05 23:07 ` [Bug tree-optimization/18589] could optimize FP multiplies better pinskia at gcc dot gnu.org
@ 2012-01-09 12:21 ` rguenth at gcc dot gnu.org
  2012-01-09 13:09 ` wschmidt at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-09 12:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org,
                   |                            |wschmidt at gcc dot gnu.org

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-09 12:20:31 UTC ---
Yeah, reassoc does not canonicalize to pow () so the tree level optimal
expansion does not trigger [in reality reassoc should probably do both
on-the-fly - linearly expand existing pow()s to expose them to multiply
chains and sorting, combine them back and then emit them in optimal form].

Bill, something you want to tackle?


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

* [Bug tree-optimization/18589] could optimize FP multiplies better
       [not found] <bug-18589-4@http.gcc.gnu.org/bugzilla/>
  2012-01-05 23:07 ` [Bug tree-optimization/18589] could optimize FP multiplies better pinskia at gcc dot gnu.org
  2012-01-09 12:21 ` rguenth at gcc dot gnu.org
@ 2012-01-09 13:09 ` wschmidt at gcc dot gnu.org
  2012-01-13 22:37 ` wschmidt at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-01-09 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-01-09 13:06:34 UTC ---
Sure, I'll at least have a look at it when I get some time.


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

* [Bug tree-optimization/18589] could optimize FP multiplies better
       [not found] <bug-18589-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-01-09 13:09 ` wschmidt at gcc dot gnu.org
@ 2012-01-13 22:37 ` wschmidt at gcc dot gnu.org
  2012-04-12 16:15 ` wschmidt at gcc dot gnu.org
  2012-04-12 16:18 ` wschmidt at gcc dot gnu.org
  5 siblings, 0 replies; 9+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-01-13 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

William J. Schmidt <wschmidt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |wschmidt at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.8.0

--- Comment #8 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-01-13 22:27:48 UTC ---
I've started to look at this -- I'll plan to get a patch in place for 4.8.


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

* [Bug tree-optimization/18589] could optimize FP multiplies better
       [not found] <bug-18589-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-01-13 22:37 ` wschmidt at gcc dot gnu.org
@ 2012-04-12 16:15 ` wschmidt at gcc dot gnu.org
  2012-04-12 16:18 ` wschmidt at gcc dot gnu.org
  5 siblings, 0 replies; 9+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-04-12 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-04-12 16:15:24 UTC ---
Author: wschmidt
Date: Thu Apr 12 16:15:13 2012
New Revision: 186384

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186384
Log:
gcc:

2012-04-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR tree-optimization/18589
    * tree-ssa-reassoc.c (reassociate_stats): Add two fields.
    (operand_entry): Add count field.
    (add_repeat_to_ops_vec): New function.
    (completely_remove_stmt): Likewise.
    (remove_def_if_absorbed_call): Likewise.
    (remove_visited_stmt_chain): Remove feeding builtin pow/powi calls.
    (acceptable_pow_call): New function.
    (linearize_expr_tree): Look for builtin pow/powi calls and add operand
    entries with repeat counts when found.
    (repeat_factor_d): New struct and associated typedefs.
    (repeat_factor_vec): New static vector variable.
    (compare_repeat_factors): New function.
    (get_reassoc_pow_ssa_name): Likewise.
    (attempt_builtin_powi): Likewise.
    (reassociate_bb): Call attempt_builtin_powi.
    (fini_reassoc): Two new calls to statistics_counter_event.

gcc/testsuite:

2012-04-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR tree-optimization/18589
    * gcc.dg/tree-ssa/pr18589-1.c: New test.
    * gcc.dg/tree-ssa/pr18589-2.c: Likewise.
    * gcc.dg/tree-ssa/pr18589-3.c: Likewise.
    * gcc.dg/tree-ssa/pr18589-4.c: Likewise.
    * gcc.dg/tree-ssa/pr18589-5.c: Likewise.
    * gcc.dg/tree-ssa/pr18589-6.c: Likewise.
    * gcc.dg/tree-ssa/pr18589-7.c: Likewise.
    * gcc.dg/tree-ssa/pr18589-8.c: Likewise.
    * gcc.dg/tree-ssa/pr18589-9.c: Likewise.
    * gcc.dg/tree-ssa/pr18589-10.c: Likewise.



Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-10.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-2.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-3.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-4.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-5.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-6.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-7.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-8.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr18589-9.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-reassoc.c


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

* [Bug tree-optimization/18589] could optimize FP multiplies better
       [not found] <bug-18589-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2012-04-12 16:15 ` wschmidt at gcc dot gnu.org
@ 2012-04-12 16:18 ` wschmidt at gcc dot gnu.org
  5 siblings, 0 replies; 9+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2012-04-12 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

William J. Schmidt <wschmidt at gcc dot gnu.org> changed:

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

--- Comment #10 from William J. Schmidt <wschmidt at gcc dot gnu.org> 2012-04-12 16:16:50 UTC ---
Fixed.


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

* [Bug tree-optimization/18589] could optimize FP multiplies better
       [not found] <bug-18589-5724@http.gcc.gnu.org/bugzilla/>
@ 2006-03-05 17:43 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-05 17:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-03-05 17:43 -------
In 4.2.0 and above we get:
baz:
.LFB2:
        mulsd   %xmm1, %xmm0
        mulsd   %xmm0, %xmm0
        mulsd   %xmm0, %xmm0
        ret

Which is what I recommend but we don't get that on the tree level:
  return bar * bar * __builtin_pow (foo, 4.0e+0) * bar * bar;

So this is just a tree level missed optimization.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |TREE


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


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

* [Bug tree-optimization/18589] could optimize FP multiplies better
  2004-11-21  9:28 [Bug target/18589] New: " debian-gcc at lists dot debian dot org
  2005-01-12  6:50 ` [Bug tree-optimization/18589] " pinskia at gcc dot gnu dot org
@ 2005-07-05 19:37 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-05 19:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-05 19:37 -------
I think PR 22312 mentions what the current problem with reassoc is (well once I submit the patch to 
introduce reassociation for fp).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |22312


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


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

* [Bug tree-optimization/18589] could optimize FP multiplies better
  2004-11-21  9:28 [Bug target/18589] New: " debian-gcc at lists dot debian dot org
@ 2005-01-12  6:50 ` pinskia at gcc dot gnu dot org
  2005-07-05 19:37 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-12  6:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-12 06:50 -------
This is actually not a target issue, it can be shown on ppc also and other targets including x86.
doing (f1*f2)^2^2 will be the best every where as it is only three instructions and it would take the 
same time as what is proposed if there are two FPU units  but what I said is the smallest and fastest 
version.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |tree-optimization
  GCC build triplet|amd64-linux                 |
   GCC host triplet|amd64-linux                 |
 GCC target triplet|amd64-linux                 |


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


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

end of thread, other threads:[~2012-04-12 16:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-18589-4@http.gcc.gnu.org/bugzilla/>
2012-01-05 23:07 ` [Bug tree-optimization/18589] could optimize FP multiplies better pinskia at gcc dot gnu.org
2012-01-09 12:21 ` rguenth at gcc dot gnu.org
2012-01-09 13:09 ` wschmidt at gcc dot gnu.org
2012-01-13 22:37 ` wschmidt at gcc dot gnu.org
2012-04-12 16:15 ` wschmidt at gcc dot gnu.org
2012-04-12 16:18 ` wschmidt at gcc dot gnu.org
     [not found] <bug-18589-5724@http.gcc.gnu.org/bugzilla/>
2006-03-05 17:43 ` pinskia at gcc dot gnu dot org
2004-11-21  9:28 [Bug target/18589] New: " debian-gcc at lists dot debian dot org
2005-01-12  6:50 ` [Bug tree-optimization/18589] " pinskia at gcc dot gnu dot org
2005-07-05 19:37 ` 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).