Home | History | Annotate | Download | only in Hexagon
      1 ;RUN: llc -march=hexagon < %s | FileCheck %s
      2 
      3 ; Test that a hardware loop is not generaetd due to a potential
      4 ; underflow.
      5 
      6 ; CHECK-NOT: loop0
      7 
      8 define i32 @main() #0 {
      9 entry:
     10   br label %while.cond.outer
     11 
     12 while.cond.outer.loopexit:
     13   %.lcssa = phi i32 [ %0, %for.body.preheader ]
     14   br label %while.cond.outer
     15 
     16 while.cond.outer:
     17   %i.0.ph = phi i32 [ 0, %entry ], [ 3, %while.cond.outer.loopexit ]
     18   %j.0.ph = phi i32 [ 0, %entry ], [ %.lcssa, %while.cond.outer.loopexit ]
     19   %k.0.ph = phi i32 [ 0, %entry ], [ 1, %while.cond.outer.loopexit ]
     20   br label %while.cond
     21 
     22 while.cond:
     23   %i.0 = phi i32 [ %i.0.ph, %while.cond.outer ], [ %inc, %for.body.preheader ]
     24   %j.0 = phi i32 [ %j.0.ph, %while.cond.outer ], [ %0, %for.body.preheader ]
     25   %inc = add nsw i32 %i.0, 1
     26   %cmp = icmp slt i32 %i.0, 4
     27   br i1 %cmp, label %for.body.preheader, label %while.end
     28 
     29 for.body.preheader:
     30   %0 = add i32 %j.0, 3
     31   %cmp5 = icmp eq i32 %inc, 3
     32   br i1 %cmp5, label %while.cond.outer.loopexit, label %while.cond
     33 
     34 while.end:
     35   %k.0.ph.lcssa = phi i32 [ %k.0.ph, %while.cond ]
     36   %inc.lcssa = phi i32 [ %inc, %while.cond ]
     37   %j.0.lcssa = phi i32 [ %j.0, %while.cond ]
     38   %cmp6 = icmp ne i32 %inc.lcssa, 5
     39   %cmp7 = icmp ne i32 %j.0.lcssa, 12
     40   %or.cond = or i1 %cmp6, %cmp7
     41   %cmp9 = icmp ne i32 %k.0.ph.lcssa, 1
     42   %or.cond12 = or i1 %or.cond, %cmp9
     43   %locflg.0 = zext i1 %or.cond12 to i32
     44   ret i32 %locflg.0
     45 }
     46