Skip to contentSkip to conversation

Why no -march=athlon?

DISCUSSION [email protected] 8 participants 13 messages Dec 17, 2001 – Dec 19, 2001

lore
Share & tools
lore
#0 lore raw

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?

#1 lore raw
Quoted 5 lines · 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?

Signature · 3 lines
"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>
#2 lore raw
In reply to [email protected]

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

Quoted 8 lines

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

Quoted 1 line

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.

#3 lore raw

On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]
Quoted 9 lines · M. R. Brown

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

Quoted 7 lines

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

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

Quoted 4 lines
Quoted 1 line

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 :

arch/i386/Makefile +1 -1
@@ -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

#4 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]

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

Quoted 4 lines

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.

Quoted 6 lines

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

Quoted 7 lines

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.

#5 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"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?

#6 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]

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

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

#7 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]
Quoted 6 lines · M. R. Brown

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

Quoted 1 line

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

#8 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]
Quoted 5 lines · J Sloan
Quoted 3 lines · M. R. Brown

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

Quoted 1 line

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

Signature · 5 lines
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   | 
                                 | 
#9 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]

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

Quoted 11 lines
Quoted 6 lines · M. R. Brown

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

Quoted 1 line

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.

#10 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]
Quoted 1 line · M. R. Brown

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

IIRC mandrake ships it also -

Quoted 2 lines

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

#11 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]
Quoted 7 lines · On Wednesday 19 December 2001 19:39, [email protected] wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

#12 lore raw

Re: On K7, -march=k6 is good (Was Re: Why no -march=athlon?)

In reply to [email protected]
Quoted 9 lines · M. R. Brown

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

Quoted 4 lines

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.

Quoted 10 lines
Quoted 10 lines

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

Quoted 8 lines
Quoted 2 lines

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

Quoted 2 lines

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

Yep, I will try with gcc 3.0.3.

-- Benoit