All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v3 1/3] or1k: libgcc: initial support for openrisc
Date: Sun, 28 Oct 2018 01:25:54 +0000	[thread overview]
Message-ID: <494cb6a6-fcc5-04d6-346a-c91e7f8ff085@twiddle.net> (raw)
In-Reply-To: <20181027043702.18414-2-shorne@gmail.com>

On 10/27/18 5:37 AM, Stafford Horne wrote:
> +/* Here _init and _fini are empty because .init_array/.fini_array are used
> +   exclusively.  However, the functions are still needed as required when
> +   linking.  */
> +	.align 4
> +	.global	_init
> +	.type	_init, at function
> +_init:
> +	.global	_fini
> +	.type	_fini, at function
> +_fini:
> +	l.jr	r9
> +	 l.nop

Where are they referenced from?  Perhaps just a binutils bug, in that the
linker script needs adjustment?

> +	/* Given R = X * Y ... */
> +1:	l.sfeq		r4, r0			/* while (y != 0) */
> +	l.bf		2f
> +	 l.andi		r5, r4, 1		/* if (y & 1) ... */
> +	l.add		r12, r11, r3
> +	l.sfne		r5, r0
> +#if defined(__or1k_cmov__)
> +	l.cmov		r11, r12, r11		/* ... r += x. */
> +	l.srli		r4, r4, 1		/* y >>= 1 */
> +#else
> +	l.bnf		3f
> +	 l.srli		r4, r4, 1		/* y >>= 1 */
> +	l.ori		r11, r12, 0

This move could be the add to save 1 cycle in the !cmov case.

> +	/* Shift Y back to the right again, subtracting from X.  */
> +2:	l.add		r7, r11, r6	/* tmp1 = quot + mask */
> +3:	l.srli		r6, r6, 1	/* mask >>= 1 */
> +	l.sub		r8, r12, r4	/* tmp2 = x - y */
> +	l.sfleu		r4, r12		/* y <= x */
> +	l.srli		r4, r4, 1	/* y >>= 1 */
> +#if defined(__or1k_cmov__)
> +	l.cmov		r11, r7, r11	/* if (y <= x) quot = tmp1 */
> +	l.cmov		r12, r8, r12	/* if (y <= x) x = tmp2 */
> +#else
> +	l.bnf		4f
> +	 l.nop
> +	l.ori		r11, r7, 0
> +	l.ori		r12, r8, 0

Simiarly.

Although both mul nor div are correct as-is, and need not be fixed immediately.
 I'm only concerned about _init and _fini.


r~

  parent reply	other threads:[~2018-10-28  1:25 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27  4:36 [OpenRISC] [PATCH v3 0/3] OpenRISC port Stafford Horne
2018-10-27  4:37 ` [OpenRISC] [PATCH v3 1/3] or1k: libgcc: initial support for openrisc Stafford Horne
2018-10-27 23:25   ` Segher Boessenkool
2018-10-28  0:37     ` Stafford Horne
2018-10-28  1:25   ` Richard Henderson [this message]
2018-10-29 13:44     ` Stafford Horne
2018-10-27  4:37 ` [OpenRISC] [PATCH v3 2/3] or1k: testsuite: " Stafford Horne
2018-10-28  1:27   ` Richard Henderson
2018-10-27  4:37 ` [OpenRISC] [PATCH v3 3/3] or1k: gcc: " Stafford Horne
2018-10-28  1:56   ` Richard Henderson
2018-10-30 12:18     ` Stafford Horne
2018-10-30 15:57       ` Richard Henderson
2018-10-30 22:44         ` Stafford Horne
2018-10-28  2:57   ` Segher Boessenkool
2018-10-28 21:47     ` Stafford Horne
2018-10-28 22:54       ` Segher Boessenkool
2018-10-30 12:49         ` Stafford Horne
2018-10-30 15:49           ` Segher Boessenkool
2018-10-30 22:35             ` Stafford Horne
2018-10-31 14:39               ` Jeff Law
2018-10-28 23:16     ` Richard Henderson
2018-10-29 13:34       ` Stafford Horne
2018-10-29 16:34         ` Segher Boessenkool
2018-10-29 16:42           ` Richard Henderson
2018-10-30 11:26             ` Stafford Horne
2018-10-30 15:41               ` Segher Boessenkool
2018-10-29 14:28   ` Szabolcs Nagy
2018-11-04  9:05     ` Stafford Horne
2018-11-05 11:13       ` Szabolcs Nagy
2018-11-05 15:10         ` Rich Felker
2018-11-05 20:58           ` Stafford Horne
2018-11-05 20:52         ` Stafford Horne
2018-11-05 19:45       ` Richard Henderson
2018-11-05 20:14         ` Christophe Lyon
2018-10-28  1:29 ` [OpenRISC] [PATCH v3 0/3] OpenRISC port Richard Henderson

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=494cb6a6-fcc5-04d6-346a-c91e7f8ff085@twiddle.net \
    --to=rth@twiddle.net \
    --cc=openrisc@lists.librecores.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.