Pentium-optimized gcc

Pentium-optimized gcc

Post by Jan Ekholm I » Tue, 18 Jul 1995 04:00:00



I'd like to know if there is a Pentium-optimized version of gcc around
somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't
make optimized code.  Or am I wrong here?

I found two new versions of gcc on sunsite, could anyone tell me a bit
about them, and which one to use (they are huge, and I'm forced to use
a SLIP-link to download).  Anyone got any ideas how to tell gcc to
create 586-code (-586, -pentium...)?  Can the kernel be compiled using
pentium-optimization?  

How much (on average) will my code speed up (if at all)?  10%  More/less?

These are the files found on sunsite, and the latter seems to be the one
for me :

-rw-rw-r--   1 11    20    2033426 Jul 15 22:36 gcc-2.7.0.bin.aout.tar.gz
-rw-rw-r--   1 11    20    1030606 Jul 12 11:44 gcc-i586.tar.gz

Thanks for any advice!

--
 Jan 'Chakie' Ekholm      \   CS at Abo Akademi University, Turku, Finland


http://www.abo.fi/~jekholm\          Linux Inside since fall '94.

 
 
 

Pentium-optimized gcc

Post by Daniel.Tayl » Tue, 18 Jul 1995 04:00:00



: : I'd like to know if there is a Pentium-optimized version of gcc around
: : somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't
: : make optimized code.  Or am I wrong here?

: Try to look for file gcc-i2.6.3.tar.gz (i in the name is important)
: somewhere on the sunsite. It is patched gcc 2.6.3 by Intel.

Gcc-2.7.0 has been posted to sunsite. The documentation claims -586 opt.
I run a 486 so I haven't been able to performance test it.

--

(My employer doesn't even know my opinions, let alone share them)
We are Bill of Microsoft, you will be assimilated, really, honest,
as soon as we can arrange the release date....

 
 
 

Pentium-optimized gcc

Post by habi.. » Tue, 18 Jul 1995 04:00:00



: I'd like to know if there is a Pentium-optimized version of gcc around
: somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't
: make optimized code.  Or am I wrong here?

: I found two new versions of gcc on sunsite, could anyone tell me a bit
: about them, and which one to use (they are huge, and I'm forced to use
: a SLIP-link to download).  Anyone got any ideas how to tell gcc to
: create 586-code (-586, -pentium...)?  Can the kernel be compiled using
: pentium-optimization?  

: How much (on average) will my code speed up (if at all)?  10%  More/less?

: These are the files found on sunsite, and the latter seems to be the one
: for me :

: -rw-rw-r--   1 11    20    2033426 Jul 15 22:36 gcc-2.7.0.bin.aout.tar.gz
: -rw-rw-r--   1 11    20    1030606 Jul 12 11:44 gcc-i586.tar.gz
                                                       ^
                                                       |
In which directory you found this ---------------------+

: Thanks for any advice!

: --
:  Jan 'Chakie' Ekholm      \   CS at Abo Akademi University, Turku, Finland


: http://www.abo.fi/~jekholm\          Linux Inside since fall '94.

--

 
 
 

Pentium-optimized gcc

Post by Laco Rusn » Tue, 18 Jul 1995 04:00:00



: I'd like to know if there is a Pentium-optimized version of gcc around
: somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't
: make optimized code.  Or am I wrong here?

Try to look for file gcc-i2.6.3.tar.gz (i in the name is important)
somewhere on the sunsite. It is patched gcc 2.6.3 by Intel.

: I found two new versions of gcc on sunsite, could anyone tell me a bit
: about them, and which one to use (they are huge, and I'm forced to use
: a SLIP-link to download).  Anyone got any ideas how to tell gcc to
: create 586-code (-586, -pentium...)?  Can the kernel be compiled using
: pentium-optimization?  

There is switch -mpentium and new optimization flags -O3 and -O4.

I have very bad expirience with switch -O4, sometimes breaks generated
code resulting to "segmentation fault".

: How much (on average) will my code speed up (if at all)?  10%  More/less?

Special programs like FFT, CRC checking  - ~2 times, average 30%.

LAco

 
 
 

Pentium-optimized gcc

Post by Albert Cahal » Wed, 19 Jul 1995 04:00:00


J> I'd like to know if there is a Pentium-optimized version of gcc around
J> somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't make
J> optimized code.  Or am I wrong here?

An easy way to get faster code would be to optimize for the 386 instead
of the 486.  It will be faster because it will not put in junk to align
jump destinations.  (Which fills your cache with junk?)
--

Albert Cahalan

 
 
 

Pentium-optimized gcc

Post by Laco Rusn » Wed, 19 Jul 1995 04:00:00



: J> I'd like to know if there is a Pentium-optimized version of gcc around
: J> somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't make
: J> optimized code.  Or am I wrong here?

: An easy way to get faster code would be to optimize for the 386 instead
: of the 486.  It will be faster because it will not put in junk to align
: jump destinations.  (Which fills your cache with junk?)
: --

Super! And using 286 optimization you will get reordered instructions to
avoid dependencies between them...

LAco

 
 
 

Pentium-optimized gcc

Post by Albert Cahal » Wed, 19 Jul 1995 04:00:00


L>:> I'd like to know if there is a Pentium-optimized version of gcc around
L>:> somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't
L>:> make optimized code.  Or am I wrong here?

L>: An easy way to get faster code would be to optimize for the 386 instead
L>: of the 486.  It will be faster because it will not put in junk to align
L>: jump destinations.  (Which fills your cache with junk?)

L> Super! And using 286 optimization you will get reordered instructions to
L> avoid dependencies between them...

Try it before you laugh, someone benchmarked this.  The Pentium does not
have problems with unaligned jump instructions, and your code will be
_slower_ if you specify -m486 instead of -m386.
--

Albert Cahalan

 
 
 

Pentium-optimized gcc

Post by Laco Rusn » Thu, 20 Jul 1995 04:00:00



: L>: An easy way to get faster code would be to optimize for the 386 instead
: L>: of the 486.  It will be faster because it will not put in junk to align
: L>: jump destinations.  (Which fills your cache with junk?)

: L> Super! And using 286 optimization you will get reordered instructions to
: L> avoid dependencies between them...

: Try it before you laugh, someone benchmarked this.  The Pentium does not
: have problems with unaligned jump instructions, and your code will be
: _slower_ if you specify -m486 instead of -m386.

Sorry.

You may be right. I am not able to make benchmarks, because my
i486-linux/2.7.0 compiller with switch -m386 generates the same code as
-m486. But what about complex instructions sometimes generated by -m386
"optimizer" like movsb...?

Other thing for public discussion. I have made some comparisons how gcc
optimizes this code:

p=0; r=0; q=8; s=0;
for (i=0; i<MAX; i++)
{ p=q+i; r=q+(i>>1); s+=p+r; }
use s

without -O switch both -m486 and -mpentium: 486: 28 clocks
                                            586: 17 clocks
with -O4 -m486: 486: 13 clocks
                586: 10 clocks

with -O4 -mpentium: 486: 14 clocks
                    586: 7 clocks

Note: in the last case instructions was perfectly paired and no memory
referencies was used.
It is special part of code, in real life the differecies are not so big.

I believe, that now is clear how is _real_ pentium optimization important and
sorry, if it is not your opinion.

LAco

 
 
 

Pentium-optimized gcc

Post by C. Montgome » Fri, 21 Jul 1995 04:00:00



|>
|> I'd like to know if there is a Pentium-optimized version of gcc around
|> somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't
|> make optimized code.  Or am I wrong here?
|>
|> I found two new versions of gcc on sunsite, could anyone tell me a bit
|> about them, and which one to use (they are huge, and I'm forced to use
|> a SLIP-link to download).  Anyone got any ideas how to tell gcc to
|> create 586-code (-586, -pentium...)?  Can the kernel be compiled using
|> pentium-optimization?  
|>
|> How much (on average) will my code speed up (if at all)?  10%  More/less?
|>
|> These are the files found on sunsite, and the latter seems to be the one
|> for me :
|>
|> -rw-rw-r--   1 11    20    2033426 Jul 15 22:36 gcc-2.7.0.bin.aout.tar.gz
|> -rw-rw-r--   1 11    20    1030606 Jul 12 11:44 gcc-i586.tar.gz

I do not recommend that you use 'gcc-i586.tar.gz'; it is a demo version of 2.5.8
that Intel modified for the pentium (i2.5.8p).  The Pentium optimizations in this
version often produce non functional code.  It will compile the kernel, but if
you turn on Pentium optimizations, the kernel will not boot.

2.7.0 does implement Pentium ops, but it does it in such a way as to reorder
operations such that they happen to work better on the pentium.  It does not
include any pentium switches, but does take the pentium into account.  This
version will compile a valid kernel with optimizations cranked all the way up
(-O6).

Monty

 
 
 

Pentium-optimized gcc

Post by Clint Ols » Fri, 21 Jul 1995 04:00:00





>|>
>|> I'd like to know if there is a Pentium-optimized version of gcc around
>|> somewhere?  I have a Pentium and as far as I know gcc 2.6.3 doesn't
>|> make optimized code.  Or am I wrong here?
>|>
>|> I found two new versions of gcc on sunsite, could anyone tell me a bit
>|> about them, and which one to use (they are huge, and I'm forced to use
>|> a SLIP-link to download).  Anyone got any ideas how to tell gcc to
>|> create 586-code (-586, -pentium...)?  Can the kernel be compiled using
>|> pentium-optimization?  
>|>
>|> How much (on average) will my code speed up (if at all)?  10%  More/less?
>|>
>|> These are the files found on sunsite, and the latter seems to be the one
>|> for me :
>|>
>|> -rw-rw-r--   1 11    20    2033426 Jul 15 22:36 gcc-2.7.0.bin.aout.tar.gz
>|> -rw-rw-r--   1 11    20    1030606 Jul 12 11:44 gcc-i586.tar.gz

>I do not recommend that you use 'gcc-i586.tar.gz'; it is a demo version of 2.5.8
>that Intel modified for the pentium (i2.5.8p).  The Pentium optimizations in this
>version often produce non functional code.  It will compile the kernel, but if
>you turn on Pentium optimizations, the kernel will not boot.

>2.7.0 does implement Pentium ops, but it does it in such a way as to reorder
>operations such that they happen to work better on the pentium.  It does not
>include any pentium switches, but does take the pentium into account.  This
>version will compile a valid kernel with optimizations cranked all the way up
>(-O6).

Actually, the original Intel-modified version was i2.4.0.  Someone was
nice enough to apply patches by hand to get it up to 2.6.3.  Too bad
that it produces semi-flaky code for any optimization other than -O2.

-Clint

 
 
 

Pentium-optimized gcc

Post by alex korob » Fri, 21 Jul 1995 04:00:00


: Actually, the original Intel-modified version was i2.4.0.  Someone was
: nice enough to apply patches by hand to get it up to 2.6.3.  Too bad
: that it produces semi-flaky code for any optimization other than -O2.

  That's because -O3 turns on additional optimizations that affect
  gcc's register reload and as it noted in README.iGCC reload1.c was
  completely rewritten for 2.6.x so Intel code wasn't valid anymore.

" - NOTE: I couldn't make one patch in reload1.c, the code it was supposed
    to patch had been completely rewritten, and I didn't know how to make
    the patch compatible with it. (I left reload1.c.rej in the directory
    in case anyone wants to take a look at it - and there is a comment
    with 'PROBLEM' in reload1.c where it should have gone so you can find
    it easily). "

 However that's not all, dpmi.c from dosemu wouldn't compile even with -O2.

Alex

 
 
 

Pentium-optimized gcc

Post by Valient Gou » Sat, 22 Jul 1995 04:00:00



: : Actually, the original Intel-modified version was i2.4.0.  Someone was
: : nice enough to apply patches by hand to get it up to 2.6.3.  Too bad
: : that it produces semi-flaky code for any optimization other than -O2.

:   That's because -O3 turns on additional optimizations that affect
:   gcc's register reload and as it noted in README.iGCC reload1.c was
:   completely rewritten for 2.6.x so Intel code wasn't valid anymore.

: " - NOTE: I couldn't make one patch in reload1.c, the code it was supposed
:     to patch had been completely rewritten, and I didn't know how to make
:     the patch compatible with it. (I left reload1.c.rej in the directory
:     in case anyone wants to take a look at it - and there is a comment
:     with 'PROBLEM' in reload1.c where it should have gone so you can find
:     it easily). "

:  However that's not all, dpmi.c from dosemu wouldn't compile even with -O2.
:  
: Alex

  I looked at reload1.c again a while ago, and I did find a place to put in
the patch (with minor changes)... but that didn't seem to fix any problems
by itself.  Someone else (the person who made the patches to i2.5.8?)
found a place where a variable could be used un-initialized in some
cases.  Fixing that, and removing a couple -O3 optimization defaults, I
now have gcc-i2.6.3 working everywhere with -O3 -mpentium.  I've been
compiling my entire system that way (including the kernel). This weekend,
I'll download a clean copy of gcc-i2.6.3 and upload a patch to sunsite.

Val


 
 
 

Pentium-optimized gcc

Post by Valient Gou » Sun, 23 Jul 1995 04:00:00



: : Actually, the original Intel-modified version was i2.4.0.  Someone was
: : nice enough to apply patches by hand to get it up to 2.6.3.  Too bad
: : that it produces semi-flaky code for any optimization other than -O2.

:   That's because -O3 turns on additional optimizations that affect
:   gcc's register reload and as it noted in README.iGCC reload1.c was
:   completely rewritten for 2.6.x so Intel code wasn't valid anymore.

 I've uploaded a small patch that fixes problems with -O2 and -O3 -mpentium.  
I still wouldn't suggest -O4 though.  It can be found at:
 sunsite.unc.edu:/pub/Linux/incoming/gcc-i2.6.3-O3patch.{lsm,gz}, until it
finds a home in pub/Linux/devel/c.
 It's only a little over 1K, so if you're using gcc-i2.6.3, I'd suggest
grabbing it.

regards,
Val



 
 
 

Pentium-optimized gcc

Post by Marc E. Christense » Tue, 25 Jul 1995 04:00:00


Just a note, the lsm entry is not correct for this patch.  It is only the
unmodified lsm example.  Just wanted to let you know so you could upload a new
lsm entry.

--
           _/_/_/       Salt Lake Linux Users Group     _/_/_/
          _/_/*/_/_/|    _ http://www.sllug.org __     _/_/*/_/_/|
         _/_/_/_/_/|/   / __/ /  / /  / / / / ___/    _/_/_/_/_/|/
        _/_/_/_/_/|/   _\ \/ /__/ /__/ /_/ / (_ /    _/_/_/_/_/|/
       _/_/_/_/_/|/   /___/____/____/\____/\___/    _/_/_/_/_/|/

          Marc Christensen - Director of Public Relations

 
 
 

Pentium-optimized gcc

Post by Valient Gou » Wed, 26 Jul 1995 04:00:00



: Just a note, the lsm entry is not correct for this patch.  It is only the
: unmodified lsm example.  Just wanted to let you know so you could upload a new
: lsm entry.

  It should be better now.  Somehow I managed to delete the copy I changed
and upload the original...  hope I sent the right patch. :)

Val

 
 
 

1. Pentium-optimized gcc

I asked some time ago about a 'gcc' that could optimize for pentium and
gor the answer that there is a package around called 'gcc-i2.6.3'.  
Haven't been able to find such a package, only 'gcc-2.7.0'.  

Can anybody tell me if 2.7.0 allows me to use -m586 or -mpentium?  
Don't want to download the *huge* 2.7.0 just to find out that it doesn't
support pentium any more than my present 2.6.3 (not i2.6.3).

I'd appreciate any hints!

--
 Jan 'Chakie' Ekholm      \   CS at Abo Akademi University, Turku, Finland


http://www.abo.fi/~jekholm\          Linux Inside since fall '94.

2. pppoe problems

3. Pentium optimizing Gcc

4. Is there a Linux able to install to large IDE ?

5. Can't compile pentium optimized gcc - 2nd Post

6. Neww CPU, swap, mem monitor

7. Pentium Optimized GCC

8. Using Linux modem access from W95 - is it possible?

9. Pentium Optimized GCC And linux

10. Pentium Optimized GCC & Kernel

11. Pentium Optimized gcc

12. Pentium Optimized GCC

13. Pentium-optimizing gcc