Zinovy Nis | 07ac2bd | 2016-03-22 13:50:57 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -loop-reroll -verify-scev -S | FileCheck %s |
Elena Demikhovsky | 9914dbd | 2016-02-22 09:38:28 +0000 | [diff] [blame] | 2 | 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-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" |
| 3 | target triple = "x86_64-unknown-linux-gnu" |
| 4 | |
| 5 | ; void goo32(float alpha, float *a, float *b) { |
| 6 | ; for (int i = 0; i < 3200; i += 32) { |
| 7 | ; a[i] += alpha * b[i]; |
| 8 | ; a[i + 1] += alpha * b[i + 1]; |
| 9 | ; a[i + 2] += alpha * b[i + 2]; |
| 10 | ; a[i + 3] += alpha * b[i + 3]; |
| 11 | ; a[i + 4] += alpha * b[i + 4]; |
| 12 | ; a[i + 5] += alpha * b[i + 5]; |
| 13 | ; a[i + 6] += alpha * b[i + 6]; |
| 14 | ; a[i + 7] += alpha * b[i + 7]; |
| 15 | ; a[i + 8] += alpha * b[i + 8]; |
| 16 | ; a[i + 9] += alpha * b[i + 9]; |
| 17 | ; a[i + 10] += alpha * b[i + 10]; |
| 18 | ; a[i + 11] += alpha * b[i + 11]; |
| 19 | ; a[i + 12] += alpha * b[i + 12]; |
| 20 | ; a[i + 13] += alpha * b[i + 13]; |
| 21 | ; a[i + 14] += alpha * b[i + 14]; |
| 22 | ; a[i + 15] += alpha * b[i + 15]; |
| 23 | ; a[i + 16] += alpha * b[i + 16]; |
| 24 | ; a[i + 17] += alpha * b[i + 17]; |
| 25 | ; a[i + 18] += alpha * b[i + 18]; |
| 26 | ; a[i + 19] += alpha * b[i + 19]; |
| 27 | ; a[i + 20] += alpha * b[i + 20]; |
| 28 | ; a[i + 21] += alpha * b[i + 21]; |
| 29 | ; a[i + 22] += alpha * b[i + 22]; |
| 30 | ; a[i + 23] += alpha * b[i + 23]; |
| 31 | ; a[i + 24] += alpha * b[i + 24]; |
| 32 | ; a[i + 25] += alpha * b[i + 25]; |
| 33 | ; a[i + 26] += alpha * b[i + 26]; |
| 34 | ; a[i + 27] += alpha * b[i + 27]; |
| 35 | ; a[i + 28] += alpha * b[i + 28]; |
| 36 | ; a[i + 29] += alpha * b[i + 29]; |
| 37 | ; a[i + 30] += alpha * b[i + 30]; |
| 38 | ; a[i + 31] += alpha * b[i + 31]; |
| 39 | ; } |
| 40 | ; } |
| 41 | |
| 42 | ; Function Attrs: norecurse nounwind uwtable |
| 43 | define void @goo32(float %alpha, float* %a, float* readonly %b) #0 { |
| 44 | entry: |
| 45 | br label %for.body |
| 46 | |
| 47 | for.body: ; preds = %entry, %for.body |
| 48 | %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] |
| 49 | %arrayidx = getelementptr inbounds float, float* %b, i64 %indvars.iv |
| 50 | %0 = load float, float* %arrayidx, align 4 |
| 51 | %mul = fmul float %0, %alpha |
| 52 | %arrayidx2 = getelementptr inbounds float, float* %a, i64 %indvars.iv |
| 53 | %1 = load float, float* %arrayidx2, align 4 |
| 54 | %add = fadd float %1, %mul |
| 55 | store float %add, float* %arrayidx2, align 4 |
| 56 | %2 = or i64 %indvars.iv, 1 |
| 57 | %arrayidx5 = getelementptr inbounds float, float* %b, i64 %2 |
| 58 | %3 = load float, float* %arrayidx5, align 4 |
| 59 | %mul6 = fmul float %3, %alpha |
| 60 | %arrayidx9 = getelementptr inbounds float, float* %a, i64 %2 |
| 61 | %4 = load float, float* %arrayidx9, align 4 |
| 62 | %add10 = fadd float %4, %mul6 |
| 63 | store float %add10, float* %arrayidx9, align 4 |
| 64 | %5 = or i64 %indvars.iv, 2 |
| 65 | %arrayidx13 = getelementptr inbounds float, float* %b, i64 %5 |
| 66 | %6 = load float, float* %arrayidx13, align 4 |
| 67 | %mul14 = fmul float %6, %alpha |
| 68 | %arrayidx17 = getelementptr inbounds float, float* %a, i64 %5 |
| 69 | %7 = load float, float* %arrayidx17, align 4 |
| 70 | %add18 = fadd float %7, %mul14 |
| 71 | store float %add18, float* %arrayidx17, align 4 |
| 72 | %8 = or i64 %indvars.iv, 3 |
| 73 | %arrayidx21 = getelementptr inbounds float, float* %b, i64 %8 |
| 74 | %9 = load float, float* %arrayidx21, align 4 |
| 75 | %mul22 = fmul float %9, %alpha |
| 76 | %arrayidx25 = getelementptr inbounds float, float* %a, i64 %8 |
| 77 | %10 = load float, float* %arrayidx25, align 4 |
| 78 | %add26 = fadd float %10, %mul22 |
| 79 | store float %add26, float* %arrayidx25, align 4 |
| 80 | %11 = or i64 %indvars.iv, 4 |
| 81 | %arrayidx29 = getelementptr inbounds float, float* %b, i64 %11 |
| 82 | %12 = load float, float* %arrayidx29, align 4 |
| 83 | %mul30 = fmul float %12, %alpha |
| 84 | %arrayidx33 = getelementptr inbounds float, float* %a, i64 %11 |
| 85 | %13 = load float, float* %arrayidx33, align 4 |
| 86 | %add34 = fadd float %13, %mul30 |
| 87 | store float %add34, float* %arrayidx33, align 4 |
| 88 | %14 = or i64 %indvars.iv, 5 |
| 89 | %arrayidx37 = getelementptr inbounds float, float* %b, i64 %14 |
| 90 | %15 = load float, float* %arrayidx37, align 4 |
| 91 | %mul38 = fmul float %15, %alpha |
| 92 | %arrayidx41 = getelementptr inbounds float, float* %a, i64 %14 |
| 93 | %16 = load float, float* %arrayidx41, align 4 |
| 94 | %add42 = fadd float %16, %mul38 |
| 95 | store float %add42, float* %arrayidx41, align 4 |
| 96 | %17 = or i64 %indvars.iv, 6 |
| 97 | %arrayidx45 = getelementptr inbounds float, float* %b, i64 %17 |
| 98 | %18 = load float, float* %arrayidx45, align 4 |
| 99 | %mul46 = fmul float %18, %alpha |
| 100 | %arrayidx49 = getelementptr inbounds float, float* %a, i64 %17 |
| 101 | %19 = load float, float* %arrayidx49, align 4 |
| 102 | %add50 = fadd float %19, %mul46 |
| 103 | store float %add50, float* %arrayidx49, align 4 |
| 104 | %20 = or i64 %indvars.iv, 7 |
| 105 | %arrayidx53 = getelementptr inbounds float, float* %b, i64 %20 |
| 106 | %21 = load float, float* %arrayidx53, align 4 |
| 107 | %mul54 = fmul float %21, %alpha |
| 108 | %arrayidx57 = getelementptr inbounds float, float* %a, i64 %20 |
| 109 | %22 = load float, float* %arrayidx57, align 4 |
| 110 | %add58 = fadd float %22, %mul54 |
| 111 | store float %add58, float* %arrayidx57, align 4 |
| 112 | %23 = or i64 %indvars.iv, 8 |
| 113 | %arrayidx61 = getelementptr inbounds float, float* %b, i64 %23 |
| 114 | %24 = load float, float* %arrayidx61, align 4 |
| 115 | %mul62 = fmul float %24, %alpha |
| 116 | %arrayidx65 = getelementptr inbounds float, float* %a, i64 %23 |
| 117 | %25 = load float, float* %arrayidx65, align 4 |
| 118 | %add66 = fadd float %25, %mul62 |
| 119 | store float %add66, float* %arrayidx65, align 4 |
| 120 | %26 = or i64 %indvars.iv, 9 |
| 121 | %arrayidx69 = getelementptr inbounds float, float* %b, i64 %26 |
| 122 | %27 = load float, float* %arrayidx69, align 4 |
| 123 | %mul70 = fmul float %27, %alpha |
| 124 | %arrayidx73 = getelementptr inbounds float, float* %a, i64 %26 |
| 125 | %28 = load float, float* %arrayidx73, align 4 |
| 126 | %add74 = fadd float %28, %mul70 |
| 127 | store float %add74, float* %arrayidx73, align 4 |
| 128 | %29 = or i64 %indvars.iv, 10 |
| 129 | %arrayidx77 = getelementptr inbounds float, float* %b, i64 %29 |
| 130 | %30 = load float, float* %arrayidx77, align 4 |
| 131 | %mul78 = fmul float %30, %alpha |
| 132 | %arrayidx81 = getelementptr inbounds float, float* %a, i64 %29 |
| 133 | %31 = load float, float* %arrayidx81, align 4 |
| 134 | %add82 = fadd float %31, %mul78 |
| 135 | store float %add82, float* %arrayidx81, align 4 |
| 136 | %32 = or i64 %indvars.iv, 11 |
| 137 | %arrayidx85 = getelementptr inbounds float, float* %b, i64 %32 |
| 138 | %33 = load float, float* %arrayidx85, align 4 |
| 139 | %mul86 = fmul float %33, %alpha |
| 140 | %arrayidx89 = getelementptr inbounds float, float* %a, i64 %32 |
| 141 | %34 = load float, float* %arrayidx89, align 4 |
| 142 | %add90 = fadd float %34, %mul86 |
| 143 | store float %add90, float* %arrayidx89, align 4 |
| 144 | %35 = or i64 %indvars.iv, 12 |
| 145 | %arrayidx93 = getelementptr inbounds float, float* %b, i64 %35 |
| 146 | %36 = load float, float* %arrayidx93, align 4 |
| 147 | %mul94 = fmul float %36, %alpha |
| 148 | %arrayidx97 = getelementptr inbounds float, float* %a, i64 %35 |
| 149 | %37 = load float, float* %arrayidx97, align 4 |
| 150 | %add98 = fadd float %37, %mul94 |
| 151 | store float %add98, float* %arrayidx97, align 4 |
| 152 | %38 = or i64 %indvars.iv, 13 |
| 153 | %arrayidx101 = getelementptr inbounds float, float* %b, i64 %38 |
| 154 | %39 = load float, float* %arrayidx101, align 4 |
| 155 | %mul102 = fmul float %39, %alpha |
| 156 | %arrayidx105 = getelementptr inbounds float, float* %a, i64 %38 |
| 157 | %40 = load float, float* %arrayidx105, align 4 |
| 158 | %add106 = fadd float %40, %mul102 |
| 159 | store float %add106, float* %arrayidx105, align 4 |
| 160 | %41 = or i64 %indvars.iv, 14 |
| 161 | %arrayidx109 = getelementptr inbounds float, float* %b, i64 %41 |
| 162 | %42 = load float, float* %arrayidx109, align 4 |
| 163 | %mul110 = fmul float %42, %alpha |
| 164 | %arrayidx113 = getelementptr inbounds float, float* %a, i64 %41 |
| 165 | %43 = load float, float* %arrayidx113, align 4 |
| 166 | %add114 = fadd float %43, %mul110 |
| 167 | store float %add114, float* %arrayidx113, align 4 |
| 168 | %44 = or i64 %indvars.iv, 15 |
| 169 | %arrayidx117 = getelementptr inbounds float, float* %b, i64 %44 |
| 170 | %45 = load float, float* %arrayidx117, align 4 |
| 171 | %mul118 = fmul float %45, %alpha |
| 172 | %arrayidx121 = getelementptr inbounds float, float* %a, i64 %44 |
| 173 | %46 = load float, float* %arrayidx121, align 4 |
| 174 | %add122 = fadd float %46, %mul118 |
| 175 | store float %add122, float* %arrayidx121, align 4 |
| 176 | %47 = or i64 %indvars.iv, 16 |
| 177 | %arrayidx125 = getelementptr inbounds float, float* %b, i64 %47 |
| 178 | %48 = load float, float* %arrayidx125, align 4 |
| 179 | %mul126 = fmul float %48, %alpha |
| 180 | %arrayidx129 = getelementptr inbounds float, float* %a, i64 %47 |
| 181 | %49 = load float, float* %arrayidx129, align 4 |
| 182 | %add130 = fadd float %49, %mul126 |
| 183 | store float %add130, float* %arrayidx129, align 4 |
| 184 | %50 = or i64 %indvars.iv, 17 |
| 185 | %arrayidx133 = getelementptr inbounds float, float* %b, i64 %50 |
| 186 | %51 = load float, float* %arrayidx133, align 4 |
| 187 | %mul134 = fmul float %51, %alpha |
| 188 | %arrayidx137 = getelementptr inbounds float, float* %a, i64 %50 |
| 189 | %52 = load float, float* %arrayidx137, align 4 |
| 190 | %add138 = fadd float %52, %mul134 |
| 191 | store float %add138, float* %arrayidx137, align 4 |
| 192 | %53 = or i64 %indvars.iv, 18 |
| 193 | %arrayidx141 = getelementptr inbounds float, float* %b, i64 %53 |
| 194 | %54 = load float, float* %arrayidx141, align 4 |
| 195 | %mul142 = fmul float %54, %alpha |
| 196 | %arrayidx145 = getelementptr inbounds float, float* %a, i64 %53 |
| 197 | %55 = load float, float* %arrayidx145, align 4 |
| 198 | %add146 = fadd float %55, %mul142 |
| 199 | store float %add146, float* %arrayidx145, align 4 |
| 200 | %56 = or i64 %indvars.iv, 19 |
| 201 | %arrayidx149 = getelementptr inbounds float, float* %b, i64 %56 |
| 202 | %57 = load float, float* %arrayidx149, align 4 |
| 203 | %mul150 = fmul float %57, %alpha |
| 204 | %arrayidx153 = getelementptr inbounds float, float* %a, i64 %56 |
| 205 | %58 = load float, float* %arrayidx153, align 4 |
| 206 | %add154 = fadd float %58, %mul150 |
| 207 | store float %add154, float* %arrayidx153, align 4 |
| 208 | %59 = or i64 %indvars.iv, 20 |
| 209 | %arrayidx157 = getelementptr inbounds float, float* %b, i64 %59 |
| 210 | %60 = load float, float* %arrayidx157, align 4 |
| 211 | %mul158 = fmul float %60, %alpha |
| 212 | %arrayidx161 = getelementptr inbounds float, float* %a, i64 %59 |
| 213 | %61 = load float, float* %arrayidx161, align 4 |
| 214 | %add162 = fadd float %61, %mul158 |
| 215 | store float %add162, float* %arrayidx161, align 4 |
| 216 | %62 = or i64 %indvars.iv, 21 |
| 217 | %arrayidx165 = getelementptr inbounds float, float* %b, i64 %62 |
| 218 | %63 = load float, float* %arrayidx165, align 4 |
| 219 | %mul166 = fmul float %63, %alpha |
| 220 | %arrayidx169 = getelementptr inbounds float, float* %a, i64 %62 |
| 221 | %64 = load float, float* %arrayidx169, align 4 |
| 222 | %add170 = fadd float %64, %mul166 |
| 223 | store float %add170, float* %arrayidx169, align 4 |
| 224 | %65 = or i64 %indvars.iv, 22 |
| 225 | %arrayidx173 = getelementptr inbounds float, float* %b, i64 %65 |
| 226 | %66 = load float, float* %arrayidx173, align 4 |
| 227 | %mul174 = fmul float %66, %alpha |
| 228 | %arrayidx177 = getelementptr inbounds float, float* %a, i64 %65 |
| 229 | %67 = load float, float* %arrayidx177, align 4 |
| 230 | %add178 = fadd float %67, %mul174 |
| 231 | store float %add178, float* %arrayidx177, align 4 |
| 232 | %68 = or i64 %indvars.iv, 23 |
| 233 | %arrayidx181 = getelementptr inbounds float, float* %b, i64 %68 |
| 234 | %69 = load float, float* %arrayidx181, align 4 |
| 235 | %mul182 = fmul float %69, %alpha |
| 236 | %arrayidx185 = getelementptr inbounds float, float* %a, i64 %68 |
| 237 | %70 = load float, float* %arrayidx185, align 4 |
| 238 | %add186 = fadd float %70, %mul182 |
| 239 | store float %add186, float* %arrayidx185, align 4 |
| 240 | %71 = or i64 %indvars.iv, 24 |
| 241 | %arrayidx189 = getelementptr inbounds float, float* %b, i64 %71 |
| 242 | %72 = load float, float* %arrayidx189, align 4 |
| 243 | %mul190 = fmul float %72, %alpha |
| 244 | %arrayidx193 = getelementptr inbounds float, float* %a, i64 %71 |
| 245 | %73 = load float, float* %arrayidx193, align 4 |
| 246 | %add194 = fadd float %73, %mul190 |
| 247 | store float %add194, float* %arrayidx193, align 4 |
| 248 | %74 = or i64 %indvars.iv, 25 |
| 249 | %arrayidx197 = getelementptr inbounds float, float* %b, i64 %74 |
| 250 | %75 = load float, float* %arrayidx197, align 4 |
| 251 | %mul198 = fmul float %75, %alpha |
| 252 | %arrayidx201 = getelementptr inbounds float, float* %a, i64 %74 |
| 253 | %76 = load float, float* %arrayidx201, align 4 |
| 254 | %add202 = fadd float %76, %mul198 |
| 255 | store float %add202, float* %arrayidx201, align 4 |
| 256 | %77 = or i64 %indvars.iv, 26 |
| 257 | %arrayidx205 = getelementptr inbounds float, float* %b, i64 %77 |
| 258 | %78 = load float, float* %arrayidx205, align 4 |
| 259 | %mul206 = fmul float %78, %alpha |
| 260 | %arrayidx209 = getelementptr inbounds float, float* %a, i64 %77 |
| 261 | %79 = load float, float* %arrayidx209, align 4 |
| 262 | %add210 = fadd float %79, %mul206 |
| 263 | store float %add210, float* %arrayidx209, align 4 |
| 264 | %80 = or i64 %indvars.iv, 27 |
| 265 | %arrayidx213 = getelementptr inbounds float, float* %b, i64 %80 |
| 266 | %81 = load float, float* %arrayidx213, align 4 |
| 267 | %mul214 = fmul float %81, %alpha |
| 268 | %arrayidx217 = getelementptr inbounds float, float* %a, i64 %80 |
| 269 | %82 = load float, float* %arrayidx217, align 4 |
| 270 | %add218 = fadd float %82, %mul214 |
| 271 | store float %add218, float* %arrayidx217, align 4 |
| 272 | %83 = or i64 %indvars.iv, 28 |
| 273 | %arrayidx221 = getelementptr inbounds float, float* %b, i64 %83 |
| 274 | %84 = load float, float* %arrayidx221, align 4 |
| 275 | %mul222 = fmul float %84, %alpha |
| 276 | %arrayidx225 = getelementptr inbounds float, float* %a, i64 %83 |
| 277 | %85 = load float, float* %arrayidx225, align 4 |
| 278 | %add226 = fadd float %85, %mul222 |
| 279 | store float %add226, float* %arrayidx225, align 4 |
| 280 | %86 = or i64 %indvars.iv, 29 |
| 281 | %arrayidx229 = getelementptr inbounds float, float* %b, i64 %86 |
| 282 | %87 = load float, float* %arrayidx229, align 4 |
| 283 | %mul230 = fmul float %87, %alpha |
| 284 | %arrayidx233 = getelementptr inbounds float, float* %a, i64 %86 |
| 285 | %88 = load float, float* %arrayidx233, align 4 |
| 286 | %add234 = fadd float %88, %mul230 |
| 287 | store float %add234, float* %arrayidx233, align 4 |
| 288 | %89 = or i64 %indvars.iv, 30 |
| 289 | %arrayidx237 = getelementptr inbounds float, float* %b, i64 %89 |
| 290 | %90 = load float, float* %arrayidx237, align 4 |
| 291 | %mul238 = fmul float %90, %alpha |
| 292 | %arrayidx241 = getelementptr inbounds float, float* %a, i64 %89 |
| 293 | %91 = load float, float* %arrayidx241, align 4 |
| 294 | %add242 = fadd float %91, %mul238 |
| 295 | store float %add242, float* %arrayidx241, align 4 |
| 296 | %92 = or i64 %indvars.iv, 31 |
| 297 | %arrayidx245 = getelementptr inbounds float, float* %b, i64 %92 |
| 298 | %93 = load float, float* %arrayidx245, align 4 |
| 299 | %mul246 = fmul float %93, %alpha |
| 300 | %arrayidx249 = getelementptr inbounds float, float* %a, i64 %92 |
| 301 | %94 = load float, float* %arrayidx249, align 4 |
| 302 | %add250 = fadd float %94, %mul246 |
| 303 | store float %add250, float* %arrayidx249, align 4 |
| 304 | %indvars.iv.next = add nuw nsw i64 %indvars.iv, 32 |
| 305 | %cmp = icmp slt i64 %indvars.iv.next, 3200 |
| 306 | br i1 %cmp, label %for.body, label %for.end |
| 307 | |
| 308 | ; CHECK-LABEL: @goo32 |
| 309 | |
| 310 | ; CHECK: for.body: |
| 311 | ; CHECK: %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ] |
| 312 | ; CHECK: %arrayidx = getelementptr inbounds float, float* %b, i64 %indvar |
| 313 | ; CHECK: %0 = load float, float* %arrayidx, align 4 |
| 314 | ; CHECK: %mul = fmul float %0, %alpha |
| 315 | ; CHECK: %arrayidx2 = getelementptr inbounds float, float* %a, i64 %indvar |
| 316 | ; CHECK: %1 = load float, float* %arrayidx2, align 4 |
| 317 | ; CHECK: %add = fadd float %1, %mul |
| 318 | ; CHECK: store float %add, float* %arrayidx2, align 4 |
| 319 | ; CHECK: %indvar.next = add i64 %indvar, 1 |
| 320 | ; CHECK: %exitcond = icmp eq i64 %indvar, 3199 |
| 321 | ; CHECK: br i1 %exitcond, label %for.end, label %for.body |
| 322 | ; CHECK: ret |
| 323 | |
| 324 | for.end: ; preds = %for.body |
| 325 | ret void |
| 326 | } |
| 327 | |
| 328 | attributes #0 = { nounwind uwtable } |