diff options
author | Jie Meng <[email protected]> | 2021-10-01 20:56:26 -0700 |
---|---|---|
committer | Daniel Borkmann <[email protected]> | 2021-10-06 15:24:36 +0200 |
commit | 57a610f1c58fa493315e1c24eef6d992cdf4c4a9 (patch) | |
tree | b19776aea72a4c4a6bf2d48e8cebccd281375f6d /tools/perf/scripts/python/bin/export-to-sqlite-report | |
parent | 0640c77c46cb84328d5e08aa85a781a60be8b02b (diff) |
bpf, x64: Save bytes for DIV by reducing reg copies
Instead of unconditionally performing push/pop on %rax/%rdx in case of
division/modulo, we can save a few bytes in case of destination register
being either BPF r0 (%rax) or r3 (%rdx) since the result is written in
there anyway.
Also, we do not need to copy the source to %r11 unless the source is either
%rax, %rdx or an immediate.
For example, before the patch:
22: push %rax
23: push %rdx
24: mov %rsi,%r11
27: xor %edx,%edx
29: div %r11
2c: mov %rax,%r11
2f: pop %rdx
30: pop %rax
31: mov %r11,%rax
After:
22: push %rdx
23: xor %edx,%edx
25: div %rsi
28: pop %rdx
Signed-off-by: Jie Meng <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Tested-by: Daniel Borkmann <[email protected]>
Acked-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/perf/scripts/python/bin/export-to-sqlite-report')
0 files changed, 0 insertions, 0 deletions