public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@linux-m68k.org>
To: George Spelvin <linux@horizon.com>,
	geert@linux-m68k.org, linux-m68k@lists.linux-m68k.org
Subject: Re: [RFC PATCH 2/2] arch/m68k: Add CONFIG_CPU_HAS_NO_MULDIV32
Date: Thu, 12 May 2016 22:55:46 +1000	[thread overview]
Message-ID: <57347D52.2060801@linux-m68k.org> (raw)
In-Reply-To: <20160511102535.5858.qmail@ns.horizon.com>

Hi George,

On 11/05/16 20:25, George Spelvin wrote:
> Assembly of 32-bit multiply/divide helpers was dependent on
> CONFIG_CPU_HAS_NO_MULDIV64, which is not necessary.
>
> Signed-off-by: George Spelvin <linux@horizon.com>
> ---
> This also turns out to be a very useful symbol for some other work
> I'm doing to <linux/hash.h>.
>
>   arch/m68k/Kconfig.cpu  | 11 +++++++++++
>   arch/m68k/lib/Makefile |  4 ++--
>   2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
> index 0dfcf12..3fce7bf 100644
> --- a/arch/m68k/Kconfig.cpu
> +++ b/arch/m68k/Kconfig.cpu
> @@ -37,6 +37,7 @@ config M68000
>   	bool "MC68000"
>   	depends on !MMU
>   	select CPU_HAS_NO_BITFIELDS
> +	select CPU_HAS_NO_MULDIV32
>   	select CPU_HAS_NO_MULDIV64
>   	select CPU_HAS_NO_UNALIGNED
>   	select GENERIC_CSUM
> @@ -391,8 +392,18 @@ config NODES_SHIFT
>   config CPU_HAS_NO_BITFIELDS
>   	bool
>
> +config CPU_HAS_NO_MULDIV32
> +	bool
> +	help
> +	  This option indicates the CPU lacks 32x32->32-bit multiply
> +	  and divide instructions, and thus requires the GCC helper
> +	  functions __mulsi3, __divsi3 __modsi3, etc.
> +
>   config CPU_HAS_NO_MULDIV64
>   	bool
> +	help
> +	  This option indicates the CPU lacks "widening" 32x32->64-bit
> +	  multiply and 64/32->(32,32)-bit divide instructions.
>
>   config CPU_HAS_NO_UNALIGNED
>   	bool
> diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
> index fcd8eb1..e6553db 100644
> --- a/arch/m68k/lib/Makefile
> +++ b/arch/m68k/lib/Makefile
> @@ -7,8 +7,8 @@ lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
>   	   memcpy.o memset.o memmove.o
>
>   lib-$(CONFIG_MMU) += uaccess.o
> -lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += mulsi3.o divsi3.o udivsi3.o
> -lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += modsi3.o umodsi3.o
> +lib-$(CONFIG_CPU_HAS_NO_MULDIV32) += mulsi3.o divsi3.o udivsi3.o
> +lib-$(CONFIG_CPU_HAS_NO_MULDIV32) += modsi3.o umodsi3.o

Did you intend to no longer compile any of mulsi3.o, etc, for
ColdFire targets?

CPU_HAS_NO_MULDIV64 is selected by both M68000 and ColdFire, so
those functions used to be compiled. But with this change on
only M68000 will compile them.

That causes a problem if we are forced to fallback and use the
gcc -m5200 cpu switch. (That may be the case if the version of
gcc we are compiling with doesn't support the more advanced
ColdFire CPU selection switches).

When compiling with m5200 gcc will generate calls to divsi3,
udivsi3, modsi3 and umodsi3. (As far as I can tell we never need
mulsi3 for ColdFire). So linking will fail with this patch as-is
in that m5200 case.

Regards
Greg

  reply	other threads:[~2016-05-12 12:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 10:25 [RFC PATCH 2/2] arch/m68k: Add CONFIG_CPU_HAS_NO_MULDIV32 George Spelvin
2016-05-12 12:55 ` Greg Ungerer [this message]
2016-05-12 20:31   ` George Spelvin
2016-05-13  1:02     ` Greg Ungerer
2016-05-13  3:28     ` Finn Thain
2016-05-13  2:39       ` George Spelvin
2016-05-13  4:01         ` Finn Thain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57347D52.2060801@linux-m68k.org \
    --to=gerg@linux-m68k.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux@horizon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox