qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, John Arbuckle <programmingkidx@gmail.com>,
	qemu-ppc@nongnu.org, Paul Clarke <pc@us.ibm.com>,
	Howard Spoelstra <hsp.cat7@gmail.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [RFC PATCH v2] target/ppc: Enable hardfloat for PPC
Date: Fri, 21 Feb 2020 17:04:21 +0100 (CET)	[thread overview]
Message-ID: <alpine.BSF.2.22.395.2002211643480.45267@zero.eik.bme.hu> (raw)
In-Reply-To: <d9d4fba7-2dcf-8f09-8f3a-7e0408c297b6@linaro.org>

On Thu, 20 Feb 2020, Richard Henderson wrote:
> On 2/18/20 9:10 AM, BALATON Zoltan wrote:
>>  void helper_reset_fpstatus(CPUPPCState *env)
>>  {
>> -    set_float_exception_flags(0, &env->fp_status);
>> +    set_float_exception_flags(env->default_fp_excpt_flags, &env->fp_status);
>>  }
>
> What I don't like is the forced setting of inexact.  I don't mind leaving it
> set if it is already set, which corresponds to the normal accumulation of
> exceptions.

In a previous reply I've explained this (apart from just trying to get it 
work the simplest way for testing first):

On Wed, 19 Feb 2020, BALATON Zoltan wrote:
> Some of the problems with inexact may be fixed by not always forcing the 
> flag on but just not clearing it. As I undersood other targets do that 
> so it starts with softfloat but the first time the inexact flag is set 
> it will start using hardfloat as long as the guest does not clear this 
> flag. Probably this is done to automatically detect code that needs the 
> flag and assume it's not used when it's not touched. Since PPC also has 
> an inexact flag just for previous FP op (the FI bit) apart from the 
> usual cumulative flag, the client could read that instead of clearing 
> the cumulative flag so we can't detect guest usage this way, therefore 
> we might as well break inexact completely to always use hardfloat and 
> need to manually enable it for guests that we know need it. I'm not sure 
> however if forcing the inexact flag would lead to unwanted FP exceptions 
> as well so this may also need to be made conditional on the 
> enabled/disabled status of inexact FP exceptions. Does anyone have more 
> info on this?

So I know this should be improved but not sure how. I would not worry 
about setting the bit from the start due to the above but exceptions are 
likely wrong this way as you say.

> In addition, if the inexact exception is unmasked, I would expect a signal to
> be delivered only when an inexact exception happens.  Whereas this patch would
> deliver a signal for every fp operation.
>
> It should be just as easy to do
>
>    flags = get_float_exception_flags(status);
>    flags &= env->save_fp_exception_flags;
>    set_float_exception_flags(flags, status);

I'm not sure I get this. Can you please explain a bit more? Where would 
save_flags be set and where would the above masking with it be done? 
Currently we reset flags before every FP op as far as I understand and 
detecting of exceptions rely on this and test fp_status bits. Probably we 
should not reset the flags and change this to keep one fp_status 
accumulating flags and only reset if softfloat is forced but that would 
need rewriting exception handling that I'm not sure yet how to do. Any 
idea? Maybe if we could just unbreak inexact exceptions when enabled with 
current patch then this rewrite of exception handling could be done later.

>> +    DEFINE_PROP_BOOL("hardfloat", PowerPCCPU, hardfloat, true),
>
> I would also prefer a different name here -- perhaps x-no-fp-fi.

What's wrong with hardfloat? That's how the code refers to this so if 
anyone searches what it does would turn up some meaningful results. Your 
proposed property name is very cryptic and nobody would be able to guess 
what is it for. If you insist not to use hardfloat maybe we could invert 
it to softfloat or try x-use-fpu maybe. I specificaly don't want to tie it 
to the FI but as there's at least another non-sticky bit in FPSCR (don't 
remember which now) that might also need to be broken for best hardfloat 
results.

Regards,
BALATON Zoltan


  reply	other threads:[~2020-02-21 16:06 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 17:10 [RFC PATCH v2] target/ppc: Enable hardfloat for PPC BALATON Zoltan
2020-02-18 17:38 ` BALATON Zoltan
2020-02-19  2:27 ` Programmingkid
2020-02-19 15:35   ` BALATON Zoltan
2020-02-19 18:28     ` Howard Spoelstra
2020-02-19 19:28       ` BALATON Zoltan
2020-02-20  5:43         ` Howard Spoelstra
2020-02-25  3:07     ` Programmingkid
2020-02-25 12:09       ` BALATON Zoltan
2020-02-26 10:46         ` Programmingkid
2020-02-26 11:28           ` BALATON Zoltan
2020-02-26 13:00             ` R: " luigi burdo
2020-02-26 13:08               ` Dino Papararo
2020-02-26 14:28                 ` Alex Bennée
2020-02-26 15:50                   ` Aleksandar Markovic
2020-02-26 17:04                     ` G 3
2020-02-26 17:27                       ` Aleksandar Markovic
2020-02-26 18:14                         ` R: " Dino Papararo
2020-02-26 18:51                           ` Aleksandar Markovic
2020-02-27  2:43                         ` Programmingkid
2020-02-27  7:16                           ` Aleksandar Markovic
2020-02-27 11:54                             ` BALATON Zoltan
2020-02-26 18:09                       ` R: " Alex Bennée
2020-03-02  0:13                         ` Programmingkid
2020-03-02  4:28                           ` Richard Henderson
2020-03-02 11:42                             ` BALATON Zoltan
2020-03-02 16:55                               ` Richard Henderson
2020-03-02 23:16                                 ` BALATON Zoltan
2020-03-03  0:11                                   ` Richard Henderson
     [not found]                                   ` <CAKyx-3Pt2qLPXWQjBwrHn-nxR-9e++TioGp4cKFC3adMN3rtiw@mail.gmail.com>
2020-03-04 18:43                                     ` Fwd: " G 3
2020-03-05 19:25                                       ` Richard Henderson
2020-03-02 17:10                               ` Alex Bennée
2020-03-02 23:01                                 ` BALATON Zoltan
2020-02-26 22:51                   ` R: " BALATON Zoltan
2020-02-20 20:13 ` Richard Henderson
2020-02-21 16:04   ` BALATON Zoltan [this message]
2020-02-21 16:11     ` Peter Maydell
2020-02-21 16:51       ` Aleksandar Markovic
2020-02-21 18:04       ` BALATON Zoltan
2020-02-21 18:26         ` Peter Maydell
2020-02-21 19:52           ` BALATON Zoltan
2020-02-26 12:28             ` Alex Bennée
2020-02-26 13:07               ` BALATON Zoltan
2020-04-10 13:50 ` 罗勇刚(Yonggang Luo)
2020-04-10 18:04   ` BALATON Zoltan

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=alpine.BSF.2.22.395.2002211643480.45267@zero.eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=david@gibson.dropbear.id.au \
    --cc=hsp.cat7@gmail.com \
    --cc=pc@us.ibm.com \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.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 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).