public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: middle-end/9967: Some standard C function calls should not be replaced when optimizing for size
@ 2003-03-30  8:36 Kaveh R. Ghazi
  0 siblings, 0 replies; 4+ messages in thread
From: Kaveh R. Ghazi @ 2003-03-30  8:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR middle-end/9967; it has been noted by GNATS.

From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: beszedes@cc.u-szeged.hu, beszedes@rgai.hu, gcc-bugs@gcc.gnu.org,
        gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: middle-end/9967: Some standard C function calls should not be replaced when optimizing for size
Date: Sat, 29 Mar 2003 23:49:33 -0500 (EST)

 > From: Arpad Beszedes <beszedes@cc.u-szeged.hu>
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9967
 > 
 > This PR can be closed, because a patch has been implemented and applied 
 > to 3.3 and mainline:
 > 
 > http://gcc.gnu.org/ml/gcc-patches/2003-03/threads.html#00425
 
 FYI, Gaby approved it for 3.2.3 via private email, and I've just
 applied the patch there too.
 --
 Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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

* Re: middle-end/9967: Some standard C function calls should not be replaced when optimizing for size
@ 2003-03-28 10:46 ebotcazou
  0 siblings, 0 replies; 4+ messages in thread
From: ebotcazou @ 2003-03-28 10:46 UTC (permalink / raw)
  To: beszedes, gcc-bugs, gcc-prs, nobody

Synopsis: Some standard C function calls should not be replaced when optimizing for size

State-Changed-From-To: open->closed
State-Changed-By: ebotcazou
State-Changed-When: Fri Mar 28 10:45:51 2003
State-Changed-Why:
    On submitter's request.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9967


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

* Re: middle-end/9967: Some standard C function calls should not be replaced when optimizing for size
@ 2003-03-28 10:16 Arpad Beszedes
  0 siblings, 0 replies; 4+ messages in thread
From: Arpad Beszedes @ 2003-03-28 10:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR middle-end/9967; it has been noted by GNATS.

From: Arpad Beszedes <beszedes@cc.u-szeged.hu>
To: gcc-gnats@gcc.gnu.org,  gcc-bugs@gcc.gnu.org,  nobody@gcc.gnu.org, 
 gcc-prs@gcc.gnu.org,  beszedes@rgai.hu,  ghazi@caip.rutgers.edu
Cc:  
Subject: Re: middle-end/9967: Some standard C function calls should not be
 replaced when optimizing for size
Date: Fri, 28 Mar 2003 11:13:17 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9967
 
 This PR can be closed, because a patch has been implemented and applied 
 to 3.3 and mainline:
 
 http://gcc.gnu.org/ml/gcc-patches/2003-03/threads.html#00425
 
 Thanks,
    Arpad Beszedes
 


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

* middle-end/9967: Some standard C function calls should not be replaced when optimizing for size
@ 2003-03-05 14:26 beszedes
  0 siblings, 0 replies; 4+ messages in thread
From: beszedes @ 2003-03-05 14:26 UTC (permalink / raw)
  To: gcc-gnats

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1478 bytes --]


>Number:         9967
>Category:       middle-end
>Synopsis:       Some standard C function calls should not be replaced when optimizing for size
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 05 14:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Árpád Beszédes
>Release:        gcc version 3.3 20030224 (prerelease)
>Organization:
>Environment:
BUILD & HOST: Linux 2.4.20 i686 unknown
TARGET: arm-unknown-elf
>Description:
GCC replaces calls with special parameters to some standard C functions to equivalent ones in order to increase performance. E.g. fputs with string parameter -> fwrite.
However, some of these calls take more instructions, which is not good if we optimize for size. These replacements should be avoided depending on the optimization switches. (See example below.)
>How-To-Repeat:
This simple program demonstrates that fprintf is replaced by calling fwrite in the assembly output (arm-elf target with newlib library):

#include <stdio.h>
void foo ()
{
  fprintf(stderr, "Comment"); // fprintf->fwrite
}

ldr r3, .L2
ldr r3, [r3, #0]
ldr r0, .L2+4
ldr r3, [r3, #12]
mov r1, #1
mov r2, #7
b fwrite

However, calling fprintf would require two instructions less:

ldr r3, .L2
ldr r3, [r3, #0]
ldr r1, .L2+4
ldr r0, [r3, #12]
b fprintf
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-03-30  4:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-30  8:36 middle-end/9967: Some standard C function calls should not be replaced when optimizing for size Kaveh R. Ghazi
  -- strict thread matches above, loose matches on Subject: below --
2003-03-28 10:46 ebotcazou
2003-03-28 10:16 Arpad Beszedes
2003-03-05 14:26 beszedes

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).