d344fadbf3d2f89e7c77264c4eac76870b05039d
[oota-llvm.git] / test / CodeGen / Blackfin / promote-setcc.ll
1 ; RUN: llc < %s -march=bfin > %t
2
3 ; The DAG combiner may sometimes create illegal i16 SETCC operations when run
4 ; after LegalizeOps. Try to tease out all the optimizations in
5 ; TargetLowering::SimplifySetCC.
6
7 @x = external global i16
8 @y = external global i16
9
10 declare i16 @llvm.ctlz.i16(i16)
11
12 ; Case (srl (ctlz x), 5) == const
13 ; Note: ctlz is promoted, so this test does not catch the DAG combiner
14 define i1 @srl_ctlz_const() {
15   %x = load i16* @x
16   %c = call i16 @llvm.ctlz.i16(i16 %x)
17   %s = lshr i16 %c, 4
18   %r = icmp eq i16 %s, 1
19   ret i1 %r
20 }
21
22 ; Case (zext x) == const
23 define i1 @zext_const() {
24   %x = load i16* @x
25   %r = icmp ugt i16 %x, 1
26   ret i1 %r
27 }
28
29 ; Case (sext x) == const
30 define i1 @sext_const() {
31   %x = load i16* @x
32   %y = add i16 %x, 1
33   %x2 = sext i16 %y to i32
34   %r = icmp ne i32 %x2, -1
35   ret i1 %r
36 }
37