All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Aleksandar Markovic <Aleksandar.Markovic@imgtec.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"ehabkost@redhat.com" <ehabkost@redhat.com>,
	"kbastian@mail.uni-paderborn.de" <kbastian@mail.uni-paderborn.de>,
	"mark.cave-ayland@ilande.co.uk" <mark.cave-ayland@ilande.co.uk>,
	"agraf@suse.de" <agraf@suse.de>,
	Petar Jovanovic <Petar.Jovanovic@imgtec.com>,
	"blauwirbel@gmail.com" <blauwirbel@gmail.com>,
	"jcmvbkbc@gmail.com" <jcmvbkbc@gmail.com>,
	Miodrag Dinic <Miodrag.Dinic@imgtec.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"edgar.iglesias@gmail.com" <edgar.iglesias@gmail.com>,
	"gxt@mprc.pku.edu.cn" <gxt@mprc.pku.edu.cn>,
	Leon Alrae <Leon.Alrae@imgtec.com>,
	"afaerber@suse.de" <afaerber@suse.de>,
	"aurelien@aurel32.net" <aurelien@aurel32.net>,
	"proljc@gmail.com" <proljc@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] target-mips: Implement IEEE 754-2008 functionality for R6 and MSA instructions
Date: Thu, 31 Mar 2016 09:30:30 -0700	[thread overview]
Message-ID: <56FD50A6.6060303@twiddle.net> (raw)
In-Reply-To: <EF5FA6C3467F85449672C3E735957B859168E429@BADAG02.ba.imgtec.org>

On 03/31/2016 04:55 AM, Aleksandar Markovic wrote:
> Hi, Richard, what would you think about this approach:
> 
> Functionality of <ABS|NEG>.<S|D> and <CVT|FLOOR|CEIL|TRUNC|ROUND>.<L|W>.<S|D>
> instructions is dependent on flags ABS2008 and NAN2008 in FCR31. There are
> MIPS architectures (for example mips32r5) that allow implementations
> with different values of these flags. So, in order to detect the desired
> behavior in translate-time, insn_flags field can't be used - and, therefore,
> it makes sense to add two new members to the MIPS's DisasContext:
> 
> typedef struct DisasContext {
>     . . .
>     bool nan2008;
>     bool abs2008;
> } DisasContext;
> 
> Their initialization could be in gen_intermediate_code_internal():
> 
>     ctx.nan2008 = (env->active_fpu.fcr31 >> FCR31_NAN2008) & 1;
>     ctx.abs2008 = (env->active_fpu.fcr31 >> FCR31_ABS2008) & 1;
> 
> Now, ABS.D (and all <ABS|NEG>.<S|D>) handling might look like this:
> 
>     case OPC_ABS_D:
>         check_cp1_registers(ctx, fs | fd);
>         {
>             TCGv_i64 fp0 = tcg_temp_new_i64();
> 
>             gen_load_fpr64(ctx, fp0, fs);
>             if (ctx->abs2008) {
>                 tcg_gen_andi_i64(fp0, fp0, 0x7fffffffffffffffULL);
>             } else {
>                 gen_helper_float_abs_d(fp0, fp0);
>             }
>             gen_store_fpr64(ctx, fp0, fd);
>             tcg_temp_free_i64(fp0);
>         }
>         opn = "abs.d";
>         break;
> 
> Here, 2008-style ABS.D is implemented inline, without a helper, and
> gen_helper_float_abs_d() is an old pre-2008 helper that would be intact
> (the same as it is currently) with this change.

Yes, that's exactly what I had in mind.

> On the other hand, CVT.L.D (and all <CVT|FLOOR|CEIL|TRUNC|ROUND>.<L|W>.<S|D>)
> handling would take this form:
> 
>     case OPC_CVT_L_D:
>         check_cp1_64bitmode(ctx);
>         {
>             TCGv_i64 fp0 = tcg_temp_new_i64();
> 
>             gen_load_fpr64(ctx, fp0, fs);
>             if (ctx->nan2008) {
>                 gen_helper_float_cvt_2008_l_d(fp0, cpu_env, fp0);
>             } else {
>                 gen_helper_float_cvt_l_d(fp0, cpu_env, fp0);
>             }
>             gen_store_fpr64(ctx, fp0, fd);
>             tcg_temp_free_i64(fp0);
>         }
>         opn = "cvt.l.d";
>         break;
> 
> Function helper_float_cvt_2008_l_d() is a new, only-2008-style helper for
> CVT.L.D and would look like this:
> 
> uint64_t helper_float_cvt_2008_l_d(CPUMIPSState *env, uint64_t fdt0)
> {
>     uint64_t dt2;
> 
>     dt2 = float64_to_int64(fdt0, &env->active_fpu.fp_status);
>     if (get_float_exception_flags(&env->active_fpu.fp_status)
>             & (float_flag_invalid | float_flag_overflow)) {
>         dt2 = DBL_TO_INT64_OVERFLOW(fdt0)
>     }
>     update_fcr31(env, GETPC());
>     return dt2;
> }

That looks fine as well.



r~

  reply	other threads:[~2016-03-31 16:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-25 12:50 [Qemu-devel] [PATCH 0/2] target-mips: Fix IEEE 754-2008-related issues Aleksandar Markovic
2016-03-25 12:50 ` [Qemu-devel] [PATCH 1/2] softfloat: Enable run-time-configurable meaning of signaling NaN bit Aleksandar Markovic
2016-03-28 21:36   ` Richard Henderson
2016-04-04 13:21     ` Aleksandar Markovic
2016-04-04 13:31       ` Peter Maydell
2016-04-04 19:37         ` Eduardo Habkost
2016-04-04 19:38           ` Peter Maydell
2016-04-04 19:42             ` Eduardo Habkost
2016-04-04 19:46               ` Peter Maydell
2016-04-04 19:56                 ` Eduardo Habkost
2016-03-29 12:50   ` Bastian Koppelmann
2016-03-30 16:58     ` Aleksandar Markovic
2016-04-01 19:02   ` Leon Alrae
2016-04-03 14:25     ` Aleksandar Markovic
2016-04-04 16:10       ` Leon Alrae
2016-03-25 12:50 ` [Qemu-devel] [PATCH 2/2] target-mips: Implement IEEE 754-2008 functionality for R6 and MSA instructions Aleksandar Markovic
2016-03-28 21:49   ` Richard Henderson
2016-03-30 19:28     ` Aleksandar Markovic
2016-03-31 11:55     ` Aleksandar Markovic
2016-03-31 16:30       ` Richard Henderson [this message]
2016-04-01 19:07   ` Leon Alrae
2016-04-03 15:05     ` Aleksandar Markovic

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=56FD50A6.6060303@twiddle.net \
    --to=rth@twiddle.net \
    --cc=Aleksandar.Markovic@imgtec.com \
    --cc=Leon.Alrae@imgtec.com \
    --cc=Miodrag.Dinic@imgtec.com \
    --cc=Petar.Jovanovic@imgtec.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=blauwirbel@gmail.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=jcmvbkbc@gmail.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=proljc@gmail.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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.