Skip to contentSkip to conversation

CPU-dependent compiler/assembler options for optimization

U-Boot-Users Shinya Kuribayashi 2 participants 4 messages May 24, 2008 – May 25, 2008

lore
Share & tools
lore
#0 lore raw

We take the same options as Linux for now. This means that an ancient -mcpu support will be lost. Users need gcc 3.0.X or later.

---

 cpu/mips/config.mk |   38 +++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 7 deletions(-)
cpu/mips/config.mk +31 -7
index a173c54..8df5e23 100644
@@ -20,13 +20,6 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | cut -d. -f2)
-MIPSFLAGS:=$(shell \
-if [ "$v" -lt "14" ]; then \
-	echo "-mcpu=4kc"; \
-else \
-	echo "-march=4kc -mtune=4kc"; \
-fi)
 
 ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
 ENDIANNESS = -EL
@@ -37,3 +30,34 @@ endif
 MIPSFLAGS += $(ENDIANNESS)
 
 PLATFORM_CPPFLAGS += $(MIPSFLAGS)
+
+#
+# CPU-dependent compiler/assembler options for optimization.
+#
+cflags-$(CONFIG_CPU_R3000)	+= -march=r3000
+cflags-$(CONFIG_CPU_TX39XX)	+= -march=r3900
+cflags-$(CONFIG_CPU_R6000)	+= -march=r6000 -Wa,--trap
+cflags-$(CONFIG_CPU_R4300)	+= -march=r4300 -Wa,--trap
+cflags-$(CONFIG_CPU_VR41XX)	+= -march=r4100 -Wa,--trap
+cflags-$(CONFIG_CPU_R4X00)	+= -march=r4600 -Wa,--trap
+cflags-$(CONFIG_CPU_TX49XX)	+= -march=r4600 -Wa,--trap
+cflags-$(CONFIG_CPU_LOONGSON2)	+= -march=r4600 -Wa,--trap
+cflags-$(CONFIG_CPU_MIPS32_R1)	+= $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) -Wa,-mips32 -Wa,--trap
+cflags-$(CONFIG_CPU_MIPS32_R2)	+= $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) -Wa,-mips32r2 -Wa,--trap
+cflags-$(CONFIG_CPU_MIPS64_R1)	+= $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) -Wa,-mips64 -Wa,--trap
+cflags-$(CONFIG_CPU_MIPS64_R2)	+= $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) -Wa,-mips64r2 -Wa,--trap
+cflags-$(CONFIG_CPU_R5000)	+= -march=r5000 -Wa,--trap
+cflags-$(CONFIG_CPU_R5432)	+= $(call cc-option,-march=r5400,-march=r5000) -Wa,--trap
+cflags-$(CONFIG_CPU_R5500)	+= $(call cc-option,-march=r5500,-march=r5000) -Wa,--trap
+cflags-$(CONFIG_CPU_NEVADA)	+= $(call cc-option,-march=rm5200,-march=r5000) -Wa,--trap
+cflags-$(CONFIG_CPU_RM7000)	+= $(call cc-option,-march=rm7000,-march=r5000) -Wa,--trap
+cflags-$(CONFIG_CPU_RM9000)	+= $(call cc-option,-march=rm9000,-march=r5000) -Wa,--trap
+cflags-$(CONFIG_CPU_SB1)	+= $(call cc-option,-march=sb1,-march=r5000) -Wa,--trap
+cflags-$(CONFIG_CPU_R8000)	+= -march=r8000 -Wa,--trap
+cflags-$(CONFIG_CPU_R10000)	+= $(call cc-option,-march=r10000,-march=r8000) -Wa,--trap
+
+cflags-$(CONFIG_CPU_R4000_WORKAROUNDS)	+= $(call cc-option,-mfix-r4000,)
+cflags-$(CONFIG_CPU_R4400_WORKAROUNDS)	+= $(call cc-option,-mfix-r4400,)
+cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS)	+= $(call cc-option,-mno-daddi,)
+
+PLATFORM_CPPFLAGS += $(cflags-y)
#1 lore raw
Quoted 2 lines · In message <[email protected]> you wrote:

We take the same options as Linux for now. This means that an ancient -mcpu support will be lost. Users need gcc 3.0.X or later.

Why is this change necessary?

There are still people out there who use ancient toolchains like gcc-2.95. Do we really have to break compatibility here?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Men will always be men -- no matter where they are.
	-- Harry Mudd, "Mudd's Women", stardate 1329.8
#2 lore raw
Quoted 5 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:

We take the same options as Linux for now. This means that an ancient -mcpu support will be lost. Users need gcc 3.0.X or later.

Why is this change necessary?

Not necessary.

Quoted 2 lines

There are still people out there who use ancient toolchains like gcc-2.95. Do we really have to break compatibility here?

This patch adds,
- support more CPU variants other than MIPS 4K
- without changing the code.

In other words, every U-Boot/MIPS user other than MIPS 4K must change cpu/mips/config.mk as he wants.

I thought this patch is more beneficial for MIPS users even if breaking old gcc 2.96 support. That's all.

I don't want to argue with you about this issue. If you disagree, I'll drop this from my queue. I don't mind, I can live without this change.

Shinya

#3 lore raw

Dear Shinya,

Quoted 8 lines · in message <[email protected]> you wrote:
Quoted 3 lines

There are still people out there who use ancient toolchains like gcc-2.95. Do we really have to break compatibility here?

This patch adds,
- support more CPU variants other than MIPS 4K
- without changing the code.

Quoted 5 lines

In other words, every U-Boot/MIPS user other than MIPS 4K must change cpu/mips/config.mk as he wants.

I thought this patch is more beneficial for MIPS users even if breaking old gcc 2.96 support. That's all.

Maybe you can implement this in a way that still supports old environments at least at the same level as the current code does?

Quoted 2 lines

I don't want to argue with you about this issue. If you disagree, I'll drop this from my queue. I don't mind, I can live without this change.

Please don't misunderstand me - I don't want to stop you or to put obstacles in your way. I just want to make sure we keep the bigger picture in mind.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Even if you can deceive people about  a  product  through  misleading
statements, sooner or later the product will speak for itself.
- Hajime Karatsu