1 ; RUN: llc < %s -mcpu=a2 -verify-machineinstrs | FileCheck %s
2 ; RUN: llc < %s -mcpu=a2 -disable-lsr -verify-machineinstrs | FileCheck -check-prefix=NOLSR %s
3 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
4 target triple = "powerpc64-unknown-linux-gnu"
6 define void @main() #0 {
8 br i1 undef, label %for.end, label %for.body
10 for.body: ; preds = %for.body, %entry
11 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
12 %indvars.iv.next = add i64 %indvars.iv, 1
13 %lftr.wideiv = trunc i64 %indvars.iv.next to i32
14 %exitcond = icmp eq i32 %lftr.wideiv, 0
15 br i1 %exitcond, label %for.end, label %for.body
18 ; CHECK: li [[REG:[0-9]+]], 0
19 ; CHECK: oris [[REG2:[0-9]+]], [[REG]], 65535
20 ; CHECK: ori [[REG3:[0-9]+]], [[REG2]], 65535
21 ; CHECK: mtctr [[REG3]]
24 for.end: ; preds = %for.body, %entry
28 define void @main1() #0 {
30 br i1 undef, label %for.end, label %for.body
32 for.body: ; preds = %for.body, %entry
33 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
34 %indvars.iv.next = add i64 %indvars.iv, 1
35 %exitcond = icmp eq i64 %indvars.iv.next, 0
36 br i1 %exitcond, label %for.end, label %for.body
38 ; FIXME: This should be a hardware loop.
39 ; cmp is optimized to uadd intrinsic in CGP pass which can not be recognized in
40 ; later HardwareLoops Pass.
42 ; CHECK: li [[REG:[0-9]+]], 1
43 ; CHECK: addi [[REG2:[0-9]+]], [[REG]], 1
47 for.end: ; preds = %for.body, %entry
51 define void @main2() #0 {
53 br i1 undef, label %for.end, label %for.body
55 for.body: ; preds = %for.body, %entry
56 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
57 %indvars.iv.next = add i64 %indvars.iv, 1
58 %exitcond = icmp eq i64 %indvars.iv.next, -100000
59 br i1 %exitcond, label %for.end, label %for.body
62 ; CHECK: lis [[REG:[0-9]+]], -2
63 ; CHECK: ori [[REG2:[0-9]+]], [[REG]], 31071
64 ; CHECK: mtctr [[REG2]]
67 for.end: ; preds = %for.body, %entry
71 define void @main3() #0 {
73 br i1 undef, label %for.end, label %for.body
75 for.body: ; preds = %for.body, %entry
76 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 127984, %entry ]
77 %indvars.iv.next = add i64 %indvars.iv, -16
78 %exitcond = icmp eq i64 %indvars.iv.next, -16
79 br i1 %exitcond, label %for.end, label %for.body
82 ; NOLSR: li [[REG:[0-9]+]], 8000
83 ; NOLSR: mtctr [[REG]]
86 for.end: ; preds = %for.body, %entry
90 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }