public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register
@ 2005-02-14 11:36 giovannibajo at libero dot it
  2005-02-14 11:38 ` [Bug c/19945] " giovannibajo at libero dot it
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2005-02-14 11:36 UTC (permalink / raw)
  To: gcc-bugs

----------------------------
int a;
void foo(void)
{
  a = 10;
}
----------------------------

when compiled with GCC 4.0 20050118, with -O2 -fomit-frame-pointer, generates 
the following code:

foo:
        movl    $10, %eax
        movl    %eax, a
        ret

Notice the unnecessary which wastes a register.  With 3.4, we get the expected 
code:

foo:
        movl    $10, a
        ret

-- 
           Summary: [4.0 Regression] inefficient store of constant into a
                    global register
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: giovannibajo at libero dot it
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: x86-*-*


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


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

* [Bug c/19945] [4.0 Regression] inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
@ 2005-02-14 11:38 ` giovannibajo at libero dot it
  2005-02-14 11:46 ` [Bug target/19945] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2005-02-14 11:38 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
      Known to fail|                            |4.0.0
      Known to work|                            |3.4.3
   Target Milestone|---                         |4.0.0


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


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

* [Bug target/19945] [4.0 Regression] inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
  2005-02-14 11:38 ` [Bug c/19945] " giovannibajo at libero dot it
@ 2005-02-14 11:46 ` pinskia at gcc dot gnu dot org
  2005-02-14 12:01 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-14 11:46 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target


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


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

* [Bug target/19945] [4.0 Regression] inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
                   ` (2 preceding siblings ...)
  2005-02-14 12:01 ` pinskia at gcc dot gnu dot org
@ 2005-02-14 12:01 ` pinskia at gcc dot gnu dot org
  2005-02-14 13:36 ` [Bug target/19945] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-14 12:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-14 00:26 -------
Confirmed with yesterday's compiler (why it works with a cross to x86_64 and -m32 I don't know).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-14 00:26:38
               date|                            |


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


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

* [Bug target/19945] [4.0 Regression] inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
  2005-02-14 11:38 ` [Bug c/19945] " giovannibajo at libero dot it
  2005-02-14 11:46 ` [Bug target/19945] " pinskia at gcc dot gnu dot org
@ 2005-02-14 12:01 ` pinskia at gcc dot gnu dot org
  2005-02-14 12:01 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-14 12:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-14 00:25 -------
Fixed since at least 20050127.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |minor


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


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

* [Bug target/19945] inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
                   ` (3 preceding siblings ...)
  2005-02-14 12:01 ` pinskia at gcc dot gnu dot org
@ 2005-02-14 13:36 ` pinskia at gcc dot gnu dot org
  2005-02-14 13:36 ` [Bug target/19945] Inefficient " giovannibajo at libero dot it
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-14 13:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-14 00:35 -------
This is not a regression at all, in fact on i686 it is cheaper to do the moves instead of doing it in one 
move.

So really this is not a bug at all.  In fact my testing shows that this is not really a regression either and 
not it looks like the 3.4.3 you used was not compiled for i686 by default.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.0.0                       |3.4.0 4.0.0 3.0.4 3.2.3
      Known to work|3.4.3                       |
         Resolution|                            |INVALID
            Summary|[4.0 Regression] inefficient|inefficient store of
                   |store of constant into a    |constant into a global
                   |global register             |register
   Target Milestone|4.0.0                       |---


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


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

* [Bug target/19945] Inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
                   ` (4 preceding siblings ...)
  2005-02-14 13:36 ` [Bug target/19945] " pinskia at gcc dot gnu dot org
@ 2005-02-14 13:36 ` giovannibajo at libero dot it
  2005-02-14 13:43 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2005-02-14 13:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-02-14 00:36 -------
Seems deliberate, -march=i486 fixes it, so it is not a regression (my 3.4 was 
configured to default to -march=i486). I don't see how wasting a register can 
make the code faster on i686 though.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.0 4.0.0 3.0.4 3.2.3     |
            Summary|inefficient store of        |Inefficient store of
                   |constant into a global      |constant into a global
                   |register                    |register
   Target Milestone|---                         |4.0.0


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


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

* [Bug target/19945] Inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
                   ` (5 preceding siblings ...)
  2005-02-14 13:36 ` [Bug target/19945] Inefficient " giovannibajo at libero dot it
@ 2005-02-14 13:43 ` giovannibajo at libero dot it
  2005-02-14 13:45 ` pinskia at gcc dot gnu dot org
  2005-02-14 13:46 ` steven at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: giovannibajo at libero dot it @ 2005-02-14 13:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-02-14 00:37 -------
It is easy to devise a testcase where we run slower because of the additional 
wasted register. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


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


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

* [Bug target/19945] Inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
                   ` (6 preceding siblings ...)
  2005-02-14 13:43 ` giovannibajo at libero dot it
@ 2005-02-14 13:45 ` pinskia at gcc dot gnu dot org
  2005-02-14 13:46 ` steven at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-14 13:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-14 00:43 -------
Then open one with that testcase as this as this is intentional as:
const int x86_split_long_moves = m_PPRO;

and PPRO is the same as i686 and pentiumpro.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug target/19945] Inefficient store of constant into a global register
  2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
                   ` (7 preceding siblings ...)
  2005-02-14 13:45 ` pinskia at gcc dot gnu dot org
@ 2005-02-14 13:46 ` steven at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-02-14 13:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-02-14 00:49 -------
This is not wasting a register at all, don't make unfounded claims like that 
if you don't know why exactly the code looks like it does. 
 
In this case the code comes from a peephole2 splitting the immediate move.  
Those peepholes run after register allocation, so the peephole can only apply 
if a register is available.  If there are no available registers, the peephole 
simply does not match. 
 
So in fact this peephole makes gcc use the registers more efficiently! 

-- 


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


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

end of thread, other threads:[~2005-02-14  0:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-14 11:36 [Bug c/19945] New: [4.0 Regression] inefficient store of constant into a global register giovannibajo at libero dot it
2005-02-14 11:38 ` [Bug c/19945] " giovannibajo at libero dot it
2005-02-14 11:46 ` [Bug target/19945] " pinskia at gcc dot gnu dot org
2005-02-14 12:01 ` pinskia at gcc dot gnu dot org
2005-02-14 12:01 ` pinskia at gcc dot gnu dot org
2005-02-14 13:36 ` [Bug target/19945] " pinskia at gcc dot gnu dot org
2005-02-14 13:36 ` [Bug target/19945] Inefficient " giovannibajo at libero dot it
2005-02-14 13:43 ` giovannibajo at libero dot it
2005-02-14 13:45 ` pinskia at gcc dot gnu dot org
2005-02-14 13:46 ` steven 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).