All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: luoyonggang@gmail.com
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Programmingkid <programmingkidx@gmail.com>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	Howard Spoelstra <hsp.cat7@gmail.com>,
	Dino Papararo <skizzato73@msn.com>
Subject: Re: R: About hardfloat in ppc
Date: Wed, 29 Apr 2020 14:38:20 +0100	[thread overview]
Message-ID: <87y2qejttf.fsf@linaro.org> (raw)
In-Reply-To: <CAE2XoE-6bRUsgJ2rvcb6Wb_OqSDoQEkMy2T==h_qjU5k7XawPA@mail.gmail.com>


罗勇刚(Yonggang Luo) <luoyonggang@gmail.com> writes:

> On Wed, Apr 29, 2020 at 7:57 PM Alex Bennée <alex.bennee@linaro.org> wrote:
>
>>
>> Dino Papararo <skizzato73@msn.com> writes:
>>
>> > Hello,
>> > about handling of PPC fpu exceptions and Hard Floats support we could
>> consider a different approach for different instructions.
>> > i.e. not all fpu instructions take care about inexact or exceptions
>> bits: if I take a simple fadd f0,f1,f2 I'll copy value derived from adding
>> f1+f2 into f1 register and no one will check about inexact or exception
>> bits raised into FPSCR register.
>> > Instead if I'll take fadd. f0,f1,f2 the dot following the add
>> instructions means I want take inexact or exceptions bits into account.
>> > So I could use hard floats for first case and softfloats for second case.
>> > Could this be a fast solution to start implement hard floats for PPC??
>>
>> While it may be true that normal software practice is not to read the
>> exception registers for every operation we can't base our emulation on
>> that. We must always be able to re-create the state of the exception
>> registers whenever they may be read by the program. There are 3 cases
>> this may happen:
>>
>>   - a direct read of the inexact register
>>   - checking the sigcontext of a synchronous exception (e.g. fault)
>>   - checking the sigcontext of an asynchronous exception (e.g. timer/IPI)
>>
>> Given the way the translator works we can simplify the asynchronous case
>> because we know they are only ever delivered at the start of translated
>> blocks. We must have a fully rectified system state at the end of every
>> block. So lets consider some cases:
>>
>>   fpOpA
>>   clear flags
>>   fpOpB
>>   clear flags
>>   fpOpC
>>   read flags
>>
> So we only need clear flags for before the fp op that are running before
> the read flags are
> triggered?  So the key point is finding all the read flags op, and find the
> latest clear flags op
> before the latest fp op instuction that before the read flags. May this be
> expressed in TCG ops?

In the simple case of flags not being able to be read from a chain of
operations this could all be handled in the front end by using a
different set of helpers (or maybe tweaking the helper to handle a NULL
fpst?) when it knows the values won't be needed.

The trouble is scanning forward enough to know this is the case as the
way the decoders currently work is by dealing with an instruction at a
time. There are some cases where we use tcg_last_op() to save the
location of an operations and then tcg_set_insn_param() update a
parameter after the fact. Your could save the location of every fpOp
with tcg_last_op() and then go through each on updating the parameters
to the helper to indicate if you care about calculating the flags or
not.

>> Assuming we know the fpOps can't generate exceptions we can know that
>> only fpOpC will ever generate a user visible floating point flags so we
>> can indeed use hardfloat for fpOpA and fpOpB. However if we see the
>> pattern:
>>
>>   fpOpA
>>   ld/st
>>
> What does ld/st means? load and store float point values?

Generally any load or store to memory has the potential to fault
regardless of what it is actually storing. There may be other
potentially faulting instructions as well - it will depend on your
architecture.

-- 
Alex Bennée


  reply	other threads:[~2020-04-29 13:39 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27  6:39 About hardfloat in ppc 罗勇刚(Yonggang Luo)
2020-04-27  9:42 ` Alex Bennée
2020-04-27 10:34   ` BALATON Zoltan
2020-04-27 11:10     ` Alex Bennée
2020-04-27 21:18       ` 罗勇刚(Yonggang Luo)
2020-04-28  8:36         ` Alex Bennée
2020-04-28 14:29           ` 罗勇刚(Yonggang Luo)
2020-04-29 10:17           ` R: " Dino Papararo
2020-04-29 10:31             ` Dino Papararo
2020-04-29 11:57             ` Alex Bennée
2020-04-29 12:33               ` 罗勇刚(Yonggang Luo)
2020-04-29 13:38                 ` Alex Bennée [this message]
2020-04-29 14:31               ` R: " Dino Papararo
2020-04-29 14:49                 ` Peter Maydell
2020-04-29 18:25                 ` R: " Alex Bennée
2020-04-30  0:20                   ` 罗勇刚(Yonggang Luo)
2020-04-30  2:18                     ` Richard Henderson
2020-04-30  7:26                       ` 罗勇刚(Yonggang Luo)
2020-04-30  8:11                         ` Alex Bennée
2020-04-30  8:13                       ` 罗勇刚(Yonggang Luo)
2020-04-30 15:35                         ` BALATON Zoltan
2020-04-30 16:34                           ` R: " Dino Papararo
2020-05-01  1:59                             ` Programmingkid
2020-05-01  2:21                               ` 罗勇刚(Yonggang Luo)
2020-05-01 11:58                                 ` BALATON Zoltan
2020-05-01 12:04                                   ` 罗勇刚(Yonggang Luo)
2020-05-01 13:10                                     ` Alex Bennée
2020-05-01 13:39                                       ` BALATON Zoltan
2020-05-01 14:01                                         ` Alex Bennée
2020-05-01 14:18                                       ` Richard Henderson
2020-05-01 16:25                                         ` 罗勇刚(Yonggang Luo)
2020-05-01 19:33                                           ` Alex Bennée
2020-05-01 16:29                                         ` 罗勇刚(Yonggang Luo)
2020-05-01 16:51                                           ` Richard Henderson
2020-05-01 17:49                                             ` 罗勇刚(Yonggang Luo)
2020-05-01 20:35                                               ` Richard Henderson
2020-04-29 23:12               ` R: " 罗勇刚(Yonggang Luo)
2020-04-30 15:16           ` BALATON Zoltan
2020-04-30 18:59             ` Alex Bennée
2020-04-30 20:17               ` 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=87y2qejttf.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=hsp.cat7@gmail.com \
    --cc=luoyonggang@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=skizzato73@msn.com \
    /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.