diff mbox

[OpenWrt-Devel,2/5] target.mk: add optimization flags for MIPS 24Kc.

Message ID 1446036929-19163-3-git-send-email-yszhou4tech@gmail.com
State Superseded
Headers show

Commit Message

Yousong Zhou Oct. 28, 2015, 12:55 p.m. UTC
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 include/target.mk |    1 +
 1 file changed, 1 insertion(+)

Comments

Cristian Morales Vega Oct. 28, 2015, 2:18 p.m. UTC | #1
On 28 October 2015 at 12:55, Yousong Zhou <yszhou4tech@gmail.com> wrote:
> --- a/include/target.mk
> +++ b/include/target.mk
> @@ -212,6 +212,7 @@ ifeq ($(DUMP),1)
>      CPU_CFLAGS_mips32 = -mips32 -mtune=mips32
>      CPU_CFLAGS_mips32r2 = -mips32r2 -mtune=mips32r2
>      CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64
> +    CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc
>      CPU_CFLAGS_24kec = -mips32r2 -mtune=24kec
>      CPU_CFLAGS_34kc = -mips32r2 -mtune=34kc
>      CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc

Nothing against the patch itself. But was wondering, since the builds
are so device specific, what's the point of building for a generic
mips32(r2)?

Isn't just

CPU_CFLAGS_74kc = -march=74kc
(which the gcc manual says implies -mtune=74kc)

going to generate faster code than

CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc

without any drawback?
Yousong Zhou Oct. 29, 2015, 2:34 a.m. UTC | #2
Fwd to openwrt-devel list.

---------- Forwarded message ----------
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: 29 October 2015 at 09:59
Subject: Re: [OpenWrt-Devel] [PATCH 2/5] target.mk: add optimization
flags for MIPS 24Kc.
To: Cristian Morales Vega <cristian@samknows.com>


On 28 October 2015 at 22:18, Cristian Morales Vega
<cristian@samknows.com> wrote:
> On 28 October 2015 at 12:55, Yousong Zhou <yszhou4tech@gmail.com> wrote:
>> --- a/include/target.mk
>> +++ b/include/target.mk
>> @@ -212,6 +212,7 @@ ifeq ($(DUMP),1)
>>      CPU_CFLAGS_mips32 = -mips32 -mtune=mips32
>>      CPU_CFLAGS_mips32r2 = -mips32r2 -mtune=mips32r2
>>      CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64
>> +    CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc
>>      CPU_CFLAGS_24kec = -mips32r2 -mtune=24kec
>>      CPU_CFLAGS_34kc = -mips32r2 -mtune=34kc
>>      CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc
>
> Nothing against the patch itself. But was wondering, since the builds
> are so device specific, what's the point of building for a generic
> mips32(r2)?
>
> Isn't just
>
> CPU_CFLAGS_74kc = -march=74kc
> (which the gcc manual says implies -mtune=74kc)
>
> going to generate faster code than
>
> CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc
>
> without any drawback?

Previously I also wondered why ar71xx set the CPU_TYPE to 34kc while there are
24kc SoCs like AR9331.  According to the GCC manual

  -mips32r2 is equivalent to -march=mips32r2

  ...

  By using ‘-march’ and ‘-mtune’ together, it is possible to generate
  code that will run on a family of processors, but optimize the code for one
  particular member of that family.

So I guess it's just that `-mips32r2 -mtune=74kc` is safer than
`-march=74kc`

                yousong

> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
diff mbox

Patch

diff --git a/include/target.mk b/include/target.mk
index 3e7f17d..119f88c 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -212,6 +212,7 @@  ifeq ($(DUMP),1)
     CPU_CFLAGS_mips32 = -mips32 -mtune=mips32
     CPU_CFLAGS_mips32r2 = -mips32r2 -mtune=mips32r2
     CPU_CFLAGS_mips64 = -mips64 -mtune=mips64 -mabi=64
+    CPU_CFLAGS_24kc = -mips32r2 -mtune=24kc
     CPU_CFLAGS_24kec = -mips32r2 -mtune=24kec
     CPU_CFLAGS_34kc = -mips32r2 -mtune=34kc
     CPU_CFLAGS_74kc = -mips32r2 -mtune=74kc