delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2009/05/27/00:01:19

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Rugxulo <rugxulo AT gmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GCC-4.4.0
Date: Tue, 26 May 2009 20:49:26 -0700 (PDT)
Organization: http://groups.google.com
Lines: 92
Message-ID: <4d9d0307-30e4-4253-a7f3-4c7699b15fc2@g37g2000yqn.googlegroups.com>
References: <4A1A2B1C DOT 40503 AT iki DOT fi> <14171114-11cf-4aa5-bebe-ff3487aff924 AT o30g2000vbc DOT googlegroups DOT com>
<4A1A9564 DOT 1050305 AT iki DOT fi> <8ca6290b-d271-480c-8ef3-103d20aabf1e AT t21g2000yqi DOT googlegroups DOT com>
<4A1B8079 DOT 5030508 AT iki DOT fi>
NNTP-Posting-Host: 65.13.115.246
Mime-Version: 1.0
X-Trace: posting.google.com 1243396166 7027 127.0.0.1 (27 May 2009 03:49:26 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Wed, 27 May 2009 03:49:26 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: g37g2000yqn.googlegroups.com; posting-host=65.13.115.246;
posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
User-Agent: G2/1.0
X-HTTP-UserAgent: Opera/9.64 (Windows NT 6.0; U; en) Presto/2.1.1,gzip(gfe),gzip(gfe)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi again,

On May 26, 12:39=A0am, Andris Pavenis <andris DOT pave DOT  DOT  DOT  AT iki DOT fi> wrote:
>
> >> Perhaps the best source is the documentation (archives
> >> present at specified URL even if not montioned in earlier post) or gcc=
-help
> >> mailing list if the information is not found in documentation.
>
> > Yes, I know. I tried (and tried and tried ...). What I discovered is
> > that "__attribute__((optimize(2)))" works on function prototypes
> > (only) ...
>
> If there is no help from the documentation then You can ask in gcc-help
> mailing list (search archives at first:http://gcc.gnu.org/lists.html).
>
> I myself usually avoid using constructions specific to GCC only even if
> I do not use different compilers.

More searching didn't really turn up anything, but here's the (old
old) June '08 patch for quick glance if you're curious:

http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01435.html

So here's some more interesting info. Does the function attribute
work? Yes. I #ifdef'd around it just to be sure. As you can see,
there's an obvious speed difference, so something is getting
optimized! Good, proof it works!  :-)   But I also noticed the .EXE
size was bigger than my build yesterday for no obvious reason. It
seems the "optimize" attribute is adding 30k to the code size!! I
suspect this is a bug since I can't imagine needing to store any extra
info (even if LD did optimize for COFF, which I don't think it does,
only ELF).

EDIT: Unofficial MinGW 4.4.0 doesn't have this problem (actually,
its .EXE is < 1k smaller instead of bigger).

P.S. Using "-O3" on the cmdline always overrides "O2" in the pragma
(which is only bad because it's slower with -O3 here ... oh well).

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
#ifndef SLOW
#if GCC_VERSION >=3D 40400     // see CPP.INFO for the GCC_VERSION
define
#define FUNC_OPTIMIZE __attribute__((__optimize__("O2")))
int dot_product_noasm(short *t, short *w, int n) FUNC_OPTIMIZE ;
void train_noasm(short *t, short *w, int n, int err) FUNC_OPTIMIZE ;
#endif
#endif
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D

-----------------------------------------------------
[ Vista/DJGPP ] - Tue 05/26/2009 >gmake paq8o8z CXXFLAGS=3D"-DNOASM -s -
DSLOW" &
paq8o8z doydoy *.cpp & v *.exe & del paq8o8z paq8o8z.exe
gpp -DNOASM -s -DSLOW    paq8o8z.cpp   -o paq8o8z

paq8o8z compiled May 26 2009 by DJGPP 2.04 / G++ 4.4.0 for FreeDOS

514187264 bytes DPMI available
Creating archive doydoy.paq8o8z via level 1 with 1 file(s)...
paq8o8z.cpp 152203 -> 36049
152203 -> 36083
Time 27.86 sec, used 37286742 bytes of memory

-rwxr-xr-x    1 Rugxulo  root       656896 May 26 22:06 paq8o8z.exe

[ Vista/DJGPP ] - Tue 05/26/2009 >gmake paq8o8z CXXFLAGS=3D"-DNOASM -s"
&
paq8o8z doydoy *.cpp & v *.exe & del paq8o8z paq8o8z.exe
gpp -DNOASM -s    paq8o8z.cpp   -o paq8o8z

paq8o8z compiled May 26 2009 by DJGPP 2.04 / G++ 4.4.0 for FreeDOS

518434816 bytes DPMI available
Creating archive doydoy.paq8o8z via level 1 with 1 file(s)...
paq8o8z.cpp 152203 -> 36049
152203 -> 36083
Time 15.77 sec, used 37286742 bytes of memory

-rwxr-xr-x    1 Rugxulo  root       686592 May 26 22:08 paq8o8z.exe

[ Vista/DJGPP ] - Tue 05/26/2009 >echo Notice the 30k size difference!
Notice the 30k size difference!

-----------------------------------------------------

Hope this helps in some way!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019