[PATCH 2.4/2.5] Athlon CFLAGS

From: Daniel Mehrmann (daniel.mehrmann@gmx.de)
Date: Sun Sep 08 2002 - 14:28:11 EST


Hi Alan,

i add for the AMD Athlon family some optimize compilerflags.
Gcc 3.1 and 3.2 support more specific Athlon instructions as 3.0 or 2.95x.
This patch for 2.4.19, 2.4.20-pre5 and 2.5.33 set a new "-march" flag:

Athlon TB/Duron += -march=athlon-tbird
Athlon XP/Athlon4/Duron += -march=athlon-xp
Athlon MP += -march=athlon-mp

It tests the possible flags and if it`s fail we made a downgrade to "-march=athlon" or "-march=i686".
So we can use gcc 2.95x and 3.0 without any problems :-)

I add this in the configmenu and documentation.

i made serval tests with my compilers and it looks like good. LMBENCH 2.0 said it`s a little bit faster as before :-))

I think it allso a good step for the furture of the kernel, because we can now specific more cpu feature in config.in and support
all gcc features.

I hope this patch is nice for you.

chears,
Daniel

2.4.19:

diff -Pur linux-2.4.19.orig/Documentation/Configure.help linux-2.4.19/Documentation/Configure.help
--- linux-2.4.19.orig/Documentation/Configure.help 2002-08-03 02:39:42.000000000 +0200
+++ linux-2.4.19/Documentation/Configure.help 2002-09-08 19:31:31.000000000 +0200
@@ -3963,7 +3963,11 @@
      and Celerons based on the Coppermine core.
    - "Pentium-4" for the Intel Pentium 4.
    - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).
- - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird).
+ - "Atlon-TB" for the AMD Athlon Thunderbird
+ and Durons based on the Splitfire core.
+ - "Athlon-XP" for the AMD AthlonXP
+ and Mobile and Durons based on Morgan core.
+ - "Athlon-MP" for the AMD AthlonMP
    - "Elan" for the AMD Elan family (Elan SC400/SC410).
    - "Crusoe" for the Transmeta Crusoe series.
    - "Winchip-C6" for original IDT Winchip.
diff -Pur linux-2.4.19.orig/arch/i386/Makefile linux-2.4.19/arch/i386/Makefile
--- linux-2.4.19.orig/arch/i386/Makefile 2001-04-12 21:20:31.000000000 +0200
+++ linux-2.4.19/arch/i386/Makefile 2002-09-08 18:58:38.000000000 +0200
@@ -62,10 +62,17 @@
 CFLAGS += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
 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)
+ifdef CONFIG_MATHLONTB
+CFLAGS += $(shell if $(CC) -march=athlon-tbird -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-tbird"; elif $(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

+ifdef CONFIG_MATHLONXP
+CFLAGS += $(shell if $(CC) -march=athlon-xp -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-xp"; elif $(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
+
+ifdef CONFIG_MATHLONMP
+CFLAGS += $(shell if $(CC) -march=athlon-mp -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-mp"; elif $(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
 ifdef CONFIG_MCRUSOE
 CFLAGS += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
 endif
diff -Pur linux-2.4.19.orig/arch/i386/config.in linux-2.4.19/arch/i386/config.in
--- linux-2.4.19.orig/arch/i386/config.in 2002-08-03 02:39:42.000000000 +0200
+++ linux-2.4.19/arch/i386/config.in 2002-09-08 19:16:05.000000000 +0200
@@ -36,7 +36,9 @@
         Pentium-III/Celeron(Coppermine) CONFIG_MPENTIUMIII \
         Pentium-4 CONFIG_MPENTIUM4 \
         K6/K6-II/K6-III CONFIG_MK6 \
- Athlon/Duron/K7 CONFIG_MK7 \
+ Athlon-TB/Duron(Splitfire) CONFIG_MATHLONTB \
+ Athlon-XP/Athlon4/Duron(Morgan) CONFIG_MATHLONXP \
+ Athlon-MP CONFIG_MATHLONMP \
         Elan CONFIG_MELAN \
         Crusoe CONFIG_MCRUSOE \
         Winchip-C6 CONFIG_MWINCHIPC6 \
@@ -119,7 +121,23 @@
    define_bool CONFIG_X86_TSC y
    define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
 fi
-if [ "$CONFIG_MK7" = "y" ]; then
+if [ "$CONFIG_MATHLONTB" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 6
+ define_bool CONFIG_X86_TSC y
+ define_bool CONFIG_X86_GOOD_APIC y
+ define_bool CONFIG_X86_USE_3DNOW y
+ define_bool CONFIG_X86_PGE y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+fi
+if [ "$CONFIG_MATHLONXP" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 6
+ define_bool CONFIG_X86_TSC y
+ define_bool CONFIG_X86_GOOD_APIC y
+ define_bool CONFIG_X86_USE_3DNOW y
+ define_bool CONFIG_X86_PGE y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+fi
+if [ "$CONFIG_MATHLONMP" = "y" ]; then
    define_int CONFIG_X86_L1_CACHE_SHIFT 6
    define_bool CONFIG_X86_TSC y
    define_bool CONFIG_X86_GOOD_APIC y

2.4.20-pre5:

diff -Pur linux-2.4.20-pre5.orig/Documentation/Configure.help linux-2.4.20-pre5/Documentation/Configure.help
--- linux-2.4.20-pre5.orig/Documentation/Configure.help 2002-09-08 19:42:28.000000000 +0200
+++ linux-2.4.20-pre5/Documentation/Configure.help 2002-09-08 19:55:07.000000000 +0200
@@ -4106,7 +4106,11 @@
      and Celerons based on the Coppermine core.
    - "Pentium-4" for the Intel Pentium 4.
    - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).
- - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird).
+ - "Atlon-TB" for the AMD Athlon Thunderbird
+ and Durons based on the Splitfire core.
+ - "Athlon-XP" for the AMD AthlonXP
+ and Mobile and Durons based on Morgan core.
+ - "Athlon-MP" for the AMD AthlonMP
    - "Elan" for the AMD Elan family (Elan SC400/SC410).
    - "Crusoe" for the Transmeta Crusoe series.
    - "Winchip-C6" for original IDT Winchip.
diff -Pur linux-2.4.20-pre5.orig/arch/i386/Makefile linux-2.4.20-pre5/arch/i386/Makefile
--- linux-2.4.20-pre5.orig/arch/i386/Makefile 2001-04-12 21:20:31.000000000 +0200
+++ linux-2.4.20-pre5/arch/i386/Makefile 2002-09-08 20:10:33.000000000 +0200
@@ -62,8 +62,16 @@
 CFLAGS += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
 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)
+ifdef CONFIG_MATHLONTB
+CFLAGS += $(shell if $(CC) -march=athlon-tbird -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-tbird"; elif $(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
+
+ifdef CONFIG_MATHLONXP
+CFLAGS += $(shell if $(CC) -march=athlon-xp -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-xp"; elif $(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
+
+ifdef CONFIG_MATHLONMP
+CFLAGS += $(shell if $(CC) -march=athlon-mp -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-mp"; elif $(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

 ifdef CONFIG_MCRUSOE
diff -Pur linux-2.4.20-pre5.orig/arch/i386/config.in linux-2.4.20-pre5/arch/i386/config.in
--- linux-2.4.20-pre5.orig/arch/i386/config.in 2002-09-08 19:42:29.000000000 +0200
+++ linux-2.4.20-pre5/arch/i386/config.in 2002-09-08 20:14:56.000000000 +0200
@@ -35,7 +35,9 @@
         Pentium-III/Celeron(Coppermine) CONFIG_MPENTIUMIII \
         Pentium-4 CONFIG_MPENTIUM4 \
         K6/K6-II/K6-III CONFIG_MK6 \
- Athlon/Duron/K7 CONFIG_MK7 \
+ Athlon-TB/Duron(Splitfire) CONFIG_MATHLONTB \
+ Athlon-XP/Athlon4/Duron(Morgan) CONFIG_MATHLONXP \
+ Athlon-MP CONFIG_MATHLONMP \
         Elan CONFIG_MELAN \
         Crusoe CONFIG_MCRUSOE \
         Winchip-C6 CONFIG_MWINCHIPC6 \
@@ -126,7 +128,7 @@
    define_bool CONFIG_X86_HAS_TSC y
    define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
 fi
-if [ "$CONFIG_MK7" = "y" ]; then
+if [ "$CONFIG_MATHLONTB" = "y" ]; then
    define_int CONFIG_X86_L1_CACHE_SHIFT 6
    define_bool CONFIG_X86_HAS_TSC y
    define_bool CONFIG_X86_GOOD_APIC y
@@ -135,6 +137,23 @@
    define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
    define_bool CONFIG_X86_F00F_WORKS_OK y
 fi
+if [ "$CONFIG_MATHLONXP" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 6
+ define_bool CONFIG_X86_HAS_TSC y
+ define_bool CONFIG_X86_GOOD_APIC y
+ define_bool CONFIG_X86_USE_3DNOW y
+ define_bool CONFIG_X86_PGE y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+ define_bool CONFIG_X86_F00F_WORKS_OK y
+fi
+if [ "$CONFIG_MATHLONMP" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 6
+ define_bool CONFIG_X86_HAS_TSC y
+ define_bool CONFIG_X86_USE_3DNOW y
+ define_bool CONFIG_X86_PGE y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+ define_bool CONFIG_X86_F00F_WORKS_OK y
+fi
 if [ "$CONFIG_MELAN" = "y" ]; then
    define_int CONFIG_X86_L1_CACHE_SHIFT 4
    define_bool CONFIG_X86_USE_STRING_486 y

2.5.33:
diff -Pur linux-2.5.33.orig/arch/i386/Config.help linux-2.5.33/arch/i386/Config.help
--- linux-2.5.33.orig/arch/i386/Config.help 2002-09-01 00:04:49.000000000 +0200
+++ linux-2.5.33/arch/i386/Config.help 2002-09-08 20:43:40.000000000 +0200
@@ -411,7 +411,11 @@
      and Celerons based on the Coppermine core.
    - "Pentium-4" for the Intel Pentium 4.
    - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).
- - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird).
+ - "Atlon-TB" for the AMD Athlon Thunderbird
+ and Durons based on the Splitfire core.
+ - "Athlon-XP" for the AMD AthlonXP
+ and Mobile and Durons based on Morgan core.
+ - "Athlon-MP" for the AMD AthlonMP
    - "Crusoe" for the Transmeta Crusoe series.
    - "Winchip-C6" for original IDT Winchip.
    - "Winchip-2" for IDT Winchip 2.
diff -Pur linux-2.5.33.orig/arch/i386/Makefile linux-2.5.33/arch/i386/Makefile
--- linux-2.5.33.orig/arch/i386/Makefile 2002-09-01 00:04:55.000000000 +0200
+++ linux-2.5.33/arch/i386/Makefile 2002-09-08 20:27:06.000000000 +0200
@@ -61,10 +61,18 @@
 CFLAGS += $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
 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)
+ifdef CONFIG_MATHLONTB
+CFLAGS += $(shell if $(CC) -march=athlon-tbird -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-tbird"; elif $(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

+ifdef CONFIG_MATHLONXP
+CFLAGS += $(shell if $(CC) -march=athlon-xp -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-xp"; elif $(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
+
+ifdef CONFIG_MATHLONMP
+CFLAGS += $(shell if $(CC) -march=athlon-mp -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon-mp"; elif $(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
+
 ifdef CONFIG_MCRUSOE
 CFLAGS += -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
 endif
diff -Pur linux-2.5.33.orig/arch/i386/config.in linux-2.5.33/arch/i386/config.in
--- linux-2.5.33.orig/arch/i386/config.in 2002-09-01 00:04:55.000000000 +0200
+++ linux-2.5.33/arch/i386/config.in 2002-09-08 20:31:22.000000000 +0200
@@ -25,7 +25,9 @@
         Pentium-III/Celeron(Coppermine) CONFIG_MPENTIUMIII \
         Pentium-4 CONFIG_MPENTIUM4 \
         K6/K6-II/K6-III CONFIG_MK6 \
- Athlon/Duron/K7 CONFIG_MK7 \
+ Athlon-TB/Duron(Splitfire) CONFIG_MATHLONTB \
+ Athlon-XP/Athlon4/Duron(Morgan) CONFIG_MATHLONXP \
+ Athlon-MP CONFIG_MATHLONMP \
         Elan CONFIG_MELAN \
         Crusoe CONFIG_MCRUSOE \
         Winchip-C6 CONFIG_MWINCHIPC6 \
@@ -110,7 +112,21 @@
    define_bool CONFIG_X86_TSC y
    define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
 fi
-if [ "$CONFIG_MK7" = "y" ]; then
+if [ "$CONFIG_MATHLONTB" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 6
+ define_bool CONFIG_X86_TSC y
+ define_bool CONFIG_X86_GOOD_APIC y
+ define_bool CONFIG_X86_USE_3DNOW y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+fi
+if [ "$CONFIG_MATHLONXP" = "y" ]; then
+ define_int CONFIG_X86_L1_CACHE_SHIFT 6
+ define_bool CONFIG_X86_TSC y
+ define_bool CONFIG_X86_GOOD_APIC y
+ define_bool CONFIG_X86_USE_3DNOW y
+ define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+fi
+if [ "$CONFIG_MATHLONMP" = "y" ]; then
    define_int CONFIG_X86_L1_CACHE_SHIFT 6
    define_bool CONFIG_X86_TSC y
    define_bool CONFIG_X86_GOOD_APIC y







-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 15 2002 - 22:00:15 EST