public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Leo Liang <ycliang@andestech.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/2] riscv: simplify longjmp
Date: Tue, 23 Mar 2021 19:54:14 +0800	[thread overview]
Message-ID: <20210323115357.GA9736@andestech.com> (raw)
In-Reply-To: <20210322110249.4387-2-xypron.glpk@gmx.de>

Hi Heinrich,

On Mon, Mar 22, 2021 at 12:02:48PM +0100, Heinrich Schuchardt wrote:
> The value returned by setjmp must be nonzero. If zero is passed as
> parameter it must be replaced by 1.
> 
> This patch reduces the code size a bit.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Sean Anderson <seanga2@gmail.com>

I think Sean is refering to the "Reviewed-by" tag is missing.
Otherwise than that, LGTM.

> ---
> v2:
> 	fix typo in title
> ---
>  arch/riscv/lib/setjmp.S | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/riscv/lib/setjmp.S b/arch/riscv/lib/setjmp.S
> index 72bc9241f6..99d6195827 100644
> --- a/arch/riscv/lib/setjmp.S
> +++ b/arch/riscv/lib/setjmp.S
> @@ -54,12 +54,8 @@ ENTRY(longjmp)
>  	LOAD_IDX(sp, 13)
> 
>  	/* Move the return value in place, but return 1 if passed 0. */
> -	beq a1, zero, longjmp_1
> -	mv a0, a1
> -	ret
> -
> -	longjmp_1:
> -	li a0, 1
> +	seqz a0, a1
> +	add a0, a0, a1
>  	ret
>  ENDPROC(longjmp)
>  .popsection
> --
> 2.30.2
>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

Best regards,
Leo

  parent reply	other threads:[~2021-03-23 11:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 11:02 [PATCH v2 0/2] riscv: simplify longjmp Heinrich Schuchardt
2021-03-22 11:02 ` [PATCH v2 1/2] " Heinrich Schuchardt
2021-03-22 12:53   ` Sean Anderson
2021-03-23 11:54   ` Leo Liang [this message]
2021-03-22 11:02 ` [PATCH v2 2/2] test: unit test for longjmp Heinrich Schuchardt
2021-03-22 13:23   ` Sean Anderson
2021-03-22 13:30     ` Sean Anderson
2021-03-22 16:42       ` Heinrich Schuchardt
2021-03-23 13:30         ` Sean Anderson
2021-03-24  9:18       ` Andreas Schwab
2021-03-24 11:16         ` Heinrich Schuchardt
2021-03-24 12:39           ` Andreas Schwab
2021-03-24 13:28             ` Heinrich Schuchardt

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=20210323115357.GA9736@andestech.com \
    --to=ycliang@andestech.com \
    --cc=u-boot@lists.denx.de \
    /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