bpf: Support condition comparison on i32
authorYonghong Song <yhs@fb.com>
Fri, 23 Feb 2018 23:49:25 +0000 (23:49 +0000)
committerYonghong Song <yhs@fb.com>
Fri, 23 Feb 2018 23:49:25 +0000 (23:49 +0000)
commit59fc805c7e2e8edab9cc1adc2d91bb3d42971520
treecbfb63a7e0b7190fa3eb032cef0c67d657155604
parent219156cff0ee9ab8a363ba978a9d77ef987d0122
bpf: Support condition comparison on i32

We need to support condition comparison on i32. All these comparisons are
supposed to be combined into BPF_J* instructions which only support i64.

For ISD::BR_CC we need to promote it to i64 first, then do custom lowering.

For ISD::SET_CC, just expand to SELECT_CC like what's been done for i64.

For ISD::SELECT_CC, we also want to do custom lower for i32. However, after
32-bit subregister support enabled, it is possible the comparison operands
are i32 while the selected value are i64, or the comparison operands are
i64 while the selected value are i32. We need to define extra instruction
pattern and support them in custom instruction inserter.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 325985
llvm/lib/Target/BPF/BPFISelLowering.cpp
llvm/lib/Target/BPF/BPFISelLowering.h
llvm/lib/Target/BPF/BPFInstrInfo.td