[llvm] r327369 - bpf: Don't expand BSWAP on i32, promote it

Yonghong Song via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 23:47:05 PDT 2018


Author: yhs
Date: Mon Mar 12 23:47:05 2018
New Revision: 327369

URL: http://llvm.org/viewvc/llvm-project?rev=327369&view=rev
Log:
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 at netronome.com>
Signed-off-by: Yonghong Song <yhs at fb.com>

Modified:
    llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp

Modified: llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp?rev=327369&r1=327368&r2=327369&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/BPF/BPFISelLowering.cpp Mon Mar 12 23:47:05 2018
@@ -105,7 +105,7 @@ BPFTargetLowering::BPFTargetLowering(con
   }
 
   if (STI.getHasAlu32()) {
-    setOperationAction(ISD::BSWAP, MVT::i32, Expand);
+    setOperationAction(ISD::BSWAP, MVT::i32, Promote);
     setOperationAction(ISD::BR_CC, MVT::i32, Promote);
   }
 




More information about the llvm-commits mailing list