From 87576cc8b8e897dff3e61e0ae08403663cc18fa9 Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Tue, 13 Mar 2018 06:47:05 +0000 Subject: [PATCH] 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 Signed-off-by: Yonghong Song git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327369 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/BPF/BPFISelLowering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Target/BPF/BPFISelLowering.cpp b/lib/Target/BPF/BPFISelLowering.cpp index 4ad99e798fb..e02cdf579d2 100644 --- a/lib/Target/BPF/BPFISelLowering.cpp +++ b/lib/Target/BPF/BPFISelLowering.cpp @@ -105,7 +105,7 @@ BPFTargetLowering::BPFTargetLowering(const TargetMachine &TM, } if (STI.getHasAlu32()) { - setOperationAction(ISD::BSWAP, MVT::i32, Expand); + setOperationAction(ISD::BSWAP, MVT::i32, Promote); setOperationAction(ISD::BR_CC, MVT::i32, Promote); } -- 2.11.0