1 ; RUN: opt < %s -loop-vectorize -force-vector-unroll=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s 2 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-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 4 target triple = "x86_64-unknown-linux-gnu" 5 6 ;CHECK-LABEL: @sqrt_f32( 7 ;CHECK: llvm.sqrt.v4f32 8 ;CHECK: ret void 9 define void @sqrt_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 10 entry: 11 %cmp6 = icmp sgt i32 %n, 0 12 br i1 %cmp6, label %for.body, label %for.end 13 14 for.body: ; preds = %entry, %for.body 15 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 16 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 17 %0 = load float* %arrayidx, align 4 18 %call = tail call float @llvm.sqrt.f32(float %0) nounwind readnone 19 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 20 store float %call, float* %arrayidx2, align 4 21 %indvars.iv.next = add i64 %indvars.iv, 1 22 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 23 %exitcond = icmp eq i32 %lftr.wideiv, %n 24 br i1 %exitcond, label %for.end, label %for.body 25 26 for.end: ; preds = %for.body, %entry 27 ret void 28 } 29 30 declare float @llvm.sqrt.f32(float) nounwind readnone 31 32 ;CHECK-LABEL: @sqrt_f64( 33 ;CHECK: llvm.sqrt.v4f64 34 ;CHECK: ret void 35 define void @sqrt_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 36 entry: 37 %cmp6 = icmp sgt i32 %n, 0 38 br i1 %cmp6, label %for.body, label %for.end 39 40 for.body: ; preds = %entry, %for.body 41 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 42 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 43 %0 = load double* %arrayidx, align 8 44 %call = tail call double @llvm.sqrt.f64(double %0) nounwind readnone 45 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 46 store double %call, double* %arrayidx2, align 8 47 %indvars.iv.next = add i64 %indvars.iv, 1 48 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 49 %exitcond = icmp eq i32 %lftr.wideiv, %n 50 br i1 %exitcond, label %for.end, label %for.body 51 52 for.end: ; preds = %for.body, %entry 53 ret void 54 } 55 56 declare double @llvm.sqrt.f64(double) nounwind readnone 57 58 ;CHECK-LABEL: @sin_f32( 59 ;CHECK: llvm.sin.v4f32 60 ;CHECK: ret void 61 define void @sin_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 62 entry: 63 %cmp6 = icmp sgt i32 %n, 0 64 br i1 %cmp6, label %for.body, label %for.end 65 66 for.body: ; preds = %entry, %for.body 67 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 68 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 69 %0 = load float* %arrayidx, align 4 70 %call = tail call float @llvm.sin.f32(float %0) nounwind readnone 71 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 72 store float %call, float* %arrayidx2, align 4 73 %indvars.iv.next = add i64 %indvars.iv, 1 74 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 75 %exitcond = icmp eq i32 %lftr.wideiv, %n 76 br i1 %exitcond, label %for.end, label %for.body 77 78 for.end: ; preds = %for.body, %entry 79 ret void 80 } 81 82 declare float @llvm.sin.f32(float) nounwind readnone 83 84 ;CHECK-LABEL: @sin_f64( 85 ;CHECK: llvm.sin.v4f64 86 ;CHECK: ret void 87 define void @sin_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 88 entry: 89 %cmp6 = icmp sgt i32 %n, 0 90 br i1 %cmp6, label %for.body, label %for.end 91 92 for.body: ; preds = %entry, %for.body 93 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 94 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 95 %0 = load double* %arrayidx, align 8 96 %call = tail call double @llvm.sin.f64(double %0) nounwind readnone 97 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 98 store double %call, double* %arrayidx2, align 8 99 %indvars.iv.next = add i64 %indvars.iv, 1 100 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 101 %exitcond = icmp eq i32 %lftr.wideiv, %n 102 br i1 %exitcond, label %for.end, label %for.body 103 104 for.end: ; preds = %for.body, %entry 105 ret void 106 } 107 108 declare double @llvm.sin.f64(double) nounwind readnone 109 110 ;CHECK-LABEL: @cos_f32( 111 ;CHECK: llvm.cos.v4f32 112 ;CHECK: ret void 113 define void @cos_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 114 entry: 115 %cmp6 = icmp sgt i32 %n, 0 116 br i1 %cmp6, label %for.body, label %for.end 117 118 for.body: ; preds = %entry, %for.body 119 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 120 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 121 %0 = load float* %arrayidx, align 4 122 %call = tail call float @llvm.cos.f32(float %0) nounwind readnone 123 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 124 store float %call, float* %arrayidx2, align 4 125 %indvars.iv.next = add i64 %indvars.iv, 1 126 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 127 %exitcond = icmp eq i32 %lftr.wideiv, %n 128 br i1 %exitcond, label %for.end, label %for.body 129 130 for.end: ; preds = %for.body, %entry 131 ret void 132 } 133 134 declare float @llvm.cos.f32(float) nounwind readnone 135 136 ;CHECK-LABEL: @cos_f64( 137 ;CHECK: llvm.cos.v4f64 138 ;CHECK: ret void 139 define void @cos_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 140 entry: 141 %cmp6 = icmp sgt i32 %n, 0 142 br i1 %cmp6, label %for.body, label %for.end 143 144 for.body: ; preds = %entry, %for.body 145 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 146 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 147 %0 = load double* %arrayidx, align 8 148 %call = tail call double @llvm.cos.f64(double %0) nounwind readnone 149 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 150 store double %call, double* %arrayidx2, align 8 151 %indvars.iv.next = add i64 %indvars.iv, 1 152 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 153 %exitcond = icmp eq i32 %lftr.wideiv, %n 154 br i1 %exitcond, label %for.end, label %for.body 155 156 for.end: ; preds = %for.body, %entry 157 ret void 158 } 159 160 declare double @llvm.cos.f64(double) nounwind readnone 161 162 ;CHECK-LABEL: @exp_f32( 163 ;CHECK: llvm.exp.v4f32 164 ;CHECK: ret void 165 define void @exp_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 166 entry: 167 %cmp6 = icmp sgt i32 %n, 0 168 br i1 %cmp6, label %for.body, label %for.end 169 170 for.body: ; preds = %entry, %for.body 171 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 172 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 173 %0 = load float* %arrayidx, align 4 174 %call = tail call float @llvm.exp.f32(float %0) nounwind readnone 175 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 176 store float %call, float* %arrayidx2, align 4 177 %indvars.iv.next = add i64 %indvars.iv, 1 178 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 179 %exitcond = icmp eq i32 %lftr.wideiv, %n 180 br i1 %exitcond, label %for.end, label %for.body 181 182 for.end: ; preds = %for.body, %entry 183 ret void 184 } 185 186 declare float @llvm.exp.f32(float) nounwind readnone 187 188 ;CHECK-LABEL: @exp_f64( 189 ;CHECK: llvm.exp.v4f64 190 ;CHECK: ret void 191 define void @exp_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 192 entry: 193 %cmp6 = icmp sgt i32 %n, 0 194 br i1 %cmp6, label %for.body, label %for.end 195 196 for.body: ; preds = %entry, %for.body 197 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 198 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 199 %0 = load double* %arrayidx, align 8 200 %call = tail call double @llvm.exp.f64(double %0) nounwind readnone 201 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 202 store double %call, double* %arrayidx2, align 8 203 %indvars.iv.next = add i64 %indvars.iv, 1 204 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 205 %exitcond = icmp eq i32 %lftr.wideiv, %n 206 br i1 %exitcond, label %for.end, label %for.body 207 208 for.end: ; preds = %for.body, %entry 209 ret void 210 } 211 212 declare double @llvm.exp.f64(double) nounwind readnone 213 214 ;CHECK-LABEL: @exp2_f32( 215 ;CHECK: llvm.exp2.v4f32 216 ;CHECK: ret void 217 define void @exp2_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 218 entry: 219 %cmp6 = icmp sgt i32 %n, 0 220 br i1 %cmp6, label %for.body, label %for.end 221 222 for.body: ; preds = %entry, %for.body 223 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 224 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 225 %0 = load float* %arrayidx, align 4 226 %call = tail call float @llvm.exp2.f32(float %0) nounwind readnone 227 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 228 store float %call, float* %arrayidx2, align 4 229 %indvars.iv.next = add i64 %indvars.iv, 1 230 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 231 %exitcond = icmp eq i32 %lftr.wideiv, %n 232 br i1 %exitcond, label %for.end, label %for.body 233 234 for.end: ; preds = %for.body, %entry 235 ret void 236 } 237 238 declare float @llvm.exp2.f32(float) nounwind readnone 239 240 ;CHECK-LABEL: @exp2_f64( 241 ;CHECK: llvm.exp2.v4f64 242 ;CHECK: ret void 243 define void @exp2_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 244 entry: 245 %cmp6 = icmp sgt i32 %n, 0 246 br i1 %cmp6, label %for.body, label %for.end 247 248 for.body: ; preds = %entry, %for.body 249 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 250 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 251 %0 = load double* %arrayidx, align 8 252 %call = tail call double @llvm.exp2.f64(double %0) nounwind readnone 253 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 254 store double %call, double* %arrayidx2, align 8 255 %indvars.iv.next = add i64 %indvars.iv, 1 256 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 257 %exitcond = icmp eq i32 %lftr.wideiv, %n 258 br i1 %exitcond, label %for.end, label %for.body 259 260 for.end: ; preds = %for.body, %entry 261 ret void 262 } 263 264 declare double @llvm.exp2.f64(double) nounwind readnone 265 266 ;CHECK-LABEL: @log_f32( 267 ;CHECK: llvm.log.v4f32 268 ;CHECK: ret void 269 define void @log_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 270 entry: 271 %cmp6 = icmp sgt i32 %n, 0 272 br i1 %cmp6, label %for.body, label %for.end 273 274 for.body: ; preds = %entry, %for.body 275 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 276 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 277 %0 = load float* %arrayidx, align 4 278 %call = tail call float @llvm.log.f32(float %0) nounwind readnone 279 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 280 store float %call, float* %arrayidx2, align 4 281 %indvars.iv.next = add i64 %indvars.iv, 1 282 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 283 %exitcond = icmp eq i32 %lftr.wideiv, %n 284 br i1 %exitcond, label %for.end, label %for.body 285 286 for.end: ; preds = %for.body, %entry 287 ret void 288 } 289 290 declare float @llvm.log.f32(float) nounwind readnone 291 292 ;CHECK-LABEL: @log_f64( 293 ;CHECK: llvm.log.v4f64 294 ;CHECK: ret void 295 define void @log_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 296 entry: 297 %cmp6 = icmp sgt i32 %n, 0 298 br i1 %cmp6, label %for.body, label %for.end 299 300 for.body: ; preds = %entry, %for.body 301 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 302 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 303 %0 = load double* %arrayidx, align 8 304 %call = tail call double @llvm.log.f64(double %0) nounwind readnone 305 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 306 store double %call, double* %arrayidx2, align 8 307 %indvars.iv.next = add i64 %indvars.iv, 1 308 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 309 %exitcond = icmp eq i32 %lftr.wideiv, %n 310 br i1 %exitcond, label %for.end, label %for.body 311 312 for.end: ; preds = %for.body, %entry 313 ret void 314 } 315 316 declare double @llvm.log.f64(double) nounwind readnone 317 318 ;CHECK-LABEL: @log10_f32( 319 ;CHECK: llvm.log10.v4f32 320 ;CHECK: ret void 321 define void @log10_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 322 entry: 323 %cmp6 = icmp sgt i32 %n, 0 324 br i1 %cmp6, label %for.body, label %for.end 325 326 for.body: ; preds = %entry, %for.body 327 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 328 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 329 %0 = load float* %arrayidx, align 4 330 %call = tail call float @llvm.log10.f32(float %0) nounwind readnone 331 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 332 store float %call, float* %arrayidx2, align 4 333 %indvars.iv.next = add i64 %indvars.iv, 1 334 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 335 %exitcond = icmp eq i32 %lftr.wideiv, %n 336 br i1 %exitcond, label %for.end, label %for.body 337 338 for.end: ; preds = %for.body, %entry 339 ret void 340 } 341 342 declare float @llvm.log10.f32(float) nounwind readnone 343 344 ;CHECK-LABEL: @log10_f64( 345 ;CHECK: llvm.log10.v4f64 346 ;CHECK: ret void 347 define void @log10_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 348 entry: 349 %cmp6 = icmp sgt i32 %n, 0 350 br i1 %cmp6, label %for.body, label %for.end 351 352 for.body: ; preds = %entry, %for.body 353 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 354 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 355 %0 = load double* %arrayidx, align 8 356 %call = tail call double @llvm.log10.f64(double %0) nounwind readnone 357 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 358 store double %call, double* %arrayidx2, align 8 359 %indvars.iv.next = add i64 %indvars.iv, 1 360 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 361 %exitcond = icmp eq i32 %lftr.wideiv, %n 362 br i1 %exitcond, label %for.end, label %for.body 363 364 for.end: ; preds = %for.body, %entry 365 ret void 366 } 367 368 declare double @llvm.log10.f64(double) nounwind readnone 369 370 ;CHECK-LABEL: @log2_f32( 371 ;CHECK: llvm.log2.v4f32 372 ;CHECK: ret void 373 define void @log2_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 374 entry: 375 %cmp6 = icmp sgt i32 %n, 0 376 br i1 %cmp6, label %for.body, label %for.end 377 378 for.body: ; preds = %entry, %for.body 379 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 380 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 381 %0 = load float* %arrayidx, align 4 382 %call = tail call float @llvm.log2.f32(float %0) nounwind readnone 383 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 384 store float %call, float* %arrayidx2, align 4 385 %indvars.iv.next = add i64 %indvars.iv, 1 386 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 387 %exitcond = icmp eq i32 %lftr.wideiv, %n 388 br i1 %exitcond, label %for.end, label %for.body 389 390 for.end: ; preds = %for.body, %entry 391 ret void 392 } 393 394 declare float @llvm.log2.f32(float) nounwind readnone 395 396 ;CHECK-LABEL: @log2_f64( 397 ;CHECK: llvm.log2.v4f64 398 ;CHECK: ret void 399 define void @log2_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 400 entry: 401 %cmp6 = icmp sgt i32 %n, 0 402 br i1 %cmp6, label %for.body, label %for.end 403 404 for.body: ; preds = %entry, %for.body 405 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 406 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 407 %0 = load double* %arrayidx, align 8 408 %call = tail call double @llvm.log2.f64(double %0) nounwind readnone 409 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 410 store double %call, double* %arrayidx2, align 8 411 %indvars.iv.next = add i64 %indvars.iv, 1 412 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 413 %exitcond = icmp eq i32 %lftr.wideiv, %n 414 br i1 %exitcond, label %for.end, label %for.body 415 416 for.end: ; preds = %for.body, %entry 417 ret void 418 } 419 420 declare double @llvm.log2.f64(double) nounwind readnone 421 422 ;CHECK-LABEL: @fabs_f32( 423 ;CHECK: llvm.fabs.v4f32 424 ;CHECK: ret void 425 define void @fabs_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 426 entry: 427 %cmp6 = icmp sgt i32 %n, 0 428 br i1 %cmp6, label %for.body, label %for.end 429 430 for.body: ; preds = %entry, %for.body 431 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 432 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 433 %0 = load float* %arrayidx, align 4 434 %call = tail call float @llvm.fabs.f32(float %0) nounwind readnone 435 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 436 store float %call, float* %arrayidx2, align 4 437 %indvars.iv.next = add i64 %indvars.iv, 1 438 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 439 %exitcond = icmp eq i32 %lftr.wideiv, %n 440 br i1 %exitcond, label %for.end, label %for.body 441 442 for.end: ; preds = %for.body, %entry 443 ret void 444 } 445 446 declare float @llvm.fabs.f32(float) nounwind readnone 447 448 define void @fabs_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 449 entry: 450 %cmp6 = icmp sgt i32 %n, 0 451 br i1 %cmp6, label %for.body, label %for.end 452 453 for.body: ; preds = %entry, %for.body 454 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 455 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 456 %0 = load double* %arrayidx, align 8 457 %call = tail call double @llvm.fabs(double %0) nounwind readnone 458 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 459 store double %call, double* %arrayidx2, align 8 460 %indvars.iv.next = add i64 %indvars.iv, 1 461 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 462 %exitcond = icmp eq i32 %lftr.wideiv, %n 463 br i1 %exitcond, label %for.end, label %for.body 464 465 for.end: ; preds = %for.body, %entry 466 ret void 467 } 468 469 declare double @llvm.fabs(double) nounwind readnone 470 471 ;CHECK-LABEL: @floor_f32( 472 ;CHECK: llvm.floor.v4f32 473 ;CHECK: ret void 474 define void @floor_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 475 entry: 476 %cmp6 = icmp sgt i32 %n, 0 477 br i1 %cmp6, label %for.body, label %for.end 478 479 for.body: ; preds = %entry, %for.body 480 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 481 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 482 %0 = load float* %arrayidx, align 4 483 %call = tail call float @llvm.floor.f32(float %0) nounwind readnone 484 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 485 store float %call, float* %arrayidx2, align 4 486 %indvars.iv.next = add i64 %indvars.iv, 1 487 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 488 %exitcond = icmp eq i32 %lftr.wideiv, %n 489 br i1 %exitcond, label %for.end, label %for.body 490 491 for.end: ; preds = %for.body, %entry 492 ret void 493 } 494 495 declare float @llvm.floor.f32(float) nounwind readnone 496 497 ;CHECK-LABEL: @floor_f64( 498 ;CHECK: llvm.floor.v4f64 499 ;CHECK: ret void 500 define void @floor_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 501 entry: 502 %cmp6 = icmp sgt i32 %n, 0 503 br i1 %cmp6, label %for.body, label %for.end 504 505 for.body: ; preds = %entry, %for.body 506 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 507 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 508 %0 = load double* %arrayidx, align 8 509 %call = tail call double @llvm.floor.f64(double %0) nounwind readnone 510 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 511 store double %call, double* %arrayidx2, align 8 512 %indvars.iv.next = add i64 %indvars.iv, 1 513 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 514 %exitcond = icmp eq i32 %lftr.wideiv, %n 515 br i1 %exitcond, label %for.end, label %for.body 516 517 for.end: ; preds = %for.body, %entry 518 ret void 519 } 520 521 declare double @llvm.floor.f64(double) nounwind readnone 522 523 ;CHECK-LABEL: @ceil_f32( 524 ;CHECK: llvm.ceil.v4f32 525 ;CHECK: ret void 526 define void @ceil_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 527 entry: 528 %cmp6 = icmp sgt i32 %n, 0 529 br i1 %cmp6, label %for.body, label %for.end 530 531 for.body: ; preds = %entry, %for.body 532 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 533 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 534 %0 = load float* %arrayidx, align 4 535 %call = tail call float @llvm.ceil.f32(float %0) nounwind readnone 536 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 537 store float %call, float* %arrayidx2, align 4 538 %indvars.iv.next = add i64 %indvars.iv, 1 539 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 540 %exitcond = icmp eq i32 %lftr.wideiv, %n 541 br i1 %exitcond, label %for.end, label %for.body 542 543 for.end: ; preds = %for.body, %entry 544 ret void 545 } 546 547 declare float @llvm.ceil.f32(float) nounwind readnone 548 549 ;CHECK-LABEL: @ceil_f64( 550 ;CHECK: llvm.ceil.v4f64 551 ;CHECK: ret void 552 define void @ceil_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 553 entry: 554 %cmp6 = icmp sgt i32 %n, 0 555 br i1 %cmp6, label %for.body, label %for.end 556 557 for.body: ; preds = %entry, %for.body 558 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 559 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 560 %0 = load double* %arrayidx, align 8 561 %call = tail call double @llvm.ceil.f64(double %0) nounwind readnone 562 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 563 store double %call, double* %arrayidx2, align 8 564 %indvars.iv.next = add i64 %indvars.iv, 1 565 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 566 %exitcond = icmp eq i32 %lftr.wideiv, %n 567 br i1 %exitcond, label %for.end, label %for.body 568 569 for.end: ; preds = %for.body, %entry 570 ret void 571 } 572 573 declare double @llvm.ceil.f64(double) nounwind readnone 574 575 ;CHECK-LABEL: @trunc_f32( 576 ;CHECK: llvm.trunc.v4f32 577 ;CHECK: ret void 578 define void @trunc_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 579 entry: 580 %cmp6 = icmp sgt i32 %n, 0 581 br i1 %cmp6, label %for.body, label %for.end 582 583 for.body: ; preds = %entry, %for.body 584 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 585 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 586 %0 = load float* %arrayidx, align 4 587 %call = tail call float @llvm.trunc.f32(float %0) nounwind readnone 588 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 589 store float %call, float* %arrayidx2, align 4 590 %indvars.iv.next = add i64 %indvars.iv, 1 591 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 592 %exitcond = icmp eq i32 %lftr.wideiv, %n 593 br i1 %exitcond, label %for.end, label %for.body 594 595 for.end: ; preds = %for.body, %entry 596 ret void 597 } 598 599 declare float @llvm.trunc.f32(float) nounwind readnone 600 601 ;CHECK-LABEL: @trunc_f64( 602 ;CHECK: llvm.trunc.v4f64 603 ;CHECK: ret void 604 define void @trunc_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 605 entry: 606 %cmp6 = icmp sgt i32 %n, 0 607 br i1 %cmp6, label %for.body, label %for.end 608 609 for.body: ; preds = %entry, %for.body 610 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 611 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 612 %0 = load double* %arrayidx, align 8 613 %call = tail call double @llvm.trunc.f64(double %0) nounwind readnone 614 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 615 store double %call, double* %arrayidx2, align 8 616 %indvars.iv.next = add i64 %indvars.iv, 1 617 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 618 %exitcond = icmp eq i32 %lftr.wideiv, %n 619 br i1 %exitcond, label %for.end, label %for.body 620 621 for.end: ; preds = %for.body, %entry 622 ret void 623 } 624 625 declare double @llvm.trunc.f64(double) nounwind readnone 626 627 ;CHECK-LABEL: @rint_f32( 628 ;CHECK: llvm.rint.v4f32 629 ;CHECK: ret void 630 define void @rint_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 631 entry: 632 %cmp6 = icmp sgt i32 %n, 0 633 br i1 %cmp6, label %for.body, label %for.end 634 635 for.body: ; preds = %entry, %for.body 636 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 637 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 638 %0 = load float* %arrayidx, align 4 639 %call = tail call float @llvm.rint.f32(float %0) nounwind readnone 640 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 641 store float %call, float* %arrayidx2, align 4 642 %indvars.iv.next = add i64 %indvars.iv, 1 643 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 644 %exitcond = icmp eq i32 %lftr.wideiv, %n 645 br i1 %exitcond, label %for.end, label %for.body 646 647 for.end: ; preds = %for.body, %entry 648 ret void 649 } 650 651 declare float @llvm.rint.f32(float) nounwind readnone 652 653 ;CHECK-LABEL: @rint_f64( 654 ;CHECK: llvm.rint.v4f64 655 ;CHECK: ret void 656 define void @rint_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 657 entry: 658 %cmp6 = icmp sgt i32 %n, 0 659 br i1 %cmp6, label %for.body, label %for.end 660 661 for.body: ; preds = %entry, %for.body 662 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 663 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 664 %0 = load double* %arrayidx, align 8 665 %call = tail call double @llvm.rint.f64(double %0) nounwind readnone 666 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 667 store double %call, double* %arrayidx2, align 8 668 %indvars.iv.next = add i64 %indvars.iv, 1 669 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 670 %exitcond = icmp eq i32 %lftr.wideiv, %n 671 br i1 %exitcond, label %for.end, label %for.body 672 673 for.end: ; preds = %for.body, %entry 674 ret void 675 } 676 677 declare double @llvm.rint.f64(double) nounwind readnone 678 679 ;CHECK-LABEL: @nearbyint_f32( 680 ;CHECK: llvm.nearbyint.v4f32 681 ;CHECK: ret void 682 define void @nearbyint_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 683 entry: 684 %cmp6 = icmp sgt i32 %n, 0 685 br i1 %cmp6, label %for.body, label %for.end 686 687 for.body: ; preds = %entry, %for.body 688 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 689 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 690 %0 = load float* %arrayidx, align 4 691 %call = tail call float @llvm.nearbyint.f32(float %0) nounwind readnone 692 %arrayidx2 = getelementptr inbounds float* %x, i64 %indvars.iv 693 store float %call, float* %arrayidx2, align 4 694 %indvars.iv.next = add i64 %indvars.iv, 1 695 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 696 %exitcond = icmp eq i32 %lftr.wideiv, %n 697 br i1 %exitcond, label %for.end, label %for.body 698 699 for.end: ; preds = %for.body, %entry 700 ret void 701 } 702 703 declare float @llvm.nearbyint.f32(float) nounwind readnone 704 705 ;CHECK-LABEL: @nearbyint_f64( 706 ;CHECK: llvm.nearbyint.v4f64 707 ;CHECK: ret void 708 define void @nearbyint_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 709 entry: 710 %cmp6 = icmp sgt i32 %n, 0 711 br i1 %cmp6, label %for.body, label %for.end 712 713 for.body: ; preds = %entry, %for.body 714 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 715 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 716 %0 = load double* %arrayidx, align 8 717 %call = tail call double @llvm.nearbyint.f64(double %0) nounwind readnone 718 %arrayidx2 = getelementptr inbounds double* %x, i64 %indvars.iv 719 store double %call, double* %arrayidx2, align 8 720 %indvars.iv.next = add i64 %indvars.iv, 1 721 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 722 %exitcond = icmp eq i32 %lftr.wideiv, %n 723 br i1 %exitcond, label %for.end, label %for.body 724 725 for.end: ; preds = %for.body, %entry 726 ret void 727 } 728 729 declare double @llvm.nearbyint.f64(double) nounwind readnone 730 731 ;CHECK-LABEL: @fma_f32( 732 ;CHECK: llvm.fma.v4f32 733 ;CHECK: ret void 734 define void @fma_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z, float* noalias %w) nounwind uwtable { 735 entry: 736 %cmp12 = icmp sgt i32 %n, 0 737 br i1 %cmp12, label %for.body, label %for.end 738 739 for.body: ; preds = %entry, %for.body 740 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 741 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 742 %0 = load float* %arrayidx, align 4 743 %arrayidx2 = getelementptr inbounds float* %w, i64 %indvars.iv 744 %1 = load float* %arrayidx2, align 4 745 %arrayidx4 = getelementptr inbounds float* %z, i64 %indvars.iv 746 %2 = load float* %arrayidx4, align 4 747 %3 = tail call float @llvm.fma.f32(float %0, float %2, float %1) 748 %arrayidx6 = getelementptr inbounds float* %x, i64 %indvars.iv 749 store float %3, float* %arrayidx6, align 4 750 %indvars.iv.next = add i64 %indvars.iv, 1 751 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 752 %exitcond = icmp eq i32 %lftr.wideiv, %n 753 br i1 %exitcond, label %for.end, label %for.body 754 755 for.end: ; preds = %for.body, %entry 756 ret void 757 } 758 759 declare float @llvm.fma.f32(float, float, float) nounwind readnone 760 761 ;CHECK-LABEL: @fma_f64( 762 ;CHECK: llvm.fma.v4f64 763 ;CHECK: ret void 764 define void @fma_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z, double* noalias %w) nounwind uwtable { 765 entry: 766 %cmp12 = icmp sgt i32 %n, 0 767 br i1 %cmp12, label %for.body, label %for.end 768 769 for.body: ; preds = %entry, %for.body 770 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 771 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 772 %0 = load double* %arrayidx, align 8 773 %arrayidx2 = getelementptr inbounds double* %w, i64 %indvars.iv 774 %1 = load double* %arrayidx2, align 8 775 %arrayidx4 = getelementptr inbounds double* %z, i64 %indvars.iv 776 %2 = load double* %arrayidx4, align 8 777 %3 = tail call double @llvm.fma.f64(double %0, double %2, double %1) 778 %arrayidx6 = getelementptr inbounds double* %x, i64 %indvars.iv 779 store double %3, double* %arrayidx6, align 8 780 %indvars.iv.next = add i64 %indvars.iv, 1 781 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 782 %exitcond = icmp eq i32 %lftr.wideiv, %n 783 br i1 %exitcond, label %for.end, label %for.body 784 785 for.end: ; preds = %for.body, %entry 786 ret void 787 } 788 789 declare double @llvm.fma.f64(double, double, double) nounwind readnone 790 791 ;CHECK-LABEL: @fmuladd_f32( 792 ;CHECK: llvm.fmuladd.v4f32 793 ;CHECK: ret void 794 define void @fmuladd_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z, float* noalias %w) nounwind uwtable { 795 entry: 796 %cmp12 = icmp sgt i32 %n, 0 797 br i1 %cmp12, label %for.body, label %for.end 798 799 for.body: ; preds = %entry, %for.body 800 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 801 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 802 %0 = load float* %arrayidx, align 4 803 %arrayidx2 = getelementptr inbounds float* %w, i64 %indvars.iv 804 %1 = load float* %arrayidx2, align 4 805 %arrayidx4 = getelementptr inbounds float* %z, i64 %indvars.iv 806 %2 = load float* %arrayidx4, align 4 807 %3 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %1) 808 %arrayidx6 = getelementptr inbounds float* %x, i64 %indvars.iv 809 store float %3, float* %arrayidx6, align 4 810 %indvars.iv.next = add i64 %indvars.iv, 1 811 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 812 %exitcond = icmp eq i32 %lftr.wideiv, %n 813 br i1 %exitcond, label %for.end, label %for.body 814 815 for.end: ; preds = %for.body, %entry 816 ret void 817 } 818 819 declare float @llvm.fmuladd.f32(float, float, float) nounwind readnone 820 821 ;CHECK-LABEL: @fmuladd_f64( 822 ;CHECK: llvm.fmuladd.v4f64 823 ;CHECK: ret void 824 define void @fmuladd_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z, double* noalias %w) nounwind uwtable { 825 entry: 826 %cmp12 = icmp sgt i32 %n, 0 827 br i1 %cmp12, label %for.body, label %for.end 828 829 for.body: ; preds = %entry, %for.body 830 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 831 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 832 %0 = load double* %arrayidx, align 8 833 %arrayidx2 = getelementptr inbounds double* %w, i64 %indvars.iv 834 %1 = load double* %arrayidx2, align 8 835 %arrayidx4 = getelementptr inbounds double* %z, i64 %indvars.iv 836 %2 = load double* %arrayidx4, align 8 837 %3 = tail call double @llvm.fmuladd.f64(double %0, double %2, double %1) 838 %arrayidx6 = getelementptr inbounds double* %x, i64 %indvars.iv 839 store double %3, double* %arrayidx6, align 8 840 %indvars.iv.next = add i64 %indvars.iv, 1 841 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 842 %exitcond = icmp eq i32 %lftr.wideiv, %n 843 br i1 %exitcond, label %for.end, label %for.body 844 845 for.end: ; preds = %for.body, %entry 846 ret void 847 } 848 849 declare double @llvm.fmuladd.f64(double, double, double) nounwind readnone 850 851 ;CHECK-LABEL: @pow_f32( 852 ;CHECK: llvm.pow.v4f32 853 ;CHECK: ret void 854 define void @pow_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable { 855 entry: 856 %cmp9 = icmp sgt i32 %n, 0 857 br i1 %cmp9, label %for.body, label %for.end 858 859 for.body: ; preds = %entry, %for.body 860 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 861 %arrayidx = getelementptr inbounds float* %y, i64 %indvars.iv 862 %0 = load float* %arrayidx, align 4 863 %arrayidx2 = getelementptr inbounds float* %z, i64 %indvars.iv 864 %1 = load float* %arrayidx2, align 4 865 %call = tail call float @llvm.pow.f32(float %0, float %1) nounwind readnone 866 %arrayidx4 = getelementptr inbounds float* %x, i64 %indvars.iv 867 store float %call, float* %arrayidx4, align 4 868 %indvars.iv.next = add i64 %indvars.iv, 1 869 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 870 %exitcond = icmp eq i32 %lftr.wideiv, %n 871 br i1 %exitcond, label %for.end, label %for.body 872 873 for.end: ; preds = %for.body, %entry 874 ret void 875 } 876 877 declare float @llvm.pow.f32(float, float) nounwind readnone 878 879 ;CHECK-LABEL: @pow_f64( 880 ;CHECK: llvm.pow.v4f64 881 ;CHECK: ret void 882 define void @pow_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z) nounwind uwtable { 883 entry: 884 %cmp9 = icmp sgt i32 %n, 0 885 br i1 %cmp9, label %for.body, label %for.end 886 887 for.body: ; preds = %entry, %for.body 888 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 889 %arrayidx = getelementptr inbounds double* %y, i64 %indvars.iv 890 %0 = load double* %arrayidx, align 8 891 %arrayidx2 = getelementptr inbounds double* %z, i64 %indvars.iv 892 %1 = load double* %arrayidx2, align 8 893 %call = tail call double @llvm.pow.f64(double %0, double %1) nounwind readnone 894 %arrayidx4 = getelementptr inbounds double* %x, i64 %indvars.iv 895 store double %call, double* %arrayidx4, align 8 896 %indvars.iv.next = add i64 %indvars.iv, 1 897 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 898 %exitcond = icmp eq i32 %lftr.wideiv, %n 899 br i1 %exitcond, label %for.end, label %for.body 900 901 for.end: ; preds = %for.body, %entry 902 ret void 903 } 904 905 ; CHECK: fabs_libm 906 ; CHECK: call <4 x float> @llvm.fabs.v4f32 907 ; CHECK: ret void 908 define void @fabs_libm(float* nocapture %x) nounwind { 909 entry: 910 br label %for.body 911 912 for.body: ; preds = %entry, %for.body 913 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 914 %arrayidx = getelementptr inbounds float* %x, i64 %indvars.iv 915 %0 = load float* %arrayidx, align 4 916 %call = tail call float @fabsf(float %0) nounwind readnone 917 store float %call, float* %arrayidx, align 4 918 %indvars.iv.next = add i64 %indvars.iv, 1 919 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 920 %exitcond = icmp eq i32 %lftr.wideiv, 1024 921 br i1 %exitcond, label %for.end, label %for.body 922 923 for.end: ; preds = %for.body 924 ret void 925 } 926 927 declare float @fabsf(float) nounwind readnone 928 929 declare double @llvm.pow.f64(double, double) nounwind readnone 930