public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13355] New: Suboptimal code generated
@ 2003-12-08 15:12 arjanv at redhat dot com
  2003-12-08 15:13 ` [Bug c/13355] " arjanv at redhat dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: arjanv at redhat dot com @ 2003-12-08 15:12 UTC (permalink / raw)
  To: gcc-bugs

Attached .c file generates quite suboptimal code with tree-ssa including
* excessive stack slot usage
* moving data from a reg to a stack slot and then immediately moving it back to    
  the same reg
* cltd does not modify EAX so the XOR of eax after that instruction with the
previously-saved value is guaranteed to yield 0 so redundant

-- 
           Summary: Suboptimal code generated
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: arjanv at redhat dot com
                CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot
                    org
 GCC build triplet: i686-redhat-linux
  GCC host triplet: i686-redhat-linux
GCC target triplet: i686-redhat-linux


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


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

* [Bug c/13355] Suboptimal code generated
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
@ 2003-12-08 15:13 ` arjanv at redhat dot com
  2003-12-08 16:05 ` [Bug optimization/13355] " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: arjanv at redhat dot com @ 2003-12-08 15:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From arjanv at redhat dot com  2003-12-08 15:13 -------
Created an attachment (id=5301)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5301&action=view)
example .c file that shows behavior with  gcc -march=i686 -mtune=i686
-fomit-frame-pointer -O2 test.c


-- 


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


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

* [Bug optimization/13355] Suboptimal code generated
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
  2003-12-08 15:13 ` [Bug c/13355] " arjanv at redhat dot com
@ 2003-12-08 16:05 ` pinskia at gcc dot gnu dot org
  2003-12-08 16:56 ` [Bug c/13355] " arjanv at redhat dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-08 16:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-08 16:04 -------
The second one also happens on the mainline:
        movl    %eax, (%esp)
        movl    (%esp), %ecx

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |optimization
           Keywords|                            |pessimizes-code


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


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

* [Bug c/13355] Suboptimal code generated
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
  2003-12-08 15:13 ` [Bug c/13355] " arjanv at redhat dot com
  2003-12-08 16:05 ` [Bug optimization/13355] " pinskia at gcc dot gnu dot org
@ 2003-12-08 16:56 ` arjanv at redhat dot com
  2003-12-08 18:59 ` [Bug optimization/13355] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: arjanv at redhat dot com @ 2003-12-08 16:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From arjanv at redhat dot com  2003-12-08 16:56 -------
fwiw expected code should be something like:
    __asm__ volatile (
    "    movl    (%%ebp), %%eax \n"
    "    imull   %%ebx \n"
    "    movl    %%edx, %%ecx \n"
    "    movl    %%eax, (%%ebp) \n"
    "    movl    %%edx, 8(%%ebp) \n"
    "    cltd \n"
    "    xorl    %%ecx, %%edx \n"
    "    setne   %%al \n"
    "    movzbl  %%al, %%eax \n"
    "    movl    %%eax, 0x28(%%ebp) \n"
                                                                               
                             
    : );


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|optimization                |c


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


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

* [Bug optimization/13355] Suboptimal code generated
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
                   ` (2 preceding siblings ...)
  2003-12-08 16:56 ` [Bug c/13355] " arjanv at redhat dot com
@ 2003-12-08 18:59 ` pinskia at gcc dot gnu dot org
  2003-12-08 19:36 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-08 18:59 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |optimization


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


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

* [Bug optimization/13355] Suboptimal code generated
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
                   ` (3 preceding siblings ...)
  2003-12-08 18:59 ` [Bug optimization/13355] " pinskia at gcc dot gnu dot org
@ 2003-12-08 19:36 ` pinskia at gcc dot gnu dot org
  2003-12-09  8:43 ` arjanv at redhat dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-08 19:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-08 19:36 -------
Looks very target specific bugs now and looks like the register allocator is not doing its job.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-08 19:36:55
               date|                            |


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


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

* [Bug optimization/13355] Suboptimal code generated
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
                   ` (4 preceding siblings ...)
  2003-12-08 19:36 ` pinskia at gcc dot gnu dot org
@ 2003-12-09  8:43 ` arjanv at redhat dot com
  2003-12-24  5:49 ` kazu at cs dot umass dot edu
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: arjanv at redhat dot com @ 2003-12-09  8:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From arjanv at redhat dot com  2003-12-09 08:42 -------
compiling with -fnew-ra actually makes the code worse not better fwiw

-- 


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


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

* [Bug optimization/13355] Suboptimal code generated
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
                   ` (5 preceding siblings ...)
  2003-12-09  8:43 ` arjanv at redhat dot com
@ 2003-12-24  5:49 ` kazu at cs dot umass dot edu
  2003-12-26  4:21 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kazu at cs dot umass dot edu @ 2003-12-24  5:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2003-12-24 04:16 -------
A reduced testcase for the second case.
On mainline, i686-pc-linux-gnu.

/* -march=i686 -mtune=i686 -fomit-frame-pointer -O2 */

register int ebx asm ("ebx");
register int dummy1 asm ("esi");
register int dummy2 asm ("ebp");

int
foo (int arg)
{
  long long res = (long long) arg * (long long) ebx;
  return (int) res;
}

Global variables take up three registers from IA-32!


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kazu at cs dot umass dot edu


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


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

* [Bug optimization/13355] Suboptimal code generated
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
                   ` (6 preceding siblings ...)
  2003-12-24  5:49 ` kazu at cs dot umass dot edu
@ 2003-12-26  4:21 ` pinskia at gcc dot gnu dot org
  2004-03-12 16:39 ` [Bug optimization/13355] Suboptimal code generated with global register variables pinskia at gcc dot gnu dot org
  2005-03-29  1:55 ` [Bug rtl-optimization/13355] " pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-26  4:21 UTC (permalink / raw)
  To: gcc-bugs



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


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


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

* [Bug optimization/13355] Suboptimal code generated with global register variables
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
                   ` (7 preceding siblings ...)
  2003-12-26  4:21 ` pinskia at gcc dot gnu dot org
@ 2004-03-12 16:39 ` pinskia at gcc dot gnu dot org
  2005-03-29  1:55 ` [Bug rtl-optimization/13355] " pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-12 16:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-12 16:39 -------
This is related to bug 12395 which might get fixed when that gets fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |12395
            Summary|Suboptimal code generated   |Suboptimal code generated
                   |                            |with global register
                   |                            |variables


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


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

* [Bug rtl-optimization/13355] Suboptimal code generated with global register variables
  2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
                   ` (8 preceding siblings ...)
  2004-03-12 16:39 ` [Bug optimization/13355] Suboptimal code generated with global register variables pinskia at gcc dot gnu dot org
@ 2005-03-29  1:55 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-29  1:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-29 01:55 -------
Some of this is already fixed.

-- 


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


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

end of thread, other threads:[~2005-03-29  1:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-08 15:12 [Bug c/13355] New: Suboptimal code generated arjanv at redhat dot com
2003-12-08 15:13 ` [Bug c/13355] " arjanv at redhat dot com
2003-12-08 16:05 ` [Bug optimization/13355] " pinskia at gcc dot gnu dot org
2003-12-08 16:56 ` [Bug c/13355] " arjanv at redhat dot com
2003-12-08 18:59 ` [Bug optimization/13355] " pinskia at gcc dot gnu dot org
2003-12-08 19:36 ` pinskia at gcc dot gnu dot org
2003-12-09  8:43 ` arjanv at redhat dot com
2003-12-24  5:49 ` kazu at cs dot umass dot edu
2003-12-26  4:21 ` pinskia at gcc dot gnu dot org
2004-03-12 16:39 ` [Bug optimization/13355] Suboptimal code generated with global register variables pinskia at gcc dot gnu dot org
2005-03-29  1:55 ` [Bug rtl-optimization/13355] " 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).