On 5/1/20 8:36 AM, Peter Maydell wrote: > On Thu, 30 Apr 2020 at 21:54, Richard Henderson > <richard.hender...@linaro.org> wrote: >> You can morph this into the gvec interface like so: >> >> #define DO_3SAME_64(INSN, FUNC) \ >> static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, >> uint32_t rn_ofs, uint32_t rm_ofs, >> uint32_t oprsz, uint32_t maxsz) >> { >> static const GVecGen3 op = { .fni8 = FUNC }; >> tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, >> oprsz, maxsz, &op); >> } >> DO_3SAME(INSN, gen_##INSN##_3s) >> >> The .fni8 function tells gvec that we have a helper that processes the >> operation in 8 byte chunks. It will handle the pass loop for you. >> >> There's also a .fni4 member, for those neon helpers that operate on 4-byte >> quantities, fwiw. > > Is there a version of this that works on functions that need > to be passed the cpu_env, or do I have to create a trampoline > function that just calls the real helper function passing it > the extra argument ?
A trampoline is required. The original intention of the hook is to expand some inline tcg ops. That it can be used to call a helper is a happy accident. For a helper that needs env, ideally we would use tcg_gen_gvec_ptr and handle the vector with one call. r~