On Mon, Jun 24, 2019 at 9:45 AM Jiong Wang <jiong.wang@xxxxxxxxxxxxx> wrote: > > Looks to me 32-bit optimization is not enabled. > > If you define bpf_jit_needs_zext to return true > > bool bpf_jit_needs_zext(void) > { > return true; > } > > Then you don't need to zero high 32-bit when writing 32-bit sub-register > and you just need to implement the explicit zero extension insn which is a > special variant of BPF_MOV. This can save quite a few instructions. RV64 > and arches like arm has implemented this, please search > "aux->verifier_zext". > > And there is a doc for this optimization: > > https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/Documentation/bpf/bpf_design_QA.rst#n168 Thanks for the pointer. I'll add this optimization before sending out an updated version of the patch. – Luke