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]+]], -1
19 ; CHECK: rldic [[REG2:[0-9]+]], [[REG]], 0, 32
20 ; CHECK: mtctr [[REG2]]
23 for.end: ; preds = %for.body, %entry
27 define void @main1() #0 {
29 br i1 undef, label %for.end, label %for.body
31 for.body: ; preds = %for.body, %entry
32 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
33 %indvars.iv.next = add i64 %indvars.iv, 1
34 %exitcond = icmp eq i64 %indvars.iv.next, 0
35 br i1 %exitcond, label %for.end, label %for.body
38 ; CHECK: li [[REG:[0-9]+]], -1
39 ; CHECK: mtctr [[REG]]
42 for.end: ; preds = %for.body, %entry
46 define void @main2() #0 {
48 br i1 undef, label %for.end, label %for.body
50 for.body: ; preds = %for.body, %entry
51 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
52 %indvars.iv.next = add i64 %indvars.iv, 1
53 %exitcond = icmp eq i64 %indvars.iv.next, -100000
54 br i1 %exitcond, label %for.end, label %for.body
57 ; CHECK: lis [[REG:[0-9]+]], -2
58 ; CHECK: ori [[REG2:[0-9]+]], [[REG]], 31071
59 ; CHECK: mtctr [[REG2]]
62 for.end: ; preds = %for.body, %entry
66 define void @main3() #0 {
68 br i1 undef, label %for.end, label %for.body
70 for.body: ; preds = %for.body, %entry
71 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 127984, %entry ]
72 %indvars.iv.next = add i64 %indvars.iv, -16
73 %exitcond = icmp eq i64 %indvars.iv.next, -16
74 br i1 %exitcond, label %for.end, label %for.body
77 ; NOLSR: li [[REG:[0-9]+]], 8000
78 ; NOLSR: mtctr [[REG]]
81 for.end: ; preds = %for.body, %entry
85 attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }