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