1 ; Test some complicated looping constructs to ensure that they 2 ; compile successfully and that some sort of branching is used 3 ; in the resulting code. 4 ; 5 ; RUN: llc < %s -march=mblaze -mattr=+mul,+fpu,+barrel | FileCheck %s 6 7 declare i32 @printf(i8*, ...) 8 @MSG = internal constant [19 x i8] c"Message: %d %d %d\0A\00" 9 10 define i32 @loop(i32 %a, i32 %b) 11 { 12 ; CHECK: loop: 13 entry: 14 br label %loop_outer 15 16 loop_outer: 17 %outer.0 = phi i32 [ 0, %entry ], [ %outer.2, %loop_outer_finish ] 18 br label %loop_inner 19 20 loop_inner: 21 %inner.0 = phi i32 [ %a, %loop_outer ], [ %inner.3, %loop_inner_finish ] 22 %inner.1 = phi i32 [ %b, %loop_outer ], [ %inner.4, %loop_inner_finish ] 23 %inner.2 = phi i32 [ 0, %loop_outer ], [ %inner.5, %loop_inner_finish ] 24 %inner.3 = add i32 %inner.0, %inner.1 25 %inner.4 = mul i32 %inner.2, 11 26 br label %loop_inner_finish 27 28 loop_inner_finish: 29 %inner.5 = add i32 %inner.2, 1 30 call i32 (i8*,...)* @printf( i8* getelementptr([19 x i8]* @MSG,i32 0,i32 0), 31 i32 %inner.0, i32 %inner.1, i32 %inner.2 ) 32 33 %inner.6 = icmp eq i32 %inner.5, 100 34 ; CHECK: cmp [[REG:r[0-9]*]] 35 36 br i1 %inner.6, label %loop_inner, label %loop_outer_finish 37 ; CHECK: {{beqid|bneid}} [[REG]] 38 39 loop_outer_finish: 40 %outer.1 = add i32 %outer.0, 1 41 %outer.2 = urem i32 %outer.1, 1500 42 br label %loop_outer 43 ; CHECK: br 44 } 45