bpf: Improve expanding logic in LowerSELECT_CC

LowerSELECT_CC is not generating optimal Select_Ri pattern at the moment. It
is not guaranteed to place ConstantNode at RHS which would miss matching
Select_Ri.

A new testcase added into the existing select_ri.ll, also there is an
existing case in cmp.ll which would be improved to use Select_Ri after this
patch, it is adjusted accordingly.

Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
llvm-svn: 324560
diff --git a/llvm/test/CodeGen/BPF/cmp.ll b/llvm/test/CodeGen/BPF/cmp.ll
index 66345ab..e12f4a9 100644
--- a/llvm/test/CodeGen/BPF/cmp.ll
+++ b/llvm/test/CodeGen/BPF/cmp.ll
@@ -97,7 +97,7 @@
   %a.b = select i1 %1, i8 %a, i8 %b
   ret i8 %a.b
 ; CHECK-LABEL:minu:
-; CHECK: if r3 > r1
+; CHECK: if r{{[0-9]+}} {{<|>}} 100
 }
 
 ; Function Attrs: nounwind readnone uwtable