public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/35695]  New: [4.3/4.4 regression] -funroll-loops breaks inline float divide
@ 2008-03-25 17:29 schwab at suse dot de
  2008-03-25 17:30 ` [Bug target/35695] " schwab at suse dot de
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: schwab at suse dot de @ 2008-03-25 17:29 UTC (permalink / raw)
  To: gcc-bugs

$ gcc -O2 div.c
$ ./a.out
 1.000000000000000 0.5000000000000000 0.5000000000000000 0.3333333333333333
$ gcc -O2 -funroll-loops div.c
$ ./a.out
 1.000000000000000 0.4999980926513672 0.4999980926513672 0.3333330154418945

With -funroll-loops the insn that computes e = 1 - (b * y) is optimized in cse2
to e = 0.


-- 
           Summary: [4.3/4.4 regression] -funroll-loops breaks inline float
                    divide
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schwab at suse dot de
GCC target triplet: ia64-*-*


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


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

* [Bug target/35695] [4.3/4.4 regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
@ 2008-03-25 17:30 ` schwab at suse dot de
  2008-03-26  9:42 ` [Bug target/35695] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: schwab at suse dot de @ 2008-03-25 17:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from schwab at suse dot de  2008-03-25 17:29 -------
Created an attachment (id=15373)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15373&action=view)
Testcase


-- 


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


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

* [Bug target/35695] [4.3/4.4 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
  2008-03-25 17:30 ` [Bug target/35695] " schwab at suse dot de
@ 2008-03-26  9:42 ` rguenth at gcc dot gnu dot org
  2008-03-27  5:53 ` wilson at tuliptree dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-26  9:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
            Summary|[4.3/4.4 regression] -      |[4.3/4.4 Regression] -
                   |funroll-loops breaks inline |funroll-loops breaks inline
                   |float divide                |float divide
   Target Milestone|---                         |4.3.1


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


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

* [Bug target/35695] [4.3/4.4 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
  2008-03-25 17:30 ` [Bug target/35695] " schwab at suse dot de
  2008-03-26  9:42 ` [Bug target/35695] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
@ 2008-03-27  5:53 ` wilson at tuliptree dot org
  2008-03-27  5:55 ` wilson at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at tuliptree dot org @ 2008-03-27  5:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from wilson at tuliptree dot org  2008-03-27 05:52 -------
Subject: Re:   New: [4.3/4.4 regression] -funroll-loops
        breaks inline float divide

On Tue, 2008-03-25 at 17:29 +0000, schwab at suse dot de wrote:
> With -funroll-loops the insn that computes e = 1 - (b * y) is optimized in cse2
> to e = 0.

It seems that tree-ssa only partly unrolls and simplifies the loop.  It
isn't until the RTL loop optimization pass that we figure out that the
entire loop disappears after unrolling.  At that point, we have constant
divides 1.0/1.0, 1.0/2.0, 1.0/2.0, and 1.0/3.0.  Unfortunately, at RTL
expansion time, we already emitted long recip approx sequences.  The
second cse pass tries to propagate the FP constants into the recip
approx sequence and we get a mess.

I think the main problem here is that the reciprocal approximation
pattern is using div, which misleads the RTL optimizer into thinking
that we have a divide result when we actually don't.  Changing this to
use an UNSPEC instead seems to solve the problem, as this prevents the
cse optimization.  I just fixed the one recip pattern in div.md, but the
others should probably be fixed also.  I only tested this with a cross
compiler; I don't want to disturb the neighbors by turning my Itanium
machine on this late in the evening.

There is another problem here that we don't really need a long sequence
to compute 1.0/2.0, but that is going to take some thought.  Delaying
the expansion of the recip approx sequence might help, but will probably
also hurt in other cases.  We do have REG_EQUAL notes at the end of the
recip approx sequences, maybe we can do something with those, like
pre-compute the constant divide result and place it in the constant
pool.

Jim


-- 


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


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

* [Bug target/35695] [4.3/4.4 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (2 preceding siblings ...)
  2008-03-27  5:53 ` wilson at tuliptree dot org
@ 2008-03-27  5:55 ` wilson at gcc dot gnu dot org
  2008-03-27 15:47 ` schwab at suse dot de
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2008-03-27  5:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from wilson at gcc dot gnu dot org  2008-03-27 05:54 -------
Created an attachment (id=15385)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15385&action=view)
Itanium reciprocal approximation bug fix

Untested patch produced with wrong (default) svn diff options.  Should probably
make the same change to the other recip approx patterns in ia64.md.


-- 


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


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

* [Bug target/35695] [4.3/4.4 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (3 preceding siblings ...)
  2008-03-27  5:55 ` wilson at gcc dot gnu dot org
@ 2008-03-27 15:47 ` schwab at suse dot de
  2008-03-27 17:18 ` schwab at suse dot de
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: schwab at suse dot de @ 2008-03-27 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from schwab at suse dot de  2008-03-27 15:47 -------
Results here: <http://gcc.gnu.org/ml/gcc-testresults/2008-03/msg02106.html>,
and it fixes the test case.


-- 


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


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

* [Bug target/35695] [4.3/4.4 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (4 preceding siblings ...)
  2008-03-27 15:47 ` schwab at suse dot de
@ 2008-03-27 17:18 ` schwab at suse dot de
  2008-03-31 19:52 ` wilson at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: schwab at suse dot de @ 2008-03-27 17:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from schwab at suse dot de  2008-03-27 17:18 -------
It also fixes the original problem.


-- 


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


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

* [Bug target/35695] [4.3/4.4 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (5 preceding siblings ...)
  2008-03-27 17:18 ` schwab at suse dot de
@ 2008-03-31 19:52 ` wilson at gcc dot gnu dot org
  2008-03-31 20:23 ` wilson at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2008-03-31 19:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from wilson at gcc dot gnu dot org  2008-03-31 19:52 -------
Subject: Bug 35695

Author: wilson
Date: Mon Mar 31 19:51:50 2008
New Revision: 133772

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133772
Log:
PR target/35695
* config/ia64/div.md (recip_approx_rf): Use UNSPEC not DIV.
* config/ia64/ia64.c (rtx_needs_barrier): Handle
UNSPEC_FR_RECIP_APPROX_RES.
* config/ia64/ia64.md (UNSPEC_FR_RECIP_APPROX_RES): Define.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/ia64/div.md
    trunk/gcc/config/ia64/ia64.c
    trunk/gcc/config/ia64/ia64.md


-- 


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


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

* [Bug target/35695] [4.3/4.4 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (6 preceding siblings ...)
  2008-03-31 19:52 ` wilson at gcc dot gnu dot org
@ 2008-03-31 20:23 ` wilson at gcc dot gnu dot org
  2008-04-07 23:49 ` [Bug target/35695] [4.3 " wilson at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2008-03-31 20:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

wilson at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |wilson at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-31 20:22:40
               date|                            |


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


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

* [Bug target/35695] [4.3 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (7 preceding siblings ...)
  2008-03-31 20:23 ` wilson at gcc dot gnu dot org
@ 2008-04-07 23:49 ` wilson at gcc dot gnu dot org
  2008-04-08  8:43 ` rguenther at suse dot de
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2008-04-07 23:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from wilson at gcc dot gnu dot org  2008-04-07 23:48 -------
Anyone care whether this gets fixed in 4.3?  If so, are you willing to test it?
 I'll approve it for 4.3 with proper testing, which is not easy for me to do.


-- 


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


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

* [Bug target/35695] [4.3 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (8 preceding siblings ...)
  2008-04-07 23:49 ` [Bug target/35695] [4.3 " wilson at gcc dot gnu dot org
@ 2008-04-08  8:43 ` rguenther at suse dot de
  2008-04-12 16:49 ` wilson at gcc dot gnu dot org
  2008-04-14 23:48 ` wilson at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenther at suse dot de @ 2008-04-08  8:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenther at suse dot de  2008-04-08 08:42 -------
Subject: Re:  [4.3 Regression] -funroll-loops breaks inline
 float divide

On Mon, 7 Apr 2008, wilson at gcc dot gnu dot org wrote:

> ------- Comment #7 from wilson at gcc dot gnu dot org  2008-04-07 23:48 -------
> Anyone care whether this gets fixed in 4.3?  If so, are you willing to test it?
>  I'll approve it for 4.3 with proper testing, which is not easy for me to do.

We have it patched in in our 4.3 tree and it didn't cause problems sofar,
so I think it should be applied for 4.3 as well.

Richard.


-- 


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


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

* [Bug target/35695] [4.3 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (9 preceding siblings ...)
  2008-04-08  8:43 ` rguenther at suse dot de
@ 2008-04-12 16:49 ` wilson at gcc dot gnu dot org
  2008-04-14 23:48 ` wilson at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2008-04-12 16:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from wilson at gcc dot gnu dot org  2008-04-12 16:48 -------
Subject: Bug 35695

Author: wilson
Date: Sat Apr 12 16:47:55 2008
New Revision: 134222

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134222
Log:
PR target/35695
* config/ia64/div.md (recip_approx_rf): Use UNSPEC not DIV.
* config/ia64/ia64.c (rtx_needs_barrier): Handle
UNSPEC_FR_RECIP_APPROX_RES.
* config/ia64/ia64.md (UNSPEC_FR_RECIP_APPROX_RES): Define.

Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config/ia64/div.md
    branches/gcc-4_3-branch/gcc/config/ia64/ia64.c
    branches/gcc-4_3-branch/gcc/config/ia64/ia64.md


-- 


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


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

* [Bug target/35695] [4.3 Regression] -funroll-loops breaks inline float divide
  2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
                   ` (10 preceding siblings ...)
  2008-04-12 16:49 ` wilson at gcc dot gnu dot org
@ 2008-04-14 23:48 ` wilson at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: wilson at gcc dot gnu dot org @ 2008-04-14 23:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from wilson at gcc dot gnu dot org  2008-04-14 23:47 -------
Fixed on mainline and 4.3 branch.


-- 

wilson at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-04-14 23:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-25 17:29 [Bug target/35695] New: [4.3/4.4 regression] -funroll-loops breaks inline float divide schwab at suse dot de
2008-03-25 17:30 ` [Bug target/35695] " schwab at suse dot de
2008-03-26  9:42 ` [Bug target/35695] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
2008-03-27  5:53 ` wilson at tuliptree dot org
2008-03-27  5:55 ` wilson at gcc dot gnu dot org
2008-03-27 15:47 ` schwab at suse dot de
2008-03-27 17:18 ` schwab at suse dot de
2008-03-31 19:52 ` wilson at gcc dot gnu dot org
2008-03-31 20:23 ` wilson at gcc dot gnu dot org
2008-04-07 23:49 ` [Bug target/35695] [4.3 " wilson at gcc dot gnu dot org
2008-04-08  8:43 ` rguenther at suse dot de
2008-04-12 16:49 ` wilson at gcc dot gnu dot org
2008-04-14 23:48 ` wilson 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).