1; RUN: llc < %s -mtriple=powerpc-apple-darwin -mcpu=g4 | FileCheck %s 2; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=g4 | FileCheck %s 3 4; ModuleID = 'tsc.c' 5target 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-v128:128:128-n32:64" 6target triple = "powerpc64-unknown-linux-gnu" 7 8@a = common global [32000 x float] zeroinitializer, align 16 9@b = common global [32000 x float] zeroinitializer, align 16 10@c = common global [32000 x float] zeroinitializer, align 16 11@d = common global [32000 x float] zeroinitializer, align 16 12@e = common global [32000 x float] zeroinitializer, align 16 13@aa = common global [256 x [256 x float]] zeroinitializer, align 16 14@bb = common global [256 x [256 x float]] zeroinitializer, align 16 15@cc = common global [256 x [256 x float]] zeroinitializer, align 16 16@temp = common global float 0.000000e+00, align 4 17 18@.str81 = private unnamed_addr constant [6 x i8] c"s3110\00", align 1 19@.str235 = private unnamed_addr constant [15 x i8] c"S3110\09 %.2f \09\09\00", align 1 20 21declare i32 @printf(i8* nocapture, ...) nounwind 22declare i32 @init(i8* %name) nounwind 23declare i64 @clock() nounwind 24declare i32 @dummy(float*, float*, float*, float*, float*, [256 x float]*, [256 x float]*, [256 x float]*, float) 25declare void @check(i32 %name) nounwind 26 27; CHECK: mfcr 28; CHECK: mtcr 29 30define i32 @s3110() nounwind { 31entry: 32 %call = tail call i32 @init(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str81, i64 0, i64 0)) 33 %call1 = tail call i64 @clock() nounwind 34 br label %for.body 35 36for.body: ; preds = %for.end17, %entry 37 %nl.041 = phi i32 [ 0, %entry ], [ %inc22, %for.end17 ] 38 %0 = load float, float* getelementptr inbounds ([256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 0, i64 0), align 16 39 br label %for.cond5.preheader 40 41for.cond5.preheader: ; preds = %for.inc15, %for.body 42 %indvars.iv42 = phi i64 [ 0, %for.body ], [ %indvars.iv.next43, %for.inc15 ] 43 %max.139 = phi float [ %0, %for.body ], [ %max.3.15, %for.inc15 ] 44 %xindex.138 = phi i32 [ 0, %for.body ], [ %xindex.3.15, %for.inc15 ] 45 %yindex.137 = phi i32 [ 0, %for.body ], [ %yindex.3.15, %for.inc15 ] 46 br label %for.body7 47 48for.body7: ; preds = %for.body7, %for.cond5.preheader 49 %indvars.iv = phi i64 [ 0, %for.cond5.preheader ], [ %indvars.iv.next.15, %for.body7 ] 50 %max.235 = phi float [ %max.139, %for.cond5.preheader ], [ %max.3.15, %for.body7 ] 51 %xindex.234 = phi i32 [ %xindex.138, %for.cond5.preheader ], [ %xindex.3.15, %for.body7 ] 52 %yindex.233 = phi i32 [ %yindex.137, %for.cond5.preheader ], [ %yindex.3.15, %for.body7 ] 53 %arrayidx9 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv 54 %1 = load float, float* %arrayidx9, align 16 55 %cmp10 = fcmp ogt float %1, %max.235 56 %2 = trunc i64 %indvars.iv to i32 57 %yindex.3 = select i1 %cmp10, i32 %2, i32 %yindex.233 58 %3 = trunc i64 %indvars.iv42 to i32 59 %xindex.3 = select i1 %cmp10, i32 %3, i32 %xindex.234 60 %max.3 = select i1 %cmp10, float %1, float %max.235 61 %indvars.iv.next45 = or i64 %indvars.iv, 1 62 %arrayidx9.1 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next45 63 %4 = load float, float* %arrayidx9.1, align 4 64 %cmp10.1 = fcmp ogt float %4, %max.3 65 %5 = trunc i64 %indvars.iv.next45 to i32 66 %yindex.3.1 = select i1 %cmp10.1, i32 %5, i32 %yindex.3 67 %xindex.3.1 = select i1 %cmp10.1, i32 %3, i32 %xindex.3 68 %max.3.1 = select i1 %cmp10.1, float %4, float %max.3 69 %indvars.iv.next.146 = or i64 %indvars.iv, 2 70 %arrayidx9.2 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.146 71 %6 = load float, float* %arrayidx9.2, align 8 72 %cmp10.2 = fcmp ogt float %6, %max.3.1 73 %7 = trunc i64 %indvars.iv.next.146 to i32 74 %yindex.3.2 = select i1 %cmp10.2, i32 %7, i32 %yindex.3.1 75 %xindex.3.2 = select i1 %cmp10.2, i32 %3, i32 %xindex.3.1 76 %max.3.2 = select i1 %cmp10.2, float %6, float %max.3.1 77 %indvars.iv.next.247 = or i64 %indvars.iv, 3 78 %arrayidx9.3 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.247 79 %8 = load float, float* %arrayidx9.3, align 4 80 %cmp10.3 = fcmp ogt float %8, %max.3.2 81 %9 = trunc i64 %indvars.iv.next.247 to i32 82 %yindex.3.3 = select i1 %cmp10.3, i32 %9, i32 %yindex.3.2 83 %xindex.3.3 = select i1 %cmp10.3, i32 %3, i32 %xindex.3.2 84 %max.3.3 = select i1 %cmp10.3, float %8, float %max.3.2 85 %indvars.iv.next.348 = or i64 %indvars.iv, 4 86 %arrayidx9.4 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.348 87 %10 = load float, float* %arrayidx9.4, align 16 88 %cmp10.4 = fcmp ogt float %10, %max.3.3 89 %11 = trunc i64 %indvars.iv.next.348 to i32 90 %yindex.3.4 = select i1 %cmp10.4, i32 %11, i32 %yindex.3.3 91 %xindex.3.4 = select i1 %cmp10.4, i32 %3, i32 %xindex.3.3 92 %max.3.4 = select i1 %cmp10.4, float %10, float %max.3.3 93 %indvars.iv.next.449 = or i64 %indvars.iv, 5 94 %arrayidx9.5 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.449 95 %12 = load float, float* %arrayidx9.5, align 4 96 %cmp10.5 = fcmp ogt float %12, %max.3.4 97 %13 = trunc i64 %indvars.iv.next.449 to i32 98 %yindex.3.5 = select i1 %cmp10.5, i32 %13, i32 %yindex.3.4 99 %xindex.3.5 = select i1 %cmp10.5, i32 %3, i32 %xindex.3.4 100 %max.3.5 = select i1 %cmp10.5, float %12, float %max.3.4 101 %indvars.iv.next.550 = or i64 %indvars.iv, 6 102 %arrayidx9.6 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.550 103 %14 = load float, float* %arrayidx9.6, align 8 104 %cmp10.6 = fcmp ogt float %14, %max.3.5 105 %15 = trunc i64 %indvars.iv.next.550 to i32 106 %yindex.3.6 = select i1 %cmp10.6, i32 %15, i32 %yindex.3.5 107 %xindex.3.6 = select i1 %cmp10.6, i32 %3, i32 %xindex.3.5 108 %max.3.6 = select i1 %cmp10.6, float %14, float %max.3.5 109 %indvars.iv.next.651 = or i64 %indvars.iv, 7 110 %arrayidx9.7 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.651 111 %16 = load float, float* %arrayidx9.7, align 4 112 %cmp10.7 = fcmp ogt float %16, %max.3.6 113 %17 = trunc i64 %indvars.iv.next.651 to i32 114 %yindex.3.7 = select i1 %cmp10.7, i32 %17, i32 %yindex.3.6 115 %xindex.3.7 = select i1 %cmp10.7, i32 %3, i32 %xindex.3.6 116 %max.3.7 = select i1 %cmp10.7, float %16, float %max.3.6 117 %indvars.iv.next.752 = or i64 %indvars.iv, 8 118 %arrayidx9.8 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.752 119 %18 = load float, float* %arrayidx9.8, align 16 120 %cmp10.8 = fcmp ogt float %18, %max.3.7 121 %19 = trunc i64 %indvars.iv.next.752 to i32 122 %yindex.3.8 = select i1 %cmp10.8, i32 %19, i32 %yindex.3.7 123 %xindex.3.8 = select i1 %cmp10.8, i32 %3, i32 %xindex.3.7 124 %max.3.8 = select i1 %cmp10.8, float %18, float %max.3.7 125 %indvars.iv.next.853 = or i64 %indvars.iv, 9 126 %arrayidx9.9 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.853 127 %20 = load float, float* %arrayidx9.9, align 4 128 %cmp10.9 = fcmp ogt float %20, %max.3.8 129 %21 = trunc i64 %indvars.iv.next.853 to i32 130 %yindex.3.9 = select i1 %cmp10.9, i32 %21, i32 %yindex.3.8 131 %xindex.3.9 = select i1 %cmp10.9, i32 %3, i32 %xindex.3.8 132 %max.3.9 = select i1 %cmp10.9, float %20, float %max.3.8 133 %indvars.iv.next.954 = or i64 %indvars.iv, 10 134 %arrayidx9.10 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.954 135 %22 = load float, float* %arrayidx9.10, align 8 136 %cmp10.10 = fcmp ogt float %22, %max.3.9 137 %23 = trunc i64 %indvars.iv.next.954 to i32 138 %yindex.3.10 = select i1 %cmp10.10, i32 %23, i32 %yindex.3.9 139 %xindex.3.10 = select i1 %cmp10.10, i32 %3, i32 %xindex.3.9 140 %max.3.10 = select i1 %cmp10.10, float %22, float %max.3.9 141 %indvars.iv.next.1055 = or i64 %indvars.iv, 11 142 %arrayidx9.11 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.1055 143 %24 = load float, float* %arrayidx9.11, align 4 144 %cmp10.11 = fcmp ogt float %24, %max.3.10 145 %25 = trunc i64 %indvars.iv.next.1055 to i32 146 %yindex.3.11 = select i1 %cmp10.11, i32 %25, i32 %yindex.3.10 147 %xindex.3.11 = select i1 %cmp10.11, i32 %3, i32 %xindex.3.10 148 %max.3.11 = select i1 %cmp10.11, float %24, float %max.3.10 149 %indvars.iv.next.1156 = or i64 %indvars.iv, 12 150 %arrayidx9.12 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.1156 151 %26 = load float, float* %arrayidx9.12, align 16 152 %cmp10.12 = fcmp ogt float %26, %max.3.11 153 %27 = trunc i64 %indvars.iv.next.1156 to i32 154 %yindex.3.12 = select i1 %cmp10.12, i32 %27, i32 %yindex.3.11 155 %xindex.3.12 = select i1 %cmp10.12, i32 %3, i32 %xindex.3.11 156 %max.3.12 = select i1 %cmp10.12, float %26, float %max.3.11 157 %indvars.iv.next.1257 = or i64 %indvars.iv, 13 158 %arrayidx9.13 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.1257 159 %28 = load float, float* %arrayidx9.13, align 4 160 %cmp10.13 = fcmp ogt float %28, %max.3.12 161 %29 = trunc i64 %indvars.iv.next.1257 to i32 162 %yindex.3.13 = select i1 %cmp10.13, i32 %29, i32 %yindex.3.12 163 %xindex.3.13 = select i1 %cmp10.13, i32 %3, i32 %xindex.3.12 164 %max.3.13 = select i1 %cmp10.13, float %28, float %max.3.12 165 %indvars.iv.next.1358 = or i64 %indvars.iv, 14 166 %arrayidx9.14 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.1358 167 %30 = load float, float* %arrayidx9.14, align 8 168 %cmp10.14 = fcmp ogt float %30, %max.3.13 169 %31 = trunc i64 %indvars.iv.next.1358 to i32 170 %yindex.3.14 = select i1 %cmp10.14, i32 %31, i32 %yindex.3.13 171 %xindex.3.14 = select i1 %cmp10.14, i32 %3, i32 %xindex.3.13 172 %max.3.14 = select i1 %cmp10.14, float %30, float %max.3.13 173 %indvars.iv.next.1459 = or i64 %indvars.iv, 15 174 %arrayidx9.15 = getelementptr inbounds [256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 %indvars.iv42, i64 %indvars.iv.next.1459 175 %32 = load float, float* %arrayidx9.15, align 4 176 %cmp10.15 = fcmp ogt float %32, %max.3.14 177 %33 = trunc i64 %indvars.iv.next.1459 to i32 178 %yindex.3.15 = select i1 %cmp10.15, i32 %33, i32 %yindex.3.14 179 %xindex.3.15 = select i1 %cmp10.15, i32 %3, i32 %xindex.3.14 180 %max.3.15 = select i1 %cmp10.15, float %32, float %max.3.14 181 %indvars.iv.next.15 = add i64 %indvars.iv, 16 182 %lftr.wideiv.15 = trunc i64 %indvars.iv.next.15 to i32 183 %exitcond.15 = icmp eq i32 %lftr.wideiv.15, 256 184 br i1 %exitcond.15, label %for.inc15, label %for.body7 185 186for.inc15: ; preds = %for.body7 187 %indvars.iv.next43 = add i64 %indvars.iv42, 1 188 %lftr.wideiv = trunc i64 %indvars.iv.next43 to i32 189 %exitcond = icmp eq i32 %lftr.wideiv, 256 190 br i1 %exitcond, label %for.end17, label %for.cond5.preheader 191 192for.end17: ; preds = %for.inc15 193 %conv = sitofp i32 %xindex.3.15 to float 194 %add = fadd float %max.3.15, %conv 195 %conv18 = sitofp i32 %yindex.3.15 to float 196 %add19 = fadd float %add, %conv18 197 %call20 = tail call i32 @dummy(float* getelementptr inbounds ([32000 x float], [32000 x float]* @a, i64 0, i64 0), float* getelementptr inbounds ([32000 x float], [32000 x float]* @b, i64 0, i64 0), float* getelementptr inbounds ([32000 x float], [32000 x float]* @c, i64 0, i64 0), float* getelementptr inbounds ([32000 x float], [32000 x float]* @d, i64 0, i64 0), float* getelementptr inbounds ([32000 x float], [32000 x float]* @e, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]], [256 x [256 x float]]* @aa, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]], [256 x [256 x float]]* @bb, i64 0, i64 0), [256 x float]* getelementptr inbounds ([256 x [256 x float]], [256 x [256 x float]]* @cc, i64 0, i64 0), float %add19) nounwind 198 %inc22 = add nsw i32 %nl.041, 1 199 %exitcond44 = icmp eq i32 %inc22, 78100 200 br i1 %exitcond44, label %for.end23, label %for.body 201 202for.end23: ; preds = %for.end17 203 %call24 = tail call i64 @clock() nounwind 204 %sub = sub nsw i64 %call24, %call1 205 %conv25 = sitofp i64 %sub to double 206 %div = fdiv double %conv25, 1.000000e+06 207 %call26 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str235, i64 0, i64 0), double %div) nounwind 208 %add29 = fadd float %add, 1.000000e+00 209 %add31 = fadd float %add29, %conv18 210 %add32 = fadd float %add31, 1.000000e+00 211 store float %add32, float* @temp, align 4 212 tail call void @check(i32 -1) 213 ret i32 0 214} 215 216declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind 217 218declare i32 @puts(i8* nocapture) nounwind 219 220!3 = !{!"branch_weights", i32 64, i32 4} 221