linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Tony Breeds <tony@bakeyournoodle.com>
Cc: LinuxPPC-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 4/6] powerpc/boot: Add extended precision shifts to the boot wrapper.
Date: Wed, 30 Nov 2011 16:48:27 +1100	[thread overview]
Message-ID: <1322632107.21641.43.camel@pasglop> (raw)
In-Reply-To: <1322630640-13708-5-git-send-email-tony@bakeyournoodle.com>

On Wed, 2011-11-30 at 16:23 +1100, Tony Breeds wrote:
> Code copied from arch/powerpc/kernel/misc_32.S
> 
> Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
> ---
>  arch/powerpc/boot/div64.S |   52 +++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 52 insertions(+), 0 deletions(-)

Should we just link with libgcc ? :-)

Cheers,
Ben.

> diff --git a/arch/powerpc/boot/div64.S b/arch/powerpc/boot/div64.S
> index d271ab5..bbcb8a4 100644
> --- a/arch/powerpc/boot/div64.S
> +++ b/arch/powerpc/boot/div64.S
> @@ -57,3 +57,55 @@ __div64_32:
>  	stw	r8,4(r3)
>  	mr	r3,r6		# return the remainder in r3
>  	blr
> +
> +/*
> + * Extended precision shifts.
> + *
> + * Updated to be valid for shift counts from 0 to 63 inclusive.
> + * -- Gabriel
> + *
> + * R3/R4 has 64 bit value
> + * R5    has shift count
> + * result in R3/R4
> + *
> + *  ashrdi3: arithmetic right shift (sign propagation)	
> + *  lshrdi3: logical right shift
> + *  ashldi3: left shift
> + */
> +	.globl __ashrdi3
> +__ashrdi3:
> +	subfic	r6,r5,32
> +	srw	r4,r4,r5	# LSW = count > 31 ? 0 : LSW >> count
> +	addi	r7,r5,32	# could be xori, or addi with -32
> +	slw	r6,r3,r6	# t1 = count > 31 ? 0 : MSW << (32-count)
> +	rlwinm	r8,r7,0,32	# t3 = (count < 32) ? 32 : 0
> +	sraw	r7,r3,r7	# t2 = MSW >> (count-32)
> +	or	r4,r4,r6	# LSW |= t1
> +	slw	r7,r7,r8	# t2 = (count < 32) ? 0 : t2
> +	sraw	r3,r3,r5	# MSW = MSW >> count
> +	or	r4,r4,r7	# LSW |= t2
> +	blr
> +
> +	.globl __ashldi3
> +__ashldi3:
> +	subfic	r6,r5,32
> +	slw	r3,r3,r5	# MSW = count > 31 ? 0 : MSW << count
> +	addi	r7,r5,32	# could be xori, or addi with -32
> +	srw	r6,r4,r6	# t1 = count > 31 ? 0 : LSW >> (32-count)
> +	slw	r7,r4,r7	# t2 = count < 32 ? 0 : LSW << (count-32)
> +	or	r3,r3,r6	# MSW |= t1
> +	slw	r4,r4,r5	# LSW = LSW << count
> +	or	r3,r3,r7	# MSW |= t2
> +	blr
> +
> +	.globl __lshrdi3
> +__lshrdi3:
> +	subfic	r6,r5,32
> +	srw	r4,r4,r5	# LSW = count > 31 ? 0 : LSW >> count
> +	addi	r7,r5,32	# could be xori, or addi with -32
> +	slw	r6,r3,r6	# t1 = count > 31 ? 0 : MSW << (32-count)
> +	srw	r7,r3,r7	# t2 = count < 32 ? 0 : MSW >> (count-32)
> +	or	r4,r4,r6	# LSW |= t1
> +	srw	r3,r3,r5	# MSW = MSW >> count
> +	or	r4,r4,r7	# LSW |= t2
> +	blr

  reply	other threads:[~2011-11-30  5:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30  5:23 Add support for the currituck 476 platform from IBM Tony Breeds
2011-11-30  5:23 ` [PATCH 1/6] 44x/pci: Continue pci setup even if there is no sdr-base in the device-tree Tony Breeds
2011-11-30  5:46   ` Benjamin Herrenschmidt
2011-12-01  1:11     ` Tony Breeds
2011-11-30  5:23 ` [PATCH 2/6] 44x/pci: Setup the dma_window properties for each pci_controller Tony Breeds
2011-11-30  5:23 ` [PATCH 3/6] 44x: Removing dead CONFIG_PPC47x Tony Breeds
2011-11-30 11:43   ` Josh Boyer
2011-11-30 20:20     ` Benjamin Herrenschmidt
2011-11-30  5:23 ` [PATCH 4/6] powerpc/boot: Add extended precision shifts to the boot wrapper Tony Breeds
2011-11-30  5:48   ` Benjamin Herrenschmidt [this message]
2011-11-30 11:45     ` Josh Boyer
2011-11-30 20:21       ` Benjamin Herrenschmidt
2011-11-30 20:28         ` Scott Wood
2011-11-30 23:25       ` Tony Breeds
2011-11-30  5:23 ` [PATCH 5/6] powerpc/boot: Add mfdcrx Tony Breeds
2011-11-30 13:09   ` Segher Boessenkool
2011-11-30 18:10     ` David Laight
2011-12-01 22:55       ` Segher Boessenkool
2011-11-30 23:30     ` Tony Breeds
2011-11-30 23:35       ` Tony Breeds
2011-11-30  5:24 ` [PATCH 6/6] 44x/currituck: Add support for the new IBM currituck platform Tony Breeds
2011-11-30  6:20   ` Benjamin Herrenschmidt
2011-11-30  6:31     ` David Gibson
2011-12-01  4:05     ` Tony Breeds
2011-12-01  4:29       ` Tony Breeds
2011-11-30 13:23   ` Kumar Gala
2011-12-01  4:16     ` Tony Breeds

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=1322632107.21641.43.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tony@bakeyournoodle.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;
as well as URLs for NNTP newsgroup(s).