Re: [PATCH v2 bpf-next] bpf,x64: Save bytes for DIV by reducing reg copies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 1, 2021 at 8:56 PM Jie Meng <jmeng@xxxxxx> wrote:
>
> Instead of unconditionally performing push/pop on rax/rdx in case of
> division/modulo, we can save a few bytes in case of dest register
> being either BPF r0 (rax) or r3 (rdx) since the result is written in
> there anyway.
>
> Also, we do not need to copy src to r11 unless src 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
>   34:   leaveq
>   35:   retq
>
> After:
>   22:   push   %rdx
>   23:   xor    %edx,%edx
>   25:   div    %rsi
>   28:   pop    %rdx
>   29:   leaveq
>   2a:   retq
>
> Signed-off-by: Jie Meng <jmeng@xxxxxx>

Applied. Thanks



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux