bpf: Don't expand BSWAP on i32, promote it

Currently, there is no ALU32 bswap support in eBPF ISA.

BSWAP on i32 was set to EXPAND which would need about eight instructions
for single BSWAP.

It would be more efficient to promote it to i64, then doing BSWAP on i64.
For eBPF programs, most of the promotion are zero extensions which are
likely be elimiated later by peephole optimizations.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 327369
This commit is contained in:
Yonghong Song 2018-03-13 06:47:05 +00:00
parent 1d28a759d9
commit 80b882ecc5
1 changed files with 1 additions and 1 deletions

View File

@ -105,7 +105,7 @@ BPFTargetLowering::BPFTargetLowering(const TargetMachine &TM,
} }
if (STI.getHasAlu32()) { if (STI.getHasAlu32()) {
setOperationAction(ISD::BSWAP, MVT::i32, Expand); setOperationAction(ISD::BSWAP, MVT::i32, Promote);
setOperationAction(ISD::BR_CC, MVT::i32, Promote); setOperationAction(ISD::BR_CC, MVT::i32, Promote);
} }