> -----Original Message----- > From: Richard Henderson <rth7...@gmail.com> On Behalf Of Richard > Henderson > Sent: Thursday, February 6, 2020 9:35 AM > To: Taylor Simpson <tsimp...@quicinc.com>; qemu-devel@nongnu.org > Cc: Paolo Bonzini <pbonz...@redhat.com> > Subject: Re: [PATCH] Add support for a helper with 7 arguments > > > 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.
We are passing values, not reg numbers. The generator doesn't know anything about the semantics of the instruction. It only knows which operands are read, written, or both. So, there's no way to combine the 3 operands into a single effective address until we are inside the helper. Also, there's no way to know if the instruction is predicated or if it just has a predicate as an operand. Also, there are instructions where the predicate is used in the false sense. > > 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: > > andt0, pv, 1 > brcondit0, 0, over > > shlit0, ru, u2 > addt0, t0, rs > qemu_strt, t0, mmu_idx, MO_UB > over: > We can't actually do the store here. We have to record it in a side data structure in the env and perform the store when the packet commits. There is a mechanism to override the call to the helper (fWRAP_<tag>). If we did override this instruction, the TCG would be similar to what you have. However, all instructions still get a helper because the generator doesn't know which instructions are overridden. Currently, there are a total of 35 instructions that need a helper with 7 arguments. 32 of them are predicated stores, but there are also 3 vscatter instructions. For example, if (Qs4) vscatter(Rt32, Mu2, Vv32.w).w = Vw32 In this case, the predicate is a vector used as a mask for each element of the store. Even if we weren't using a generator, I would do a helper for these because of their complexity. > But suppose this were something more complicated than a bare store, and > the > point still stands about pre-computing full addresses. > > > r~