]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, x86: small optimization in alu ops with imm
authorDaniel Borkmann <daniel@iogearbox.net>
Sat, 20 Jan 2018 00:24:35 +0000 (01:24 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 20 Jan 2018 02:37:00 +0000 (18:37 -0800)
commit5ae9511b289d957146c9e1e6817db00e609ca109
treeb2bb3ce980577d8736bd0174aefa53b5655bf74e
parentc0c3b2a2854a183b6d46f0168b2ac1e3a8c6bd1b
bpf, x86: small optimization in alu ops with imm

For the BPF_REG_0 (BPF_REG_A in cBPF, respectively), we can use
the short form of the opcode as dst mapping is on eax/rax and
thus save a byte per such operation. Added to add/sub/and/or/xor
for 32/64 bit when K immediate is used. There may be more such
low-hanging fruit to add in future as well.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/x86/net/bpf_jit_comp.c