OSDN Git Service

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)
commitde0a444ddae61b77683c27cd390e518e33858d20
treeb2bb3ce980577d8736bd0174aefa53b5655bf74e
parent2e4a30983b0f9b19b59e38bbf7427d7fdd480d98
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