diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2019-10-03 01:45:11 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-10-04 12:26:51 -0700 |
commit | 38f51c07054ff4796e473dba3bff2e648378002c (patch) | |
tree | ce408174555426e21490d6c86c7d32fb1a444d8e /tools/testing/selftests/bpf/progs/test_stacktrace_map.c | |
parent | c588146378962786ddeec817f7736a53298a7b01 (diff) |
bpf, x86: Small optimization in comparing against imm0
Replace 'cmp reg, 0' with 'test reg, reg' for comparisons against
zero. Saves 1 byte of instruction encoding per occurrence. The flag
results of test 'reg, reg' are identical to 'cmp reg, 0' in all
cases except for AF which we don't use/care about. In terms of
macro-fusibility in combination with a subsequent conditional jump
instruction, both have the same properties for the jumps used in
the JIT translation. For example, same JITed Cilium program can
shrink a bit from e.g. 12,455 to 12,317 bytes as tests with 0 are
used quite frequently.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_stacktrace_map.c')
0 files changed, 0 insertions, 0 deletions