[5/5] include tuning options into Makefile

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

2 messages, 2 authors, 2008-07-21 · open the first message on its own page

[5/5] include tuning options into Makefile

From: Marvin <marvin24@gmx.de>
Date: 2008-07-21 07:05:46

This patch finally adds mcpu/mtune options to the Makefile using the
previous introduced tuning mechanism.

Subject: [PATCH] include tuning options into Makefile

---
 arch/powerpc/Makefile |   41 +++++++++++++++++++++++------------------
 1 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 9629c5e..09f81a7 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -75,30 +75,35 @@ CPP		= $(CC) -E $(KBUILD_CFLAGS)
 CHECKFLAGS	
+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
 
 ifeq ($(CONFIG_PPC64),y)
-GCC_BROKEN_VEC	:= $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; 
fi)
 
-ifeq ($(CONFIG_TUNE_POWER4),y)
-ifeq ($(CONFIG_OPT_EXCLUSIVE),y)
-ifeq ($(CONFIG_ALTIVEC),y)
-ifeq ($(GCC_BROKEN_VEC),y)
-	KBUILD_CFLAGS += $(call cc-option,-mcpu=970)
+ifeq ($(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi),y)
+    P4CPU := power4
 else
-	KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
+    P4CPU := 970
 endif
-else
-	KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
-endif
-else
-	KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
-endif
-	KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
+
+# optimize for specific cpu
+ifeq ($(CONFIG_TUNE_RS64),y)
+    KBUILD_CFLAGS += $(call cc-option,-mcpu=rs64)
+else ifeq ($(CONFIG_TUNE_POWER3),y)
+    KBUILD_CFLAGS += $(call cc-option,-mcpu=power3)
+else ifeq ($(CONFIG_TUNE_POWER4),y)
+    KBUILD_CFLAGS += $(call cc-option,-mcpu=$(P4CPU))
+else ifeq ($(CONFIG_TUNE_CELL),y)
+    KBUILD_CFLAGS += $(call cc-option,-mcpu=cell,-mtune=cell)
+else ifeq ($(CONFIG_TUNE_POWER5),y)
+    KBUILD_CFLAGS += $(call cc-option,-mcpu=power5,-mtune=power5)
+else ifeq ($(CONFIG_TUNE_POWER6),y)
+    KBUILD_CFLAGS += $(call cc-option,-mcpu=power6,-mtune=power6)
 endif
-else
-LDFLAGS_MODULE	+= arch/powerpc/lib/crtsavres.o
+
+ifneq ($(CONFIG_OPT_EXCLUSIVE),y)
+    KBUILD_CFLAGS := $(subst mcpu,mtune,$(KBUILD_CFLAGS))
 endif
 
-ifeq ($(CONFIG_TUNE_CELL),y)
-	KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
+else
+# !PPC64
+    LDFLAGS_MODULE	+= arch/powerpc/lib/crtsavres.o
 endif
 
 # No AltiVec instruction when building kernel
-- 
1.5.6.2

Re: [5/5] include tuning options into Makefile

From: Arnd Bergmann <arnd@arndb.de>
Date: 2008-07-21 09:56:02

On Monday 21 July 2008, Marvin wrote:
+# optimize for specific cpu
+ifeq ($(CONFIG_TUNE_RS64),y)
+ =A0 =A0KBUILD_CFLAGS +=3D $(call cc-option,-mcpu=3Drs64)
+else ifeq ($(CONFIG_TUNE_POWER3),y)
+ =A0 =A0KBUILD_CFLAGS +=3D $(call cc-option,-mcpu=3Dpower3)
+else ifeq ($(CONFIG_TUNE_POWER4),y)
+ =A0 =A0KBUILD_CFLAGS +=3D $(call cc-option,-mcpu=3D$(P4CPU))
+else ifeq ($(CONFIG_TUNE_CELL),y)
+ =A0 =A0KBUILD_CFLAGS +=3D $(call cc-option,-mcpu=3Dcell,-mtune=3Dcell)
+else ifeq ($(CONFIG_TUNE_POWER5),y)
+ =A0 =A0KBUILD_CFLAGS +=3D $(call cc-option,-mcpu=3Dpower5,-mtune=3Dpowe=
r5)
+else ifeq ($(CONFIG_TUNE_POWER6),y)
+ =A0 =A0KBUILD_CFLAGS +=3D $(call cc-option,-mcpu=3Dpower6,-mtune=3Dpowe=
r6)
=A0endif
-else
-LDFLAGS_MODULE=A0+=3D arch/powerpc/lib/crtsavres.o
I think it would be easier to express this logic in Kconfig than in
Makefile.
+
+ifneq ($(CONFIG_OPT_EXCLUSIVE),y)
+ =A0 =A0KBUILD_CFLAGS :=3D $(subst mcpu,mtune,$(KBUILD_CFLAGS))
=A0endif
=A0
This still doesn't allow the most interesting case where you want to
optimize for a modern CPU but still allow older ones, e.g.
"-mcpu=3Dpower4 -mtune=3Dpower6".

	Arnd <><
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help