OSDN Git Service

bpf: add new insns for bswap_to_le and negation
authorYonghong Song <yhs@fb.com>
Thu, 28 Sep 2017 02:46:11 +0000 (02:46 +0000)
committerYonghong Song <yhs@fb.com>
Thu, 28 Sep 2017 02:46:11 +0000 (02:46 +0000)
commitdf6ca162269f9d756f8742bf4b658dcf690e3eb5
tree4ff61916c7ea3dca267b05fc48b3e94c7741692d
parente87cf87e451df1e4b22a690a12fc56de7834d25a
bpf: add new insns for bswap_to_le and negation

This patch adds new insn, "reg = be16/be32/be64 reg",
for bswap to little endian for big-endian target (bpfeb).
It also adds new insn for negation "reg = -reg".

Currently, for source code, e.g.,
  b = -a
LLVM still prefers to generate:
  b = 0 - a
But "reg = -reg" format can be used in assembly code.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314376 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/BPF/AsmParser/BPFAsmParser.cpp
lib/Target/BPF/BPFInstrFormats.td
lib/Target/BPF/BPFInstrInfo.td
test/CodeGen/BPF/intrinsics.ll
test/CodeGen/BPF/objdump_intrinsics.ll
test/MC/BPF/insn-unit-32.s
test/MC/BPF/insn-unit.s