public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13219] New: -fscse pessimizes double complex calculation
@ 2003-11-28 17:17 coyote at coyotegulch dot com
  2003-11-28 17:18 ` [Bug c/13219] -fgcse " coyote at coyotegulch dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: coyote at coyotegulch dot com @ 2003-11-28 17:17 UTC (permalink / raw)
  To: gcc-bugs

Using -fgcse pessimizes run time by 10% as compared to compiling without -fgcse.
The attached program provides a small example of
the problem.

Specifically, the line of code in question is:

    // "z" is a double complex.
    if ((creal(z) * creal(z) + cimag(z) * cimag(z)) >= 16.0)

Looking at the assembler files, the output for the above is:

with -O1:
	fld	%st(1)
	fmul	%st(2), %st
	fld	%st(1)
	fmul	%st(2), %st
	faddp	%st, %st(1)
	fucomp	%st(3)

with -O1 -fgcse:
	fld	%st(1)
	fld	%st(1)
	fxch	%st(3)
	fmul	%st(0), %st
	fxch	%st(2)
	fmul	%st(0), %st
	faddp	%st, %st(2)
	fxch	%st(1)
	fucomp	%st(3)

-- 
           Summary: -fscse pessimizes double complex calculation
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: coyote at coyotegulch dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux
  GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux


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


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

* [Bug c/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
@ 2003-11-28 17:18 ` coyote at coyotegulch dot com
  2003-11-28 17:19 ` coyote at coyotegulch dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: coyote at coyotegulch dot com @ 2003-11-28 17:18 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-fscse pessimizes double    |-fgcse pessimizes double
                   |complex calculation         |complex calculation


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


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

* [Bug c/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
  2003-11-28 17:18 ` [Bug c/13219] -fgcse " coyote at coyotegulch dot com
@ 2003-11-28 17:19 ` coyote at coyotegulch dot com
  2003-11-28 17:33 ` [Bug optimization/13219] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: coyote at coyotegulch dot com @ 2003-11-28 17:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From coyote at coyotegulch dot com  2003-11-28 17:19 -------
Created an attachment (id=5225)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5225&action=view)
Inner loop of simple fractal calculation


-- 


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


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

* [Bug optimization/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
  2003-11-28 17:18 ` [Bug c/13219] -fgcse " coyote at coyotegulch dot com
  2003-11-28 17:19 ` coyote at coyotegulch dot com
@ 2003-11-28 17:33 ` pinskia at gcc dot gnu dot org
  2003-11-28 18:10 ` falk at debian dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-28 17:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-28 17:33 -------
I can confirm this on the mainline on powerpc-apple-darwin (where there are plenty of registers):
-O1:
        fmul f13,f12,f12
        fmsub f13,f11,f11,f13
        fmul f0,f11,f12
        fadd f0,f0,f0
        fadd f11,f13,f8
        fadd f12,f0,f9
        fmul f0,f12,f12
        fmadd f0,f11,f11,f0
        fcmpu cr7,f0,f10
        cror 30,29,30
        beq- cr7,L3
        addi r2,r2,1
        cmpwi cr7,r2,255
        ble+ cr7,L7

-O1 -fgcse:
        fmul f0,f12,f12
        fmsub f0,f11,f11,f0
        fmul f13,f11,f12
        fadd f13,f13,f13
        fadd f0,f0,f8
        fadd f13,f13,f9
        fmr f11,f0
        fmr f12,f13
        fmul f13,f13,f13
        fmadd f0,f0,f0,f13
        fcmpu cr7,f0,f10
        cror 30,29,30
        beq- cr7,L3
        addi r2,r2,1
        cmpwi cr7,r2,255
        ble+ cr7,L7
See the extra fmr that is the problem.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |optimization
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-28 17:33:42
               date|                            |


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


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

* [Bug optimization/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
                   ` (2 preceding siblings ...)
  2003-11-28 17:33 ` [Bug optimization/13219] " pinskia at gcc dot gnu dot org
@ 2003-11-28 18:10 ` falk at debian dot org
  2003-11-29  2:39 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: falk at debian dot org @ 2003-11-28 18:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk at debian dot org  2003-11-28 18:10 -------
-fnew-ra helps for me here on Alpha


-- 


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


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

* [Bug optimization/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
                   ` (3 preceding siblings ...)
  2003-11-28 18:10 ` falk at debian dot org
@ 2003-11-29  2:39 ` pinskia at gcc dot gnu dot org
  2003-11-30 21:22 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-29  2:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-29 02:39 -------
-fnew-ra also helps me on PPC, also the tree-ssa also has the same problem.
The problem is that GCSE creates new temps and that causes problems for the current register 
allocator.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug optimization/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
                   ` (4 preceding siblings ...)
  2003-11-29  2:39 ` pinskia at gcc dot gnu dot org
@ 2003-11-30 21:22 ` pinskia at gcc dot gnu dot org
  2004-03-01  5:54 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-30 21:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-30 21:22 -------
I am going to mark all bugs fixed by the new-ra to be target milestone of 3.5.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.5


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


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

* [Bug optimization/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
                   ` (5 preceding siblings ...)
  2003-11-30 21:22 ` pinskia at gcc dot gnu dot org
@ 2004-03-01  5:54 ` pinskia at gcc dot gnu dot org
  2004-05-24  1:24 ` [Bug rtl-optimization/13219] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-01  5:54 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2003-11-28 17:33:42         |2004-03-01 05:54:56
               date|                            |
   Target Milestone|3.5.0                       |---


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


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

* [Bug rtl-optimization/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
                   ` (6 preceding siblings ...)
  2004-03-01  5:54 ` pinskia at gcc dot gnu dot org
@ 2004-05-24  1:24 ` pinskia at gcc dot gnu dot org
  2004-05-24 13:15 ` pinskia at gcc dot gnu dot org
  2004-08-22 14:40 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24  1:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-23 12:45 -------
The PPC (and most likely the alpha) issue is fixed on the mainline by the merge of the tree-ssa but the 
x86 issue is much worse on the mainline now even with SSAPRE disabled.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-03-01 05:54:56         |2004-05-23 12:45:26
               date|                            |
   Target Milestone|---                         |3.5.0


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


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

* [Bug rtl-optimization/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
                   ` (7 preceding siblings ...)
  2004-05-24  1:24 ` [Bug rtl-optimization/13219] " pinskia at gcc dot gnu dot org
@ 2004-05-24 13:15 ` pinskia at gcc dot gnu dot org
  2004-08-22 14:40 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 13:15 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug rtl-optimization/13219] -fgcse pessimizes double complex calculation
  2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
                   ` (8 preceding siblings ...)
  2004-05-24 13:15 ` pinskia at gcc dot gnu dot org
@ 2004-08-22 14:40 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-22 14:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-22 14:40 -------
Fixed on the mainline by SSAPRE which is a much better implemenation of PRE than GCSE is.

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


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


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

end of thread, other threads:[~2004-08-22 14:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-28 17:17 [Bug c/13219] New: -fscse pessimizes double complex calculation coyote at coyotegulch dot com
2003-11-28 17:18 ` [Bug c/13219] -fgcse " coyote at coyotegulch dot com
2003-11-28 17:19 ` coyote at coyotegulch dot com
2003-11-28 17:33 ` [Bug optimization/13219] " pinskia at gcc dot gnu dot org
2003-11-28 18:10 ` falk at debian dot org
2003-11-29  2:39 ` pinskia at gcc dot gnu dot org
2003-11-30 21:22 ` pinskia at gcc dot gnu dot org
2004-03-01  5:54 ` pinskia at gcc dot gnu dot org
2004-05-24  1:24 ` [Bug rtl-optimization/13219] " pinskia at gcc dot gnu dot org
2004-05-24 13:15 ` pinskia at gcc dot gnu dot org
2004-08-22 14:40 ` 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).