[NEW PATCH] Using '-mpentium' or '-mpentiumpro' with egcs/gcc-2.8.x

Niels Kristian Bech Jensen (nkbj@image.dk)
Fri, 15 May 1998 10:32:58 +0200 (CEST)

On Thu, 14 May 1998, Prasong Aroonruviwat wrote:

> On Thu, 14 May 1998, Niels Kristian Bech Jensen wrote:
> > Hi,
> > This small patch detects if you use a compiler that supports the
> > '-mpentium' and '-mpentiumpro' compiler flags and use the relevant flag
> > for building the kernel. I haven't tested it with gcc-2.7.* compilers, so
> > please let me know if it works.
> >
> > All comments are welcome.
> Is only '-mpentium' or '-mpentium' enough ?, I want to know about
> -malign-xxxx=2 is important or not if I use gcc-2.8.x or egcs as my
> compiler ?
> Hope to see your reply ?
The '-malign-*' flags might get the kernel to run faster, so I've included
them in this new patch. I've also switched from '-m?86' to '-march=i?86'
to get processor-specific optimizations/instructions. The third new thing
is that I've removed the '-fno-strength-reduce' flag for the newer
compilers (the strength-reduce bug has been fixed.)

diff -urN linux-2.1.102/arch/i386/Makefile linux/arch/i386/Makefile
--- linux-2.1.102/arch/i386/Makefile Sat May 9 05:32:37 1998
+++ linux/arch/i386/Makefile Fri May 15 10:14:00 1998
@@ -13,6 +13,8 @@
# Copyright (C) 1994 by Linus Torvalds

+CC_MAJOR_VERSION := $(shell $(CC) -v 2>&1 | tail -1 | cut -b 13-15)
AS86 =$(CROSS_COMPILE)as86 -0 -a
AS386 =$(CROSS_COMPILE)as86 -3
LD86 =$(CROSS_COMPILE)ld86 -0
@@ -25,22 +27,38 @@

CFLAGS_PIPE := -pipe
CFLAGS_NSR := -fno-strength-reduce

ifdef CONFIG_M386
-CFLAGS := $(CFLAGS) -m386 -DCPU=386
+ifeq ($(CC_MAJOR_VERSION),2.7)
+CFLAGS := $(CFLAGS) $(CFLAGS_NSR) -m386 -DCPU=386
+CFLAGS := $(CFLAGS) -march=i386 -DCPU=386

ifdef CONFIG_M486
-CFLAGS := $(CFLAGS) -m486 -DCPU=486
+ifeq ($(CC_MAJOR_VERSION),2.7)
+CFLAGS := $(CFLAGS) $(CFLAGS_NSR) -m486 -DCPU=486
+CFLAGS := $(CFLAGS) -march=i486 -DCPU=486

ifdef CONFIG_M586
-CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
+ifeq ($(CC_MAJOR_VERSION),2.7)
+CFLAGS := $(CFLAGS) $(CFLAGS_NSR) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
+CFLAGS := $(CFLAGS) -march=pentium -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586

ifdef CONFIG_M686
-CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
+ifeq ($(CC_MAJOR_VERSION),2.7)
+CFLAGS := $(CFLAGS) $(CFLAGS_NSR) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
+CFLAGS := $(CFLAGS) -march=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686

ifdef SMP

Med venlig hilsen / Best regards
Niels Kristian Bech Jensen                       http://www.image.dk/~nkbj/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu