[PATCH] D133464: [WIP][BPF] Add sext load instructions

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 18:11:21 PDT 2022


yonghong-song created this revision.
yonghong-song added reviewers: ast, anakryiko.
Herald added a subscriber: hiraditya.
Herald added a project: All.
yonghong-song requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Add sign-extension load instructions.

For kernel bpf selftest pyperf180, the number of
instructions without this patch is 91472. With this
patch, the number of instructions is 80652. Most improvements
come from

  r1 = *(u32 *)(r8 + 12) 
  r1 <<= 32
  r1 s>>= 32

to

  r1 = *(s32 *)(r8 + 12) 

Such a new instruction not only improves bpf code, but 
can also improve jitted code since most architecture
has explicit sign extension insntructions.

To-Do list:

- put the new functionality into e.g, -mcpu=v4
- implement the linux kernel part to support the new insn


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133464

Files:
  llvm/lib/Target/BPF/BPFISelLowering.cpp
  llvm/lib/Target/BPF/BPFInstrFormats.td
  llvm/lib/Target/BPF/BPFInstrInfo.td
  llvm/lib/Target/BPF/Disassembler/BPFDisassembler.cpp
  llvm/test/CodeGen/BPF/sext.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133464.458618.patch
Type: text/x-patch
Size: 9699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220908/f8834a6a/attachment-0001.bin>


More information about the llvm-commits mailing list