All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Taylor Simpson <tsimpson@quicinc.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] Add support for a helper with 7 arguments
Date: Thu, 6 Feb 2020 15:35:08 +0000	[thread overview]
Message-ID: <3614849d-12a5-fa43-fb10-801e9648b40e@twiddle.net> (raw)
In-Reply-To: <BYAPR02MB48863BDFCB4CB26717467579DE1D0@BYAPR02MB4886.namprd02.prod.outlook.com>

On 2/6/20 2:03 PM, Taylor Simpson wrote:
> Some of the more complex instructions need a lot of operands.  Here's an example
>     if (Pv4) memb(Rs32 + Ru32 << #u2) = Rt32
> This is a predicated store with 5 operands:
>     Pv4predicate
>     Rs32, Ru32, u2used to compute the effective address
>     Rt32value to store
> In addition, every helper gets an env argument, and predicated instructions get a "slot" argument.  The slot argument refers to the VLIW slot where the instruction is located within the packet.  It is used for predicated instructions to communicate to the end-of-packet handling to determine whether the instruction should commit.
> 
> So, the signature for the helper for this instruction is
>     void HELPER(S4_pstorerbt_rr)(CPUHexagonState *env, int32_t PvV, int32_t RsV, int32_t RuV, int32_t RtV, int32_t uiV, uint32_t slot)


I think this is quite ugly.  I know you've been talking about auto-generating
everything but we ought to do better than this.

You should be passing values not regnos if you can possibly do so.  You should
be passing full virtual addresses not N separate components of an address.
Predicates should be evaluated earlier so that the helper isn't even called if
it's false.

Combine that with 3.3.1 Packet execution semantics, "dual stores, new-value
stores, and slot1 store with slot0 loads have non-parallel execution
semantics", and you need no special helper at all:

	and	t0, pv, 1
	brcondi	t0, 0, over

	shli	t0, ru, u2
	add	t0, t0, rs
	qemu_st	rt, t0, mmu_idx, MO_UB
 over:

But suppose this were something more complicated than a bare store, and the
point still stands about pre-computing full addresses.


r~


  reply	other threads:[~2020-02-06 15:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 22:41 [PATCH] Add support for a helper with 7 arguments Taylor Simpson
2020-02-06  6:02 ` Richard Henderson
2020-02-06 10:28   ` Richard Henderson
2020-02-06 14:03     ` Taylor Simpson
2020-02-06 15:35       ` Richard Henderson [this message]
2020-02-06 17:52         ` Taylor Simpson
2020-02-07  0:27           ` Richard Henderson
2020-02-07  4:46             ` Taylor Simpson
2020-02-07  8:53               ` Richard Henderson
2020-02-07 11:59                 ` Taylor Simpson
2020-02-07 12:14 ` Richard Henderson
2020-02-07 12:43   ` Taylor Simpson
2020-02-07 15:49     ` Richard Henderson
2020-02-09  5:08       ` Taylor Simpson
2020-02-09 18:17         ` Richard Henderson
2020-02-09 20:51           ` Taylor Simpson
2020-02-10  4:54             ` Taylor Simpson
2020-02-10 16:33               ` Richard Henderson

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=3614849d-12a5-fa43-fb10-801e9648b40e@twiddle.net \
    --to=rth@twiddle.net \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tsimpson@quicinc.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.