This test need the X86 backend, move it to the X86 sub directory.
[oota-llvm.git] / test / Transforms / LoopStrengthReduce / nested-reduce.ll
index ebef2f0fdf24deb4c899e7afeca4ebd79774e3ca..58b8d3eecd030fba4a8a930bb6955533c87a0354 100644 (file)
@@ -1,57 +1,49 @@
-; RUN: llvm-as < %s | opt -loop-reduce &&
-; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | not grep mul
+; RUN: opt < %s -loop-reduce -S | not grep mul
 
 ; Make sure we don't get a multiply by 6 in this loop.
 
-int %foo(int %A, int %B, int %C, int %D) {
+define i32 @foo(i32 %A, i32 %B, i32 %C, i32 %D) {
 entry:
-       %tmp.5 = setgt int %C, 0                ; <bool> [#uses=1]
-       %tmp.25 = and int %A, 1         ; <int> [#uses=1]
+       %tmp.5 = icmp sgt i32 %C, 0             ; <i1> [#uses=1]
+       %tmp.25 = and i32 %A, 1         ; <i32> [#uses=1]
        br label %loopentry.1
-
 loopentry.1:           ; preds = %loopexit.1, %entry
-       %indvar20 = phi uint [ 0, %entry ], [ %indvar.next21, %loopexit.1 ]             ; <uint> [#uses=2]
-       %k.1 = phi int [ 0, %entry ], [ %k.1.3, %loopexit.1 ]           ; <int> [#uses=2]
-       br bool %tmp.5, label %no_exit.1.preheader, label %loopexit.1
-
+       %indvar20 = phi i32 [ 0, %entry ], [ %indvar.next21, %loopexit.1 ]              ; <i32> [#uses=2]
+       %k.1 = phi i32 [ 0, %entry ], [ %k.1.3, %loopexit.1 ]           ; <i32> [#uses=2]
+       br i1 %tmp.5, label %no_exit.1.preheader, label %loopexit.1
 no_exit.1.preheader:           ; preds = %loopentry.1
-       %i.0.0 = cast uint %indvar20 to int             ; <int> [#uses=1]
-       %tmp.9 = mul int %i.0.0, 6              ; <int> [#uses=1]
+       %i.0.0 = bitcast i32 %indvar20 to i32           ; <i32> [#uses=1]
+       %tmp.9 = mul i32 %i.0.0, 6              ; <i32> [#uses=1]
        br label %no_exit.1.outer
-
 no_exit.1.outer:               ; preds = %cond_true, %no_exit.1.preheader
-       %k.1.2.ph = phi int [ %k.1, %no_exit.1.preheader ], [ %k.09, %cond_true ]               ; <int> [#uses=2]
-       %j.1.2.ph = phi int [ 0, %no_exit.1.preheader ], [ %inc.1, %cond_true ]         ; <int> [#uses=1]
+       %k.1.2.ph = phi i32 [ %k.1, %no_exit.1.preheader ], [ %k.09, %cond_true ]               ; <i32> [#uses=2]
+       %j.1.2.ph = phi i32 [ 0, %no_exit.1.preheader ], [ %inc.1, %cond_true ]         ; <i32> [#uses=1]
        br label %no_exit.1
-
 no_exit.1:             ; preds = %cond_continue, %no_exit.1.outer
-       %indvar = phi uint [ 0, %no_exit.1.outer ], [ %indvar.next, %cond_continue ]            ; <uint> [#uses=2]
-       %indvar = cast uint %indvar to int              ; <int> [#uses=1]
-       %j.1.2 = add int %indvar, %j.1.2.ph             ; <int> [#uses=2]
-       %tmp.11 = add int %j.1.2, %tmp.9                ; <int> [#uses=1]
-       %tmp.12 = cast int %tmp.11 to ubyte             ; <ubyte> [#uses=1]
-       %tmp.13 = shl int %D, ubyte %tmp.12             ; <int> [#uses=2]
-       %tmp.15 = seteq int %tmp.13, %B         ; <bool> [#uses=1]
-       %inc.1 = add int %j.1.2, 1              ; <int> [#uses=3]
-       br bool %tmp.15, label %cond_true, label %cond_continue
-
+       %indvar.ui = phi i32 [ 0, %no_exit.1.outer ], [ %indvar.next, %cond_continue ]          ; <i32> [#uses=2]
+       %indvar = bitcast i32 %indvar.ui to i32         ; <i32> [#uses=1]
+       %j.1.2 = add i32 %indvar, %j.1.2.ph             ; <i32> [#uses=2]
+       %tmp.11 = add i32 %j.1.2, %tmp.9                ; <i32> [#uses=1]
+       %tmp.12 = trunc i32 %tmp.11 to i8               ; <i8> [#uses=1]
+       %shift.upgrd.1 = zext i8 %tmp.12 to i32         ; <i32> [#uses=1]
+       %tmp.13 = shl i32 %D, %shift.upgrd.1            ; <i32> [#uses=2]
+       %tmp.15 = icmp eq i32 %tmp.13, %B               ; <i1> [#uses=1]
+       %inc.1 = add i32 %j.1.2, 1              ; <i32> [#uses=3]
+       br i1 %tmp.15, label %cond_true, label %cond_continue
 cond_true:             ; preds = %no_exit.1
-       %tmp.26 = and int %tmp.25, %tmp.13              ; <int> [#uses=1]
-       %k.09 = add int %tmp.26, %k.1.2.ph              ; <int> [#uses=2]
-       %tmp.517 = setlt int %inc.1, %C         ; <bool> [#uses=1]
-       br bool %tmp.517, label %no_exit.1.outer, label %loopexit.1
-
+       %tmp.26 = and i32 %tmp.25, %tmp.13              ; <i32> [#uses=1]
+       %k.09 = add i32 %tmp.26, %k.1.2.ph              ; <i32> [#uses=2]
+       %tmp.517 = icmp slt i32 %inc.1, %C              ; <i1> [#uses=1]
+       br i1 %tmp.517, label %no_exit.1.outer, label %loopexit.1
 cond_continue:         ; preds = %no_exit.1
-       %tmp.519 = setlt int %inc.1, %C         ; <bool> [#uses=1]
-       %indvar.next = add uint %indvar, 1              ; <uint> [#uses=1]
-       br bool %tmp.519, label %no_exit.1, label %loopexit.1
-
+       %tmp.519 = icmp slt i32 %inc.1, %C              ; <i1> [#uses=1]
+       %indvar.next = add i32 %indvar.ui, 1            ; <i32> [#uses=1]
+       br i1 %tmp.519, label %no_exit.1, label %loopexit.1
 loopexit.1:            ; preds = %cond_continue, %cond_true, %loopentry.1
-       %k.1.3 = phi int [ %k.1, %loopentry.1 ], [ %k.09, %cond_true ], [ %k.1.2.ph, %cond_continue ]           ; <int> [#uses=2]
-       %indvar.next21 = add uint %indvar20, 1          ; <uint> [#uses=2]
-       %exitcond = seteq uint %indvar.next21, 4                ; <bool> [#uses=1]
-       br bool %exitcond, label %loopexit.0, label %loopentry.1
-
+       %k.1.3 = phi i32 [ %k.1, %loopentry.1 ], [ %k.09, %cond_true ], [ %k.1.2.ph, %cond_continue ]           ; <i32> [#uses=2]
+       %indvar.next21 = add i32 %indvar20, 1           ; <i32> [#uses=2]
+       %exitcond = icmp eq i32 %indvar.next21, 4               ; <i1> [#uses=1]
+       br i1 %exitcond, label %loopexit.0, label %loopentry.1
 loopexit.0:            ; preds = %loopexit.1
-       ret int %k.1.3
+       ret i32 %k.1.3
 }