2001-12-17 15:00:21

by Neal Becker

[permalink] [raw]
Subject: Why no -march=athlon?

I noticed that linux/arch/i386/Makefile says:

ifdef CONFIG_MK7
CFLAGS += -march=i686 -malign-functions=4
endif


Why not -march=athlon? Is this just for compatibility with old gcc?
If so, can't we fix it with an ifdef?


2001-12-17 15:54:58

by Dominik Mierzejewski

[permalink] [raw]
Subject: Re: Why no -march=athlon?

On Monday, 17 December 2001, [email protected] wrote:
> I noticed that linux/arch/i386/Makefile says:
>
> ifdef CONFIG_MK7
> CFLAGS += -march=i686 -malign-functions=4
> endif

Hm. As long as I can remember, 2.4 has always had this:
ifdef CONFIG_MK7
CFLAGS += $(shell if $(CC) -march=athlon -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon"; else echo "-march=i686 -malign-functions=4"; fi)
endif

Perhaps you're describing a 2.2 kernel?

--
"The Universe doesn't give you any points for doing things that are easy."
-- Sheridan to Garibaldi in Babylon 5:"The Geometry of Shadows"
Dominik 'Rathann' Mierzejewski <rathann(at)we.are.one.pl>

2001-12-17 17:40:46

by M. R. Brown

[permalink] [raw]
Subject: Re: Why no -march=athlon?

* [email protected] <[email protected]> on Mon, Dec 17, 2001:

> I noticed that linux/arch/i386/Makefile says:
>
> ifdef CONFIG_MK7
> CFLAGS += -march=i686 -malign-functions=4
> endif
>
>
> Why not -march=athlon? Is this just for compatibility with old gcc?

The recommend kernel compiler is gcc 2.95.x, which doesn't support
"-march=athlon".

> If so, can't we fix it with an ifdef?

Can you fix it? You'd have to parse the output of `gcc -v`, I think
kbuild 2.5 does this, so start there first.

M. R.


Attachments:
(No filename) (508.00 B)
(No filename) (189.00 B)
Download all attachments

2001-12-19 17:49:41

by Benoit Poulot-Cazajous

[permalink] [raw]
Subject: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

"M. R. Brown" <[email protected]> writes:

> * [email protected] <[email protected]> on Mon, Dec 17, 2001:
>
> > I noticed that linux/arch/i386/Makefile says:
> >
> > ifdef CONFIG_MK7
> > CFLAGS += -march=i686 -malign-functions=4
> > endif
> >
> >
> > Why not -march=athlon? Is this just for compatibility with old gcc?
>
> The recommend kernel compiler is gcc 2.95.x, which doesn't support
> "-march=athlon".

But gcc-2.95,x _supports_ "-march=k6", and we should use that instead of
"-march-i686".

Obvious patch for 2.4.16 :

--- linux-2.4.16/arch/i386/Makefile Thu Apr 12 21:20:31 2001
+++ linux-2.4.16-bpc/arch/i386/Makefile Sun Dec 16 15:44:06 2001
@@ -63,7 +63,7 @@
endif

ifdef CONFIG_MK7
-CFLAGS += $(shell if $(CC) -march=athlon -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon"; else echo "-march=i686 -malign-functions=4"; fi)
+CFLAGS += $(shell if $(CC) -march=athlon -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon"; elif $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6 -malign-functions=4"; else echo "-march=i686 -malign-functions=4"; fi)
endif

ifdef CONFIG_MCRUSOE

I have tested this change, using 3 steps of the ChorusOS compilation
as benchmarks (The test first bootstrap gcc, then compiles various
cross-compilers in parallel and then uses them to build ChorusOS for
various architectures). On my XP1800+, it gives :

before the patch :
1017.92user 261.80system 24:39.89elapsed 86%CPU
706.33user 160.79system 16:23.61elapsed 88%CPU
1787.38user 418.76system 43:35.97elapsed 84%CPU

after the patch :
1018.42user 253.85system 24:44.68elapsed 85%CPU
704.89user 151.76system 16:16.14elapsed 87%CPU
1786.96user 410.76system 43:05.32elapsed 85%CPU

The improvement in system time is nice.

-- Benoit

2001-12-19 17:56:42

by M. R. Brown

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

* Benoit Poulot-Cazajous <[email protected]> on Wed, Dec 19, 2001:

>
> But gcc-2.95,x _supports_ "-march=k6", and we should use that instead of
> "-march-i686".
>

No, k6 != athlon. IIRC, the i686 optimization is closer to the Athlon than
the k6 opt.

>
> before the patch :
> 1017.92user 261.80system 24:39.89elapsed 86%CPU
> 706.33user 160.79system 16:23.61elapsed 88%CPU
> 1787.38user 418.76system 43:35.97elapsed 84%CPU
>
> after the patch :
> 1018.42user 253.85system 24:44.68elapsed 85%CPU
> 704.89user 151.76system 16:16.14elapsed 87%CPU
> 1786.96user 410.76system 43:05.32elapsed 85%CPU
>
> The improvement in system time is nice.
>

Er, there's not much difference...

Curious, what happens when you compile using gcc 3.0.1 against
-march=athlon?

M. R.


Attachments:
(No filename) (772.00 B)
(No filename) (189.00 B)
Download all attachments

2001-12-19 18:39:55

by Neal Becker

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

>>>>> "M" == M R Brown <[email protected]> writes:


M> Curious, what happens when you compile using gcc 3.0.1 against
M> -march=athlon?

Is it safe to use gcc-3.0.2 to compile the kernel?

2001-12-19 18:48:07

by M. R. Brown

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

* [email protected] <[email protected]> on Wed, Dec 19, 2001:

> >>>>> "M" == M R Brown <[email protected]> writes:
>
>
> M> Curious, what happens when you compile using gcc 3.0.1 against
> M> -march=athlon?
>
> Is it safe to use gcc-3.0.2 to compile the kernel?

Absolutely not. There was at least one reported ICE (internal compiler
error) with drivers/net/8139too.c. Stick to the 2.95.x series.

M. R.


Attachments:
(No filename) (415.00 B)
(No filename) (189.00 B)
Download all attachments

2001-12-19 18:54:07

by jjs

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

"M. R. Brown" wrote:

> * [email protected] <[email protected]> on Wed, Dec 19, 2001:
>
> > Is it safe to use gcc-3.0.2 to compile the kernel?
>
> Absolutely not. There was at least one reported ICE (internal compiler
> error) with drivers/net/8139too.c. Stick to the 2.95.x series.

BTW 2.96 is fine also -

cu

jjs

2001-12-19 19:01:56

by Josh McKinney

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

On approximately Wed, Dec 19, 2001 at 10:52:40AM -0800, J Sloan wrote:
> "M. R. Brown" wrote:
>
> > * [email protected] <[email protected]> on Wed, Dec 19, 2001:
> >
> > > Is it safe to use gcc-3.0.2 to compile the kernel?

Just another side note, gcc-3.0.3 prerelease is out, and it compiles kernels fine here so far.

Josh
--
Linux, the choice | Ever feel like life was a game and you had
of a GNU generation -o) | the wrong instruction book?
Kernel 2.4.17-rc2 /\ |
on a i586 _\_v |
|

2001-12-19 19:28:51

by jjs

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

"M. R. Brown" wrote:

> There is no 2.96 except the Red Hat maintained version of GCC

IIRC mandrake ships it also -

> but if
> you're saying that Red Hat's compiler works, more power to you.

Not only me, but such notables as Alan Cox -

It's a fine compiler, and I'm a bit puzzled at the
anti-gcc-2.96 hysteria - aside from some initial
bugs (quickly fixed) in the old guiness release.

Here's a heads-up for those interested -

http://www.bero.org/gcc296.html

Regards,

jjs


2001-12-19 19:22:10

by M. R. Brown

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

* J Sloan <[email protected]> on Wed, Dec 19, 2001:

> "M. R. Brown" wrote:
>
> > * [email protected] <[email protected]> on Wed, Dec 19, 2001:
> >
> > > Is it safe to use gcc-3.0.2 to compile the kernel?
> >
> > Absolutely not. There was at least one reported ICE (internal compiler
> > error) with drivers/net/8139too.c. Stick to the 2.95.x series.
>
> BTW 2.96 is fine also -
>

There is no 2.96 except the Red Hat maintained version of GCC, but if
you're saying that Red Hat's compiler works, more power to you.

M. R.


Attachments:
(No filename) (522.00 B)
(No filename) (189.00 B)
Download all attachments

2001-12-19 19:41:13

by Allan Sandfeld

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

On Wednesday 19 December 2001 19:39, [email protected] wrote:
> >>>>> "M" == M R Brown <[email protected]> writes:
>
> M> Curious, what happens when you compile using gcc 3.0.1 against
> M> -march=athlon?
>
> Is it safe to use gcc-3.0.2 to compile the kernel?
>
If it compiles.. Otherwise use gcc-3.0.3(prerelease), it has fixes that makes
the _current_ kernel compile.
<sarcasm>
Obviously it's still full of bugs, it wouldn't really be gcc if it wasn't.
</sarcasm>

I am currently running a linux-2.4.16-gcc3, where the only changed part is
the use of the gcc-3.0 compiler, and a -foptimize-siblings-calls flag. It's
running smoothly, although I havn't done any performance test yet.

Btw. I havent found anything that compiles with gcc-3.1 yet.

2001-12-19 20:22:40

by DervishD

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

Hello all :))

>> Is it safe to use gcc-3.0.2 to compile the kernel?
>If it compiles.. Otherwise use gcc-3.0.3(prerelease), it has fixes that makes
>the _current_ kernel compile.

I've using gcc-3.0.1 to compile the kernel since it was released
and my linux 2.4.16 runs without problems. In my experience, the only
problem is the ICE raised by the 8139too driver, although this seems
to have been corrected on gcc-3.0.2 (I haven't updated my compiler
yet). I haven't found any bug yet running my linux box, but this
doesn't mean that gcc-3.0 is safe for the kernel. It's safe for my
configuration of the kernel, at least.

Ra?l

2001-12-19 21:44:02

by Benoit Poulot-Cazajous

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

"M. R. Brown" <[email protected]> writes:

> * Benoit Poulot-Cazajous <[email protected]> on Wed, Dec 19, 2001:
>
> >
> > But gcc-2.95,x _supports_ "-march=k6", and we should use that instead of
> > "-march-i686".
> >
>
> No, k6 != athlon. IIRC, the i686 optimization is closer to the Athlon than
> the k6 opt.

In theory, you may be right. But gcc-2.95.3 may not follow the theory.

> > before the patch :
> > 1017.92user 261.80system 24:39.89elapsed 86%CPU
> > 706.33user 160.79system 16:23.61elapsed 88%CPU
> > 1787.38user 418.76system 43:35.97elapsed 84%CPU
> >
> > after the patch :
> > 1018.42user 253.85system 24:44.68elapsed 85%CPU
> > 704.89user 151.76system 16:16.14elapsed 87%CPU
> > 1786.96user 410.76system 43:05.32elapsed 85%CPU
> >
> > The improvement in system time is nice.
> >
>
> Er, there's not much difference...

>From 261.80 to 253.85 => -3%
>From 160.79 to 151.76 => -6%
>From 418.76 to 410.76 => -2%

So the kernel looks between 2 and 6% faster. Not so bad for a one-line
patch ;-)

> Curious, what happens when you compile using gcc 3.0.1 against
> -march=athlon?

Yep, I will try with gcc 3.0.3.

-- Benoit

2001-12-20 00:06:07

by Alessandro Suardi

[permalink] [raw]
Subject: Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

Ra?l N??ez de Arenas Coronado wrote:
>
> Hello all :))
>
> >> Is it safe to use gcc-3.0.2 to compile the kernel?
> >If it compiles.. Otherwise use gcc-3.0.3(prerelease), it has fixes that makes
> >the _current_ kernel compile.
>
> I've using gcc-3.0.1 to compile the kernel since it was released
> and my linux 2.4.16 runs without problems. In my experience, the only
> problem is the ICE raised by the 8139too driver, although this seems
> to have been corrected on gcc-3.0.2 (I haven't updated my compiler
> yet). I haven't found any bug yet running my linux box, but this
> doesn't mean that gcc-3.0 is safe for the kernel. It's safe for my
> configuration of the kernel, at least.

Been compiling my kernel with 3.0.2 since the day it was out and have
found no bugs so far. Raul's disclaimer applies in my case too - of
course.

--alessandro

"we live as we dream alone / to break the spell we mix with the others
we were not born in isolation / but sometimes it seems that way"
(R.E.M., live intro to 'World Leader Pretend')