diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-04-24 21:22:37 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-04-25 09:56:10 +0200 |
commit | 6c59500c2dbfae0e3c90854ef443948d2889495d (patch) | |
tree | 0ad0b3cf7ace13bc02338e6408b4bd45013f5b86 /drivers/net/ethernet/netronome/nfp/nfp_asm.h | |
parent | 9c9e53233c281ed6c00425b165c4dd7fd0881cd5 (diff) | |
download | blackbird-obmc-linux-6c59500c2dbfae0e3c90854ef443948d2889495d.tar.gz blackbird-obmc-linux-6c59500c2dbfae0e3c90854ef443948d2889495d.zip |
nfp: bpf: optimize add/sub of a negative constant
NFP instruction set can fit small immediates into the instruction.
Negative integers, however, will never fit because they will have
highest bit set. If we swap the ALU op between ADD and SUB and
negate the constant we have a better chance of fitting small negative
integers into the instruction itself and saving one or two cycles.
immed[gprB_21, 0xfffffffc]
alu[gprA_4, gprA_4, +, gprB_21], gpr_wrboth
immed[gprB_21, 0xffffffff]
alu[gprA_5, gprA_5, +carry, gprB_21], gpr_wrboth
now becomes:
alu[gprA_4, gprA_4, -, 4], gpr_wrboth
alu[gprA_5, gprA_5, -carry, 0], gpr_wrboth
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_asm.h')
0 files changed, 0 insertions, 0 deletions