qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Rui Wang <wangrui@loongson.cn>
Cc: Song Gao <gaosong@loongson.cn>,
	Xiaojuan Yang <yangxiaojuan@loongson.cn>,
	 qemu-devel@nongnu.org, hev <qemu@hev.cc>
Subject: Re: [PATCH v3 2/2] target/loongarch: Fix emulation of float-point disable exception
Date: Sat, 5 Nov 2022 09:15:06 +1100	[thread overview]
Message-ID: <59013583-f6fa-e6eb-8394-231f6e4d50dc@linaro.org> (raw)
In-Reply-To: <20221104040517.222059-3-wangrui@loongson.cn>

On 11/4/22 15:05, Rui Wang wrote:
> +#ifndef CONFIG_USER_ONLY
> +#define CHECK_FPE do { \
> +    if ((ctx->base.tb->flags & HW_FLAGS_EUEN_FPE) == 0) { \
> +        generate_exception(ctx, EXCCODE_FPD); \
> +        return false; \
> +    } \
> +} while (0)
> +#else
> +#define CHECK_FPE
> +#endif
> +
>   static bool gen_fff(DisasContext *ctx, arg_fff *a,
>                       void (*func)(TCGv, TCGv_env, TCGv, TCGv))
>   {
> +    CHECK_FPE;

Oh, sorry, I just realized this is not quite correct: CHECK_FPE should return true, not false.

Returning false indicates that the instruction has not been matched, and the decoder 
should continue searching.  If we reach the end of the search space, we raise EXCCODE_INE. 
But here we have successfully matched the instruction, and have found that the register 
bank is disabled and should raise EXCCODE_FPD.

The difference will in practice not be visible, because the code that will be emitted to 
raise EXCCODE_INE will not be reached, because control flow will have already raised 
EXCCODE_FPD, but it would be better to not emit the dead code.


r~


      reply	other threads:[~2022-11-04 22:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04  4:05 [PATCH v3 0/2] target/loongarch: Fix emulation of float-point disable exception Rui Wang
2022-11-04  4:05 ` [PATCH v3 1/2] target/loongarch: Adjust the layout of hardware flags bit fields Rui Wang
2022-11-04 22:08   ` Richard Henderson
2022-11-04  4:05 ` [PATCH v3 2/2] target/loongarch: Fix emulation of float-point disable exception Rui Wang
2022-11-04 22:15   ` Richard Henderson [this message]

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=59013583-f6fa-e6eb-8394-231f6e4d50dc@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=gaosong@loongson.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu@hev.cc \
    --cc=wangrui@loongson.cn \
    --cc=yangxiaojuan@loongson.cn \
    /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).