1; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s 2 3target 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 5;CHECK-LABEL: @sqrt_f32( 6;CHECK: llvm.sqrt.v4f32 7;CHECK: ret void 8define void @sqrt_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 9entry: 10 %cmp6 = icmp sgt i32 %n, 0 11 br i1 %cmp6, label %for.body, label %for.end 12 13for.body: ; preds = %entry, %for.body 14 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 15 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 16 %0 = load float, float* %arrayidx, align 4 17 %call = tail call float @llvm.sqrt.f32(float %0) nounwind readnone 18 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 19 store float %call, float* %arrayidx2, align 4 20 %indvars.iv.next = add i64 %indvars.iv, 1 21 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 22 %exitcond = icmp eq i32 %lftr.wideiv, %n 23 br i1 %exitcond, label %for.end, label %for.body 24 25for.end: ; preds = %for.body, %entry 26 ret void 27} 28 29declare float @llvm.sqrt.f32(float) nounwind readnone 30 31;CHECK-LABEL: @sqrt_f64( 32;CHECK: llvm.sqrt.v4f64 33;CHECK: ret void 34define void @sqrt_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 35entry: 36 %cmp6 = icmp sgt i32 %n, 0 37 br i1 %cmp6, label %for.body, label %for.end 38 39for.body: ; preds = %entry, %for.body 40 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 41 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 42 %0 = load double, double* %arrayidx, align 8 43 %call = tail call double @llvm.sqrt.f64(double %0) nounwind readnone 44 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 45 store double %call, double* %arrayidx2, align 8 46 %indvars.iv.next = add i64 %indvars.iv, 1 47 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 48 %exitcond = icmp eq i32 %lftr.wideiv, %n 49 br i1 %exitcond, label %for.end, label %for.body 50 51for.end: ; preds = %for.body, %entry 52 ret void 53} 54 55declare double @llvm.sqrt.f64(double) nounwind readnone 56 57;CHECK-LABEL: @sin_f32( 58;CHECK: llvm.sin.v4f32 59;CHECK: ret void 60define void @sin_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 61entry: 62 %cmp6 = icmp sgt i32 %n, 0 63 br i1 %cmp6, label %for.body, label %for.end 64 65for.body: ; preds = %entry, %for.body 66 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 67 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 68 %0 = load float, float* %arrayidx, align 4 69 %call = tail call float @llvm.sin.f32(float %0) nounwind readnone 70 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 71 store float %call, float* %arrayidx2, align 4 72 %indvars.iv.next = add i64 %indvars.iv, 1 73 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 74 %exitcond = icmp eq i32 %lftr.wideiv, %n 75 br i1 %exitcond, label %for.end, label %for.body 76 77for.end: ; preds = %for.body, %entry 78 ret void 79} 80 81declare float @llvm.sin.f32(float) nounwind readnone 82 83;CHECK-LABEL: @sin_f64( 84;CHECK: llvm.sin.v4f64 85;CHECK: ret void 86define void @sin_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 87entry: 88 %cmp6 = icmp sgt i32 %n, 0 89 br i1 %cmp6, label %for.body, label %for.end 90 91for.body: ; preds = %entry, %for.body 92 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 93 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 94 %0 = load double, double* %arrayidx, align 8 95 %call = tail call double @llvm.sin.f64(double %0) nounwind readnone 96 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 97 store double %call, double* %arrayidx2, align 8 98 %indvars.iv.next = add i64 %indvars.iv, 1 99 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 100 %exitcond = icmp eq i32 %lftr.wideiv, %n 101 br i1 %exitcond, label %for.end, label %for.body 102 103for.end: ; preds = %for.body, %entry 104 ret void 105} 106 107declare double @llvm.sin.f64(double) nounwind readnone 108 109;CHECK-LABEL: @cos_f32( 110;CHECK: llvm.cos.v4f32 111;CHECK: ret void 112define void @cos_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 113entry: 114 %cmp6 = icmp sgt i32 %n, 0 115 br i1 %cmp6, label %for.body, label %for.end 116 117for.body: ; preds = %entry, %for.body 118 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 119 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 120 %0 = load float, float* %arrayidx, align 4 121 %call = tail call float @llvm.cos.f32(float %0) nounwind readnone 122 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 123 store float %call, float* %arrayidx2, align 4 124 %indvars.iv.next = add i64 %indvars.iv, 1 125 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 126 %exitcond = icmp eq i32 %lftr.wideiv, %n 127 br i1 %exitcond, label %for.end, label %for.body 128 129for.end: ; preds = %for.body, %entry 130 ret void 131} 132 133declare float @llvm.cos.f32(float) nounwind readnone 134 135;CHECK-LABEL: @cos_f64( 136;CHECK: llvm.cos.v4f64 137;CHECK: ret void 138define void @cos_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 139entry: 140 %cmp6 = icmp sgt i32 %n, 0 141 br i1 %cmp6, label %for.body, label %for.end 142 143for.body: ; preds = %entry, %for.body 144 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 145 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 146 %0 = load double, double* %arrayidx, align 8 147 %call = tail call double @llvm.cos.f64(double %0) nounwind readnone 148 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 149 store double %call, double* %arrayidx2, align 8 150 %indvars.iv.next = add i64 %indvars.iv, 1 151 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 152 %exitcond = icmp eq i32 %lftr.wideiv, %n 153 br i1 %exitcond, label %for.end, label %for.body 154 155for.end: ; preds = %for.body, %entry 156 ret void 157} 158 159declare double @llvm.cos.f64(double) nounwind readnone 160 161;CHECK-LABEL: @exp_f32( 162;CHECK: llvm.exp.v4f32 163;CHECK: ret void 164define void @exp_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 165entry: 166 %cmp6 = icmp sgt i32 %n, 0 167 br i1 %cmp6, label %for.body, label %for.end 168 169for.body: ; preds = %entry, %for.body 170 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 171 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 172 %0 = load float, float* %arrayidx, align 4 173 %call = tail call float @llvm.exp.f32(float %0) nounwind readnone 174 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 175 store float %call, float* %arrayidx2, align 4 176 %indvars.iv.next = add i64 %indvars.iv, 1 177 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 178 %exitcond = icmp eq i32 %lftr.wideiv, %n 179 br i1 %exitcond, label %for.end, label %for.body 180 181for.end: ; preds = %for.body, %entry 182 ret void 183} 184 185declare float @llvm.exp.f32(float) nounwind readnone 186 187;CHECK-LABEL: @exp_f64( 188;CHECK: llvm.exp.v4f64 189;CHECK: ret void 190define void @exp_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 191entry: 192 %cmp6 = icmp sgt i32 %n, 0 193 br i1 %cmp6, label %for.body, label %for.end 194 195for.body: ; preds = %entry, %for.body 196 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 197 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 198 %0 = load double, double* %arrayidx, align 8 199 %call = tail call double @llvm.exp.f64(double %0) nounwind readnone 200 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 201 store double %call, double* %arrayidx2, align 8 202 %indvars.iv.next = add i64 %indvars.iv, 1 203 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 204 %exitcond = icmp eq i32 %lftr.wideiv, %n 205 br i1 %exitcond, label %for.end, label %for.body 206 207for.end: ; preds = %for.body, %entry 208 ret void 209} 210 211declare double @llvm.exp.f64(double) nounwind readnone 212 213;CHECK-LABEL: @exp2_f32( 214;CHECK: llvm.exp2.v4f32 215;CHECK: ret void 216define void @exp2_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 217entry: 218 %cmp6 = icmp sgt i32 %n, 0 219 br i1 %cmp6, label %for.body, label %for.end 220 221for.body: ; preds = %entry, %for.body 222 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 223 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 224 %0 = load float, float* %arrayidx, align 4 225 %call = tail call float @llvm.exp2.f32(float %0) nounwind readnone 226 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 227 store float %call, float* %arrayidx2, align 4 228 %indvars.iv.next = add i64 %indvars.iv, 1 229 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 230 %exitcond = icmp eq i32 %lftr.wideiv, %n 231 br i1 %exitcond, label %for.end, label %for.body 232 233for.end: ; preds = %for.body, %entry 234 ret void 235} 236 237declare float @llvm.exp2.f32(float) nounwind readnone 238 239;CHECK-LABEL: @exp2_f64( 240;CHECK: llvm.exp2.v4f64 241;CHECK: ret void 242define void @exp2_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 243entry: 244 %cmp6 = icmp sgt i32 %n, 0 245 br i1 %cmp6, label %for.body, label %for.end 246 247for.body: ; preds = %entry, %for.body 248 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 249 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 250 %0 = load double, double* %arrayidx, align 8 251 %call = tail call double @llvm.exp2.f64(double %0) nounwind readnone 252 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 253 store double %call, double* %arrayidx2, align 8 254 %indvars.iv.next = add i64 %indvars.iv, 1 255 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 256 %exitcond = icmp eq i32 %lftr.wideiv, %n 257 br i1 %exitcond, label %for.end, label %for.body 258 259for.end: ; preds = %for.body, %entry 260 ret void 261} 262 263declare double @llvm.exp2.f64(double) nounwind readnone 264 265;CHECK-LABEL: @log_f32( 266;CHECK: llvm.log.v4f32 267;CHECK: ret void 268define void @log_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 269entry: 270 %cmp6 = icmp sgt i32 %n, 0 271 br i1 %cmp6, label %for.body, label %for.end 272 273for.body: ; preds = %entry, %for.body 274 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 275 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 276 %0 = load float, float* %arrayidx, align 4 277 %call = tail call float @llvm.log.f32(float %0) nounwind readnone 278 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 279 store float %call, float* %arrayidx2, align 4 280 %indvars.iv.next = add i64 %indvars.iv, 1 281 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 282 %exitcond = icmp eq i32 %lftr.wideiv, %n 283 br i1 %exitcond, label %for.end, label %for.body 284 285for.end: ; preds = %for.body, %entry 286 ret void 287} 288 289declare float @llvm.log.f32(float) nounwind readnone 290 291;CHECK-LABEL: @log_f64( 292;CHECK: llvm.log.v4f64 293;CHECK: ret void 294define void @log_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 295entry: 296 %cmp6 = icmp sgt i32 %n, 0 297 br i1 %cmp6, label %for.body, label %for.end 298 299for.body: ; preds = %entry, %for.body 300 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 301 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 302 %0 = load double, double* %arrayidx, align 8 303 %call = tail call double @llvm.log.f64(double %0) nounwind readnone 304 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 305 store double %call, double* %arrayidx2, align 8 306 %indvars.iv.next = add i64 %indvars.iv, 1 307 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 308 %exitcond = icmp eq i32 %lftr.wideiv, %n 309 br i1 %exitcond, label %for.end, label %for.body 310 311for.end: ; preds = %for.body, %entry 312 ret void 313} 314 315declare double @llvm.log.f64(double) nounwind readnone 316 317;CHECK-LABEL: @log10_f32( 318;CHECK: llvm.log10.v4f32 319;CHECK: ret void 320define void @log10_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 321entry: 322 %cmp6 = icmp sgt i32 %n, 0 323 br i1 %cmp6, label %for.body, label %for.end 324 325for.body: ; preds = %entry, %for.body 326 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 327 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 328 %0 = load float, float* %arrayidx, align 4 329 %call = tail call float @llvm.log10.f32(float %0) nounwind readnone 330 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 331 store float %call, float* %arrayidx2, align 4 332 %indvars.iv.next = add i64 %indvars.iv, 1 333 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 334 %exitcond = icmp eq i32 %lftr.wideiv, %n 335 br i1 %exitcond, label %for.end, label %for.body 336 337for.end: ; preds = %for.body, %entry 338 ret void 339} 340 341declare float @llvm.log10.f32(float) nounwind readnone 342 343;CHECK-LABEL: @log10_f64( 344;CHECK: llvm.log10.v4f64 345;CHECK: ret void 346define void @log10_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 347entry: 348 %cmp6 = icmp sgt i32 %n, 0 349 br i1 %cmp6, label %for.body, label %for.end 350 351for.body: ; preds = %entry, %for.body 352 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 353 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 354 %0 = load double, double* %arrayidx, align 8 355 %call = tail call double @llvm.log10.f64(double %0) nounwind readnone 356 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 357 store double %call, double* %arrayidx2, align 8 358 %indvars.iv.next = add i64 %indvars.iv, 1 359 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 360 %exitcond = icmp eq i32 %lftr.wideiv, %n 361 br i1 %exitcond, label %for.end, label %for.body 362 363for.end: ; preds = %for.body, %entry 364 ret void 365} 366 367declare double @llvm.log10.f64(double) nounwind readnone 368 369;CHECK-LABEL: @log2_f32( 370;CHECK: llvm.log2.v4f32 371;CHECK: ret void 372define void @log2_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 373entry: 374 %cmp6 = icmp sgt i32 %n, 0 375 br i1 %cmp6, label %for.body, label %for.end 376 377for.body: ; preds = %entry, %for.body 378 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 379 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 380 %0 = load float, float* %arrayidx, align 4 381 %call = tail call float @llvm.log2.f32(float %0) nounwind readnone 382 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 383 store float %call, float* %arrayidx2, align 4 384 %indvars.iv.next = add i64 %indvars.iv, 1 385 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 386 %exitcond = icmp eq i32 %lftr.wideiv, %n 387 br i1 %exitcond, label %for.end, label %for.body 388 389for.end: ; preds = %for.body, %entry 390 ret void 391} 392 393declare float @llvm.log2.f32(float) nounwind readnone 394 395;CHECK-LABEL: @log2_f64( 396;CHECK: llvm.log2.v4f64 397;CHECK: ret void 398define void @log2_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 399entry: 400 %cmp6 = icmp sgt i32 %n, 0 401 br i1 %cmp6, label %for.body, label %for.end 402 403for.body: ; preds = %entry, %for.body 404 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 405 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 406 %0 = load double, double* %arrayidx, align 8 407 %call = tail call double @llvm.log2.f64(double %0) nounwind readnone 408 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 409 store double %call, double* %arrayidx2, align 8 410 %indvars.iv.next = add i64 %indvars.iv, 1 411 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 412 %exitcond = icmp eq i32 %lftr.wideiv, %n 413 br i1 %exitcond, label %for.end, label %for.body 414 415for.end: ; preds = %for.body, %entry 416 ret void 417} 418 419declare double @llvm.log2.f64(double) nounwind readnone 420 421;CHECK-LABEL: @fabs_f32( 422;CHECK: llvm.fabs.v4f32 423;CHECK: ret void 424define void @fabs_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 425entry: 426 %cmp6 = icmp sgt i32 %n, 0 427 br i1 %cmp6, label %for.body, label %for.end 428 429for.body: ; preds = %entry, %for.body 430 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 431 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 432 %0 = load float, float* %arrayidx, align 4 433 %call = tail call float @llvm.fabs.f32(float %0) nounwind readnone 434 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 435 store float %call, float* %arrayidx2, align 4 436 %indvars.iv.next = add i64 %indvars.iv, 1 437 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 438 %exitcond = icmp eq i32 %lftr.wideiv, %n 439 br i1 %exitcond, label %for.end, label %for.body 440 441for.end: ; preds = %for.body, %entry 442 ret void 443} 444 445declare float @llvm.fabs.f32(float) nounwind readnone 446 447define void @fabs_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 448entry: 449 %cmp6 = icmp sgt i32 %n, 0 450 br i1 %cmp6, label %for.body, label %for.end 451 452for.body: ; preds = %entry, %for.body 453 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 454 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 455 %0 = load double, double* %arrayidx, align 8 456 %call = tail call double @llvm.fabs(double %0) nounwind readnone 457 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 458 store double %call, double* %arrayidx2, align 8 459 %indvars.iv.next = add i64 %indvars.iv, 1 460 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 461 %exitcond = icmp eq i32 %lftr.wideiv, %n 462 br i1 %exitcond, label %for.end, label %for.body 463 464for.end: ; preds = %for.body, %entry 465 ret void 466} 467 468declare double @llvm.fabs(double) nounwind readnone 469 470;CHECK-LABEL: @copysign_f32( 471;CHECK: llvm.copysign.v4f32 472;CHECK: ret void 473define void @copysign_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable { 474entry: 475 %cmp6 = icmp sgt i32 %n, 0 476 br i1 %cmp6, label %for.body, label %for.end 477 478for.body: ; preds = %entry, %for.body 479 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 480 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 481 %0 = load float, float* %arrayidx, align 4 482 %arrayidx1 = getelementptr inbounds float, float* %z, i64 %indvars.iv 483 %1 = load float, float* %arrayidx1, align 4 484 %call = tail call float @llvm.copysign.f32(float %0, float %1) nounwind readnone 485 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 486 store float %call, float* %arrayidx2, align 4 487 %indvars.iv.next = add i64 %indvars.iv, 1 488 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 489 %exitcond = icmp eq i32 %lftr.wideiv, %n 490 br i1 %exitcond, label %for.end, label %for.body 491 492for.end: ; preds = %for.body, %entry 493 ret void 494} 495 496declare float @llvm.copysign.f32(float, float) nounwind readnone 497 498define void @copysign_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z) nounwind uwtable { 499entry: 500 %cmp6 = icmp sgt i32 %n, 0 501 br i1 %cmp6, label %for.body, label %for.end 502 503for.body: ; preds = %entry, %for.body 504 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 505 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 506 %0 = load double, double* %arrayidx, align 8 507 %arrayidx1 = getelementptr inbounds double, double* %z, i64 %indvars.iv 508 %1 = load double, double* %arrayidx, align 8 509 %call = tail call double @llvm.copysign(double %0, double %1) nounwind readnone 510 %arrayidx2 = getelementptr inbounds double, 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 517for.end: ; preds = %for.body, %entry 518 ret void 519} 520 521declare double @llvm.copysign(double, double) nounwind readnone 522 523;CHECK-LABEL: @floor_f32( 524;CHECK: llvm.floor.v4f32 525;CHECK: ret void 526define void @floor_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 527entry: 528 %cmp6 = icmp sgt i32 %n, 0 529 br i1 %cmp6, label %for.body, label %for.end 530 531for.body: ; preds = %entry, %for.body 532 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 533 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 534 %0 = load float, float* %arrayidx, align 4 535 %call = tail call float @llvm.floor.f32(float %0) nounwind readnone 536 %arrayidx2 = getelementptr inbounds float, 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 543for.end: ; preds = %for.body, %entry 544 ret void 545} 546 547declare float @llvm.floor.f32(float) nounwind readnone 548 549;CHECK-LABEL: @floor_f64( 550;CHECK: llvm.floor.v4f64 551;CHECK: ret void 552define void @floor_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 553entry: 554 %cmp6 = icmp sgt i32 %n, 0 555 br i1 %cmp6, label %for.body, label %for.end 556 557for.body: ; preds = %entry, %for.body 558 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 559 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 560 %0 = load double, double* %arrayidx, align 8 561 %call = tail call double @llvm.floor.f64(double %0) nounwind readnone 562 %arrayidx2 = getelementptr inbounds double, 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 569for.end: ; preds = %for.body, %entry 570 ret void 571} 572 573declare double @llvm.floor.f64(double) nounwind readnone 574 575;CHECK-LABEL: @ceil_f32( 576;CHECK: llvm.ceil.v4f32 577;CHECK: ret void 578define void @ceil_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 579entry: 580 %cmp6 = icmp sgt i32 %n, 0 581 br i1 %cmp6, label %for.body, label %for.end 582 583for.body: ; preds = %entry, %for.body 584 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 585 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 586 %0 = load float, float* %arrayidx, align 4 587 %call = tail call float @llvm.ceil.f32(float %0) nounwind readnone 588 %arrayidx2 = getelementptr inbounds float, 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 595for.end: ; preds = %for.body, %entry 596 ret void 597} 598 599declare float @llvm.ceil.f32(float) nounwind readnone 600 601;CHECK-LABEL: @ceil_f64( 602;CHECK: llvm.ceil.v4f64 603;CHECK: ret void 604define void @ceil_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 605entry: 606 %cmp6 = icmp sgt i32 %n, 0 607 br i1 %cmp6, label %for.body, label %for.end 608 609for.body: ; preds = %entry, %for.body 610 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 611 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 612 %0 = load double, double* %arrayidx, align 8 613 %call = tail call double @llvm.ceil.f64(double %0) nounwind readnone 614 %arrayidx2 = getelementptr inbounds double, 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 621for.end: ; preds = %for.body, %entry 622 ret void 623} 624 625declare double @llvm.ceil.f64(double) nounwind readnone 626 627;CHECK-LABEL: @trunc_f32( 628;CHECK: llvm.trunc.v4f32 629;CHECK: ret void 630define void @trunc_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 631entry: 632 %cmp6 = icmp sgt i32 %n, 0 633 br i1 %cmp6, label %for.body, label %for.end 634 635for.body: ; preds = %entry, %for.body 636 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 637 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 638 %0 = load float, float* %arrayidx, align 4 639 %call = tail call float @llvm.trunc.f32(float %0) nounwind readnone 640 %arrayidx2 = getelementptr inbounds float, 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 647for.end: ; preds = %for.body, %entry 648 ret void 649} 650 651declare float @llvm.trunc.f32(float) nounwind readnone 652 653;CHECK-LABEL: @trunc_f64( 654;CHECK: llvm.trunc.v4f64 655;CHECK: ret void 656define void @trunc_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 657entry: 658 %cmp6 = icmp sgt i32 %n, 0 659 br i1 %cmp6, label %for.body, label %for.end 660 661for.body: ; preds = %entry, %for.body 662 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 663 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 664 %0 = load double, double* %arrayidx, align 8 665 %call = tail call double @llvm.trunc.f64(double %0) nounwind readnone 666 %arrayidx2 = getelementptr inbounds double, 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 673for.end: ; preds = %for.body, %entry 674 ret void 675} 676 677declare double @llvm.trunc.f64(double) nounwind readnone 678 679;CHECK-LABEL: @rint_f32( 680;CHECK: llvm.rint.v4f32 681;CHECK: ret void 682define void @rint_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 683entry: 684 %cmp6 = icmp sgt i32 %n, 0 685 br i1 %cmp6, label %for.body, label %for.end 686 687for.body: ; preds = %entry, %for.body 688 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 689 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 690 %0 = load float, float* %arrayidx, align 4 691 %call = tail call float @llvm.rint.f32(float %0) nounwind readnone 692 %arrayidx2 = getelementptr inbounds float, 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 699for.end: ; preds = %for.body, %entry 700 ret void 701} 702 703declare float @llvm.rint.f32(float) nounwind readnone 704 705;CHECK-LABEL: @rint_f64( 706;CHECK: llvm.rint.v4f64 707;CHECK: ret void 708define void @rint_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 709entry: 710 %cmp6 = icmp sgt i32 %n, 0 711 br i1 %cmp6, label %for.body, label %for.end 712 713for.body: ; preds = %entry, %for.body 714 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 715 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 716 %0 = load double, double* %arrayidx, align 8 717 %call = tail call double @llvm.rint.f64(double %0) nounwind readnone 718 %arrayidx2 = getelementptr inbounds double, 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 725for.end: ; preds = %for.body, %entry 726 ret void 727} 728 729declare double @llvm.rint.f64(double) nounwind readnone 730 731;CHECK-LABEL: @nearbyint_f32( 732;CHECK: llvm.nearbyint.v4f32 733;CHECK: ret void 734define void @nearbyint_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 735entry: 736 %cmp6 = icmp sgt i32 %n, 0 737 br i1 %cmp6, label %for.body, label %for.end 738 739for.body: ; preds = %entry, %for.body 740 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 741 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 742 %0 = load float, float* %arrayidx, align 4 743 %call = tail call float @llvm.nearbyint.f32(float %0) nounwind readnone 744 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 745 store float %call, float* %arrayidx2, align 4 746 %indvars.iv.next = add i64 %indvars.iv, 1 747 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 748 %exitcond = icmp eq i32 %lftr.wideiv, %n 749 br i1 %exitcond, label %for.end, label %for.body 750 751for.end: ; preds = %for.body, %entry 752 ret void 753} 754 755declare float @llvm.nearbyint.f32(float) nounwind readnone 756 757;CHECK-LABEL: @nearbyint_f64( 758;CHECK: llvm.nearbyint.v4f64 759;CHECK: ret void 760define void @nearbyint_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 761entry: 762 %cmp6 = icmp sgt i32 %n, 0 763 br i1 %cmp6, label %for.body, label %for.end 764 765for.body: ; preds = %entry, %for.body 766 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 767 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 768 %0 = load double, double* %arrayidx, align 8 769 %call = tail call double @llvm.nearbyint.f64(double %0) nounwind readnone 770 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 771 store double %call, double* %arrayidx2, align 8 772 %indvars.iv.next = add i64 %indvars.iv, 1 773 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 774 %exitcond = icmp eq i32 %lftr.wideiv, %n 775 br i1 %exitcond, label %for.end, label %for.body 776 777for.end: ; preds = %for.body, %entry 778 ret void 779} 780 781declare double @llvm.nearbyint.f64(double) nounwind readnone 782 783;CHECK-LABEL: @round_f32( 784;CHECK: llvm.round.v4f32 785;CHECK: ret void 786define void @round_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 787entry: 788 %cmp6 = icmp sgt i32 %n, 0 789 br i1 %cmp6, label %for.body, label %for.end 790 791for.body: ; preds = %entry, %for.body 792 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 793 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 794 %0 = load float, float* %arrayidx, align 4 795 %call = tail call float @llvm.round.f32(float %0) nounwind readnone 796 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 797 store float %call, float* %arrayidx2, align 4 798 %indvars.iv.next = add i64 %indvars.iv, 1 799 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 800 %exitcond = icmp eq i32 %lftr.wideiv, %n 801 br i1 %exitcond, label %for.end, label %for.body 802 803for.end: ; preds = %for.body, %entry 804 ret void 805} 806 807declare float @llvm.round.f32(float) nounwind readnone 808 809;CHECK-LABEL: @round_f64( 810;CHECK: llvm.round.v4f64 811;CHECK: ret void 812define void @round_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 813entry: 814 %cmp6 = icmp sgt i32 %n, 0 815 br i1 %cmp6, label %for.body, label %for.end 816 817for.body: ; preds = %entry, %for.body 818 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 819 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 820 %0 = load double, double* %arrayidx, align 8 821 %call = tail call double @llvm.round.f64(double %0) nounwind readnone 822 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 823 store double %call, double* %arrayidx2, align 8 824 %indvars.iv.next = add i64 %indvars.iv, 1 825 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 826 %exitcond = icmp eq i32 %lftr.wideiv, %n 827 br i1 %exitcond, label %for.end, label %for.body 828 829for.end: ; preds = %for.body, %entry 830 ret void 831} 832 833declare double @llvm.round.f64(double) nounwind readnone 834 835;CHECK-LABEL: @roundeven_f32( 836;CHECK: llvm.roundeven.v4f32 837;CHECK: ret void 838define void @roundeven_f32(i32 %n, float* noalias %y, float* noalias %x) nounwind uwtable { 839entry: 840 %cmp6 = icmp sgt i32 %n, 0 841 br i1 %cmp6, label %for.body, label %for.end 842 843for.body: ; preds = %entry, %for.body 844 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 845 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 846 %0 = load float, float* %arrayidx, align 4 847 %call = tail call float @llvm.roundeven.f32(float %0) nounwind readnone 848 %arrayidx2 = getelementptr inbounds float, float* %x, i64 %indvars.iv 849 store float %call, float* %arrayidx2, align 4 850 %indvars.iv.next = add i64 %indvars.iv, 1 851 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 852 %exitcond = icmp eq i32 %lftr.wideiv, %n 853 br i1 %exitcond, label %for.end, label %for.body 854 855for.end: ; preds = %for.body, %entry 856 ret void 857} 858 859declare float @llvm.roundeven.f32(float) nounwind readnone 860 861;CHECK-LABEL: @roundeven_f64( 862;CHECK: llvm.roundeven.v4f64 863;CHECK: ret void 864define void @roundeven_f64(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 865entry: 866 %cmp6 = icmp sgt i32 %n, 0 867 br i1 %cmp6, label %for.body, label %for.end 868 869for.body: ; preds = %entry, %for.body 870 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 871 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 872 %0 = load double, double* %arrayidx, align 8 873 %call = tail call double @llvm.roundeven.f64(double %0) nounwind readnone 874 %arrayidx2 = getelementptr inbounds double, double* %x, i64 %indvars.iv 875 store double %call, double* %arrayidx2, align 8 876 %indvars.iv.next = add i64 %indvars.iv, 1 877 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 878 %exitcond = icmp eq i32 %lftr.wideiv, %n 879 br i1 %exitcond, label %for.end, label %for.body 880 881for.end: ; preds = %for.body, %entry 882 ret void 883} 884 885declare double @llvm.roundeven.f64(double) nounwind readnone 886 887;CHECK-LABEL: @fma_f32( 888;CHECK: llvm.fma.v4f32 889;CHECK: ret void 890define void @fma_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z, float* noalias %w) nounwind uwtable { 891entry: 892 %cmp12 = icmp sgt i32 %n, 0 893 br i1 %cmp12, label %for.body, label %for.end 894 895for.body: ; preds = %entry, %for.body 896 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 897 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 898 %0 = load float, float* %arrayidx, align 4 899 %arrayidx2 = getelementptr inbounds float, float* %w, i64 %indvars.iv 900 %1 = load float, float* %arrayidx2, align 4 901 %arrayidx4 = getelementptr inbounds float, float* %z, i64 %indvars.iv 902 %2 = load float, float* %arrayidx4, align 4 903 %3 = tail call float @llvm.fma.f32(float %0, float %2, float %1) 904 %arrayidx6 = getelementptr inbounds float, float* %x, i64 %indvars.iv 905 store float %3, float* %arrayidx6, align 4 906 %indvars.iv.next = add i64 %indvars.iv, 1 907 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 908 %exitcond = icmp eq i32 %lftr.wideiv, %n 909 br i1 %exitcond, label %for.end, label %for.body 910 911for.end: ; preds = %for.body, %entry 912 ret void 913} 914 915declare float @llvm.fma.f32(float, float, float) nounwind readnone 916 917;CHECK-LABEL: @fma_f64( 918;CHECK: llvm.fma.v4f64 919;CHECK: ret void 920define void @fma_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z, double* noalias %w) nounwind uwtable { 921entry: 922 %cmp12 = icmp sgt i32 %n, 0 923 br i1 %cmp12, label %for.body, label %for.end 924 925for.body: ; preds = %entry, %for.body 926 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 927 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 928 %0 = load double, double* %arrayidx, align 8 929 %arrayidx2 = getelementptr inbounds double, double* %w, i64 %indvars.iv 930 %1 = load double, double* %arrayidx2, align 8 931 %arrayidx4 = getelementptr inbounds double, double* %z, i64 %indvars.iv 932 %2 = load double, double* %arrayidx4, align 8 933 %3 = tail call double @llvm.fma.f64(double %0, double %2, double %1) 934 %arrayidx6 = getelementptr inbounds double, double* %x, i64 %indvars.iv 935 store double %3, double* %arrayidx6, align 8 936 %indvars.iv.next = add i64 %indvars.iv, 1 937 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 938 %exitcond = icmp eq i32 %lftr.wideiv, %n 939 br i1 %exitcond, label %for.end, label %for.body 940 941for.end: ; preds = %for.body, %entry 942 ret void 943} 944 945declare double @llvm.fma.f64(double, double, double) nounwind readnone 946 947;CHECK-LABEL: @fmuladd_f32( 948;CHECK: llvm.fmuladd.v4f32 949;CHECK: ret void 950define void @fmuladd_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z, float* noalias %w) nounwind uwtable { 951entry: 952 %cmp12 = icmp sgt i32 %n, 0 953 br i1 %cmp12, label %for.body, label %for.end 954 955for.body: ; preds = %entry, %for.body 956 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 957 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 958 %0 = load float, float* %arrayidx, align 4 959 %arrayidx2 = getelementptr inbounds float, float* %w, i64 %indvars.iv 960 %1 = load float, float* %arrayidx2, align 4 961 %arrayidx4 = getelementptr inbounds float, float* %z, i64 %indvars.iv 962 %2 = load float, float* %arrayidx4, align 4 963 %3 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %1) 964 %arrayidx6 = getelementptr inbounds float, float* %x, i64 %indvars.iv 965 store float %3, float* %arrayidx6, align 4 966 %indvars.iv.next = add i64 %indvars.iv, 1 967 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 968 %exitcond = icmp eq i32 %lftr.wideiv, %n 969 br i1 %exitcond, label %for.end, label %for.body 970 971for.end: ; preds = %for.body, %entry 972 ret void 973} 974 975declare float @llvm.fmuladd.f32(float, float, float) nounwind readnone 976 977;CHECK-LABEL: @fmuladd_f64( 978;CHECK: llvm.fmuladd.v4f64 979;CHECK: ret void 980define void @fmuladd_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z, double* noalias %w) nounwind uwtable { 981entry: 982 %cmp12 = icmp sgt i32 %n, 0 983 br i1 %cmp12, label %for.body, label %for.end 984 985for.body: ; preds = %entry, %for.body 986 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 987 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 988 %0 = load double, double* %arrayidx, align 8 989 %arrayidx2 = getelementptr inbounds double, double* %w, i64 %indvars.iv 990 %1 = load double, double* %arrayidx2, align 8 991 %arrayidx4 = getelementptr inbounds double, double* %z, i64 %indvars.iv 992 %2 = load double, double* %arrayidx4, align 8 993 %3 = tail call double @llvm.fmuladd.f64(double %0, double %2, double %1) 994 %arrayidx6 = getelementptr inbounds double, double* %x, i64 %indvars.iv 995 store double %3, double* %arrayidx6, align 8 996 %indvars.iv.next = add i64 %indvars.iv, 1 997 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 998 %exitcond = icmp eq i32 %lftr.wideiv, %n 999 br i1 %exitcond, label %for.end, label %for.body 1000 1001for.end: ; preds = %for.body, %entry 1002 ret void 1003} 1004 1005declare double @llvm.fmuladd.f64(double, double, double) nounwind readnone 1006 1007;CHECK-LABEL: @pow_f32( 1008;CHECK: llvm.pow.v4f32 1009;CHECK: ret void 1010define void @pow_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable { 1011entry: 1012 %cmp9 = icmp sgt i32 %n, 0 1013 br i1 %cmp9, label %for.body, label %for.end 1014 1015for.body: ; preds = %entry, %for.body 1016 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1017 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 1018 %0 = load float, float* %arrayidx, align 4 1019 %arrayidx2 = getelementptr inbounds float, float* %z, i64 %indvars.iv 1020 %1 = load float, float* %arrayidx2, align 4 1021 %call = tail call float @llvm.pow.f32(float %0, float %1) nounwind readnone 1022 %arrayidx4 = getelementptr inbounds float, float* %x, i64 %indvars.iv 1023 store float %call, float* %arrayidx4, align 4 1024 %indvars.iv.next = add i64 %indvars.iv, 1 1025 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1026 %exitcond = icmp eq i32 %lftr.wideiv, %n 1027 br i1 %exitcond, label %for.end, label %for.body 1028 1029for.end: ; preds = %for.body, %entry 1030 ret void 1031} 1032 1033declare float @llvm.pow.f32(float, float) nounwind readnone 1034 1035;CHECK-LABEL: @pow_f64( 1036;CHECK: llvm.pow.v4f64 1037;CHECK: ret void 1038define void @pow_f64(i32 %n, double* noalias %y, double* noalias %x, double* noalias %z) nounwind uwtable { 1039entry: 1040 %cmp9 = icmp sgt i32 %n, 0 1041 br i1 %cmp9, label %for.body, label %for.end 1042 1043for.body: ; preds = %entry, %for.body 1044 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1045 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 1046 %0 = load double, double* %arrayidx, align 8 1047 %arrayidx2 = getelementptr inbounds double, double* %z, i64 %indvars.iv 1048 %1 = load double, double* %arrayidx2, align 8 1049 %call = tail call double @llvm.pow.f64(double %0, double %1) nounwind readnone 1050 %arrayidx4 = getelementptr inbounds double, double* %x, i64 %indvars.iv 1051 store double %call, double* %arrayidx4, align 8 1052 %indvars.iv.next = add i64 %indvars.iv, 1 1053 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1054 %exitcond = icmp eq i32 %lftr.wideiv, %n 1055 br i1 %exitcond, label %for.end, label %for.body 1056 1057for.end: ; preds = %for.body, %entry 1058 ret void 1059} 1060 1061; CHECK: fabs_libm 1062; CHECK: call <4 x float> @llvm.fabs.v4f32 1063; CHECK: ret void 1064define void @fabs_libm(float* nocapture %x) nounwind { 1065entry: 1066 br label %for.body 1067 1068for.body: ; preds = %entry, %for.body 1069 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 1070 %arrayidx = getelementptr inbounds float, float* %x, i64 %indvars.iv 1071 %0 = load float, float* %arrayidx, align 4 1072 %call = tail call float @fabsf(float %0) nounwind readnone 1073 store float %call, float* %arrayidx, align 4 1074 %indvars.iv.next = add i64 %indvars.iv, 1 1075 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1076 %exitcond = icmp eq i32 %lftr.wideiv, 1024 1077 br i1 %exitcond, label %for.end, label %for.body 1078 1079for.end: ; preds = %for.body 1080 ret void 1081} 1082 1083declare float @fabsf(float) nounwind readnone 1084 1085declare double @llvm.pow.f64(double, double) nounwind readnone 1086 1087 1088 1089; Make sure we don't replace calls to functions with standard library function 1090; signatures but defined with internal linkage. 1091 1092define internal float @roundf(float %x) nounwind readnone { 1093 ret float 0.00000000 1094} 1095; CHECK-LABEL: internal_round 1096; CHECK-NOT: load <4 x float> 1097 1098define void @internal_round(float* nocapture %x) nounwind { 1099entry: 1100 br label %for.body 1101 1102for.body: ; preds = %entry, %for.body 1103 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 1104 %arrayidx = getelementptr inbounds float, float* %x, i64 %indvars.iv 1105 %0 = load float, float* %arrayidx, align 4 1106 %call = tail call float @roundf(float %0) nounwind readnone 1107 store float %call, float* %arrayidx, align 4 1108 %indvars.iv.next = add i64 %indvars.iv, 1 1109 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1110 %exitcond = icmp eq i32 %lftr.wideiv, 1024 1111 br i1 %exitcond, label %for.end, label %for.body 1112 1113for.end: ; preds = %for.body 1114 ret void 1115} 1116 1117; Make sure we don't replace calls to functions with standard library names but 1118; different signatures. 1119 1120declare void @round(double %f) 1121 1122; CHECK-LABEL: wrong_signature 1123; CHECK-NOT: load <4 x double> 1124 1125define void @wrong_signature(double* nocapture %x) nounwind { 1126entry: 1127 br label %for.body 1128 1129for.body: ; preds = %entry, %for.body 1130 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 1131 %arrayidx = getelementptr inbounds double, double* %x, i64 %indvars.iv 1132 %0 = load double, double* %arrayidx, align 4 1133 store double %0, double* %arrayidx, align 4 1134 tail call void @round(double %0) nounwind readnone 1135 %indvars.iv.next = add i64 %indvars.iv, 1 1136 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1137 %exitcond = icmp eq i32 %lftr.wideiv, 1024 1138 br i1 %exitcond, label %for.end, label %for.body 1139 1140for.end: ; preds = %for.body 1141 ret void 1142} 1143 1144declare double @llvm.powi.f64.i32(double %Val, i32 %power) nounwind readnone 1145 1146;CHECK-LABEL: @powi_f64( 1147;CHECK: llvm.powi.v4f64 1148;CHECK: ret void 1149define void @powi_f64(i32 %n, double* noalias %y, double* noalias %x, i32 %P) nounwind uwtable { 1150entry: 1151 %cmp9 = icmp sgt i32 %n, 0 1152 br i1 %cmp9, label %for.body, label %for.end 1153 1154for.body: ; preds = %entry, %for.body 1155 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1156 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 1157 %0 = load double, double* %arrayidx, align 8 1158 %call = tail call double @llvm.powi.f64.i32(double %0, i32 %P) nounwind readnone 1159 %arrayidx4 = getelementptr inbounds double, double* %x, i64 %indvars.iv 1160 store double %call, double* %arrayidx4, align 8 1161 %indvars.iv.next = add i64 %indvars.iv, 1 1162 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1163 %exitcond = icmp eq i32 %lftr.wideiv, %n 1164 br i1 %exitcond, label %for.end, label %for.body 1165 1166for.end: ; preds = %for.body, %entry 1167 ret void 1168} 1169 1170;CHECK-LABEL: @powi_f64_neg( 1171;CHECK-NOT: llvm.powi.v4f64 1172;CHECK: ret void 1173define void @powi_f64_neg(i32 %n, double* noalias %y, double* noalias %x) nounwind uwtable { 1174entry: 1175 %cmp9 = icmp sgt i32 %n, 0 1176 br i1 %cmp9, label %for.body, label %for.end 1177 1178for.body: ; preds = %entry, %for.body 1179 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1180 %arrayidx = getelementptr inbounds double, double* %y, i64 %indvars.iv 1181 %0 = load double, double* %arrayidx, align 8 1182 %1 = trunc i64 %indvars.iv to i32 1183 %call = tail call double @llvm.powi.f64.i32(double %0, i32 %1) nounwind readnone 1184 %arrayidx4 = getelementptr inbounds double, double* %x, i64 %indvars.iv 1185 store double %call, double* %arrayidx4, align 8 1186 %indvars.iv.next = add i64 %indvars.iv, 1 1187 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1188 %exitcond = icmp eq i32 %lftr.wideiv, %n 1189 br i1 %exitcond, label %for.end, label %for.body 1190 1191for.end: ; preds = %for.body, %entry 1192 ret void 1193} 1194 1195declare i64 @llvm.cttz.i64 (i64, i1) nounwind readnone 1196 1197;CHECK-LABEL: @cttz_f64( 1198;CHECK: llvm.cttz.v4i64 1199;CHECK: ret void 1200define void @cttz_f64(i32 %n, i64* noalias %y, i64* noalias %x) nounwind uwtable { 1201entry: 1202 %cmp9 = icmp sgt i32 %n, 0 1203 br i1 %cmp9, label %for.body, label %for.end 1204 1205for.body: ; preds = %entry, %for.body 1206 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1207 %arrayidx = getelementptr inbounds i64, i64* %y, i64 %indvars.iv 1208 %0 = load i64, i64* %arrayidx, align 8 1209 %call = tail call i64 @llvm.cttz.i64(i64 %0, i1 true) nounwind readnone 1210 %arrayidx4 = getelementptr inbounds i64, i64* %x, i64 %indvars.iv 1211 store i64 %call, i64* %arrayidx4, align 8 1212 %indvars.iv.next = add i64 %indvars.iv, 1 1213 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1214 %exitcond = icmp eq i32 %lftr.wideiv, %n 1215 br i1 %exitcond, label %for.end, label %for.body 1216 1217for.end: ; preds = %for.body, %entry 1218 ret void 1219} 1220 1221declare i64 @llvm.ctlz.i64 (i64, i1) nounwind readnone 1222 1223;CHECK-LABEL: @ctlz_f64( 1224;CHECK: llvm.ctlz.v4i64 1225;CHECK: ret void 1226define void @ctlz_f64(i32 %n, i64* noalias %y, i64* noalias %x) nounwind uwtable { 1227entry: 1228 %cmp9 = icmp sgt i32 %n, 0 1229 br i1 %cmp9, label %for.body, label %for.end 1230 1231for.body: ; preds = %entry, %for.body 1232 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1233 %arrayidx = getelementptr inbounds i64, i64* %y, i64 %indvars.iv 1234 %0 = load i64, i64* %arrayidx, align 8 1235 %call = tail call i64 @llvm.ctlz.i64(i64 %0, i1 true) nounwind readnone 1236 %arrayidx4 = getelementptr inbounds i64, i64* %x, i64 %indvars.iv 1237 store i64 %call, i64* %arrayidx4, align 8 1238 %indvars.iv.next = add i64 %indvars.iv, 1 1239 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1240 %exitcond = icmp eq i32 %lftr.wideiv, %n 1241 br i1 %exitcond, label %for.end, label %for.body 1242 1243for.end: ; preds = %for.body, %entry 1244 ret void 1245} 1246 1247declare i64 @llvm.abs.i64 (i64, i1) nounwind readnone 1248 1249define void @abs_i64(i32 %n, i64* noalias %y, i64* noalias %x) nounwind uwtable { 1250;CHECK-LABEL: @abs_i64( 1251;CHECK: llvm.abs.v4i64(<4 x i64> [[WIDE_LOADX:%.*]], i1 true) 1252;CHECK: ret void 1253entry: 1254 %cmp9 = icmp sgt i32 %n, 0 1255 br i1 %cmp9, label %for.body, label %for.end 1256 1257for.body: ; preds = %entry, %for.body 1258 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1259 %arrayidx = getelementptr inbounds i64, i64* %y, i64 %indvars.iv 1260 %0 = load i64, i64* %arrayidx, align 8 1261 %call = tail call i64 @llvm.abs.i64(i64 %0, i1 true) nounwind readnone 1262 %arrayidx4 = getelementptr inbounds i64, i64* %x, i64 %indvars.iv 1263 store i64 %call, i64* %arrayidx4, align 8 1264 %indvars.iv.next = add i64 %indvars.iv, 1 1265 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1266 %exitcond = icmp eq i32 %lftr.wideiv, %n 1267 br i1 %exitcond, label %for.end, label %for.body 1268 1269for.end: ; preds = %for.body, %entry 1270 ret void 1271} 1272 1273declare i32 @llvm.smin.i32 (i32, i32) 1274 1275define void @smin_i32(i32 %n, i32* noalias %x, i32* noalias %y) { 1276; CHECK-LABEL: @smin_i32( 1277; CHECK: call <4 x i32> @llvm.smin.v4i32(<4 x i32> [[WIDE_LOADX:%.*]], <4 x i32> [[WIDE_LOADY:%.*]]) 1278; CHECK: ret void 1279entry: 1280 %cmp = icmp sgt i32 %n, 0 1281 br i1 %cmp, label %loop, label %end 1282 1283loop: 1284 %iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ] 1285 %xi = getelementptr inbounds i32, i32* %x, i32 %iv 1286 %yi = getelementptr inbounds i32, i32* %y, i32 %iv 1287 %xld = load i32, i32* %xi, align 4 1288 %yld = load i32, i32* %yi, align 4 1289 %call = tail call i32 @llvm.smin.i32(i32 %xld, i32 %yld) 1290 store i32 %call, i32* %xi, align 4 1291 %iv.next = add i32 %iv, 1 1292 %exitcond = icmp eq i32 %iv.next, %n 1293 br i1 %exitcond, label %end, label %loop 1294 1295end: 1296 ret void 1297} 1298 1299declare i32 @llvm.smax.i32 (i32, i32) 1300 1301define void @smax_i32(i32 %n, i32* noalias %x, i32* noalias %y) { 1302; CHECK-LABEL: @smax_i32( 1303; CHECK: call <4 x i32> @llvm.smax.v4i32(<4 x i32> [[WIDE_LOADX:%.*]], <4 x i32> [[WIDE_LOADY:%.*]]) 1304; CHECK: ret void 1305entry: 1306 %cmp = icmp sgt i32 %n, 0 1307 br i1 %cmp, label %loop, label %end 1308 1309loop: 1310 %iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ] 1311 %xi = getelementptr inbounds i32, i32* %x, i32 %iv 1312 %yi = getelementptr inbounds i32, i32* %y, i32 %iv 1313 %xld = load i32, i32* %xi, align 4 1314 %yld = load i32, i32* %yi, align 4 1315 %call = tail call i32 @llvm.smax.i32(i32 %xld, i32 %yld) 1316 store i32 %call, i32* %xi, align 4 1317 %iv.next = add i32 %iv, 1 1318 %exitcond = icmp eq i32 %iv.next, %n 1319 br i1 %exitcond, label %end, label %loop 1320 1321end: 1322 ret void 1323} 1324 1325declare i32 @llvm.umin.i32 (i32, i32) 1326 1327define void @umin_i32(i32 %n, i32* noalias %x, i32* noalias %y) { 1328; CHECK-LABEL: @umin_i32( 1329; CHECK: call <4 x i32> @llvm.umin.v4i32(<4 x i32> [[WIDE_LOADX:%.*]], <4 x i32> [[WIDE_LOADY:%.*]]) 1330; CHECK: ret void 1331entry: 1332 %cmp = icmp sgt i32 %n, 0 1333 br i1 %cmp, label %loop, label %end 1334 1335loop: 1336 %iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ] 1337 %xi = getelementptr inbounds i32, i32* %x, i32 %iv 1338 %yi = getelementptr inbounds i32, i32* %y, i32 %iv 1339 %xld = load i32, i32* %xi, align 4 1340 %yld = load i32, i32* %yi, align 4 1341 %call = tail call i32 @llvm.umin.i32(i32 %xld, i32 %yld) 1342 store i32 %call, i32* %xi, align 4 1343 %iv.next = add i32 %iv, 1 1344 %exitcond = icmp eq i32 %iv.next, %n 1345 br i1 %exitcond, label %end, label %loop 1346 1347end: 1348 ret void 1349} 1350 1351declare i32 @llvm.umax.i32 (i32, i32) 1352 1353define void @umax_i32(i32 %n, i32* noalias %x, i32* noalias %y) { 1354; CHECK-LABEL: @umax_i32( 1355; CHECK: call <4 x i32> @llvm.umax.v4i32(<4 x i32> [[WIDE_LOADX:%.*]], <4 x i32> [[WIDE_LOADY:%.*]]) 1356; CHECK: ret void 1357entry: 1358 %cmp = icmp sgt i32 %n, 0 1359 br i1 %cmp, label %loop, label %end 1360 1361loop: 1362 %iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ] 1363 %xi = getelementptr inbounds i32, i32* %x, i32 %iv 1364 %yi = getelementptr inbounds i32, i32* %y, i32 %iv 1365 %xld = load i32, i32* %xi, align 4 1366 %yld = load i32, i32* %yi, align 4 1367 %call = tail call i32 @llvm.umax.i32(i32 %xld, i32 %yld) 1368 store i32 %call, i32* %xi, align 4 1369 %iv.next = add i32 %iv, 1 1370 %exitcond = icmp eq i32 %iv.next, %n 1371 br i1 %exitcond, label %end, label %loop 1372 1373end: 1374 ret void 1375} 1376 1377declare i32 @llvm.fshl.i32 (i32, i32, i32) 1378 1379define void @fshl_i32(i32 %n, i32* noalias %x, i32* noalias %y, i32 %shAmt) { 1380; CHECK-LABEL: @fshl_i32( 1381; CHECK: call <4 x i32> @llvm.fshl.v4i32(<4 x i32> [[WIDE_LOADX:%.*]], <4 x i32> [[WIDE_LOADY:%.*]], <4 x i32> [[SPLAT:%.*]]) 1382; CHECK: ret void 1383entry: 1384 %cmp = icmp sgt i32 %n, 0 1385 br i1 %cmp, label %loop, label %end 1386 1387loop: 1388 %iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ] 1389 %xi = getelementptr inbounds i32, i32* %x, i32 %iv 1390 %yi = getelementptr inbounds i32, i32* %y, i32 %iv 1391 %xld = load i32, i32* %xi, align 4 1392 %yld = load i32, i32* %yi, align 4 1393 %call = tail call i32 @llvm.fshl.i32(i32 %xld, i32 %yld, i32 %shAmt) 1394 store i32 %call, i32* %xi, align 4 1395 %iv.next = add i32 %iv, 1 1396 %exitcond = icmp eq i32 %iv.next, %n 1397 br i1 %exitcond, label %end, label %loop 1398 1399end: 1400 ret void 1401} 1402 1403declare i32 @llvm.fshr.i32 (i32, i32, i32) 1404 1405define void @fshr_i32(i32 %n, i32* noalias %x, i32* noalias %y, i32 %shAmt) { 1406; CHECK-LABEL: @fshr_i32( 1407; CHECK: call <4 x i32> @llvm.fshr.v4i32(<4 x i32> [[WIDE_LOADX:%.*]], <4 x i32> [[WIDE_LOADY:%.*]], <4 x i32> [[SPLAT:%.*]]) 1408; CHECK: ret void 1409entry: 1410 %cmp = icmp sgt i32 %n, 0 1411 br i1 %cmp, label %loop, label %end 1412 1413loop: 1414 %iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ] 1415 %xi = getelementptr inbounds i32, i32* %x, i32 %iv 1416 %yi = getelementptr inbounds i32, i32* %y, i32 %iv 1417 %xld = load i32, i32* %xi, align 4 1418 %yld = load i32, i32* %yi, align 4 1419 %call = tail call i32 @llvm.fshr.i32(i32 %xld, i32 %yld, i32 %shAmt) 1420 store i32 %call, i32* %xi, align 4 1421 %iv.next = add i32 %iv, 1 1422 %exitcond = icmp eq i32 %iv.next, %n 1423 br i1 %exitcond, label %end, label %loop 1424 1425end: 1426 ret void 1427} 1428 1429declare float @llvm.minnum.f32(float, float) nounwind readnone 1430 1431;CHECK-LABEL: @minnum_f32( 1432;CHECK: llvm.minnum.v4f32 1433;CHECK: ret void 1434define void @minnum_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable { 1435entry: 1436 %cmp9 = icmp sgt i32 %n, 0 1437 br i1 %cmp9, label %for.body, label %for.end 1438 1439for.body: ; preds = %entry, %for.body 1440 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1441 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 1442 %0 = load float, float* %arrayidx, align 4 1443 %arrayidx2 = getelementptr inbounds float, float* %z, i64 %indvars.iv 1444 %1 = load float, float* %arrayidx2, align 4 1445 %call = tail call float @llvm.minnum.f32(float %0, float %1) nounwind readnone 1446 %arrayidx4 = getelementptr inbounds float, float* %x, i64 %indvars.iv 1447 store float %call, float* %arrayidx4, align 4 1448 %indvars.iv.next = add i64 %indvars.iv, 1 1449 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1450 %exitcond = icmp eq i32 %lftr.wideiv, %n 1451 br i1 %exitcond, label %for.end, label %for.body 1452 1453for.end: ; preds = %for.body, %entry 1454 ret void 1455} 1456 1457declare float @llvm.maxnum.f32(float, float) nounwind readnone 1458 1459;CHECK-LABEL: @maxnum_f32( 1460;CHECK: llvm.maxnum.v4f32 1461;CHECK: ret void 1462define void @maxnum_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable { 1463entry: 1464 %cmp9 = icmp sgt i32 %n, 0 1465 br i1 %cmp9, label %for.body, label %for.end 1466 1467for.body: ; preds = %entry, %for.body 1468 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1469 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 1470 %0 = load float, float* %arrayidx, align 4 1471 %arrayidx2 = getelementptr inbounds float, float* %z, i64 %indvars.iv 1472 %1 = load float, float* %arrayidx2, align 4 1473 %call = tail call float @llvm.maxnum.f32(float %0, float %1) nounwind readnone 1474 %arrayidx4 = getelementptr inbounds float, float* %x, i64 %indvars.iv 1475 store float %call, float* %arrayidx4, align 4 1476 %indvars.iv.next = add i64 %indvars.iv, 1 1477 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1478 %exitcond = icmp eq i32 %lftr.wideiv, %n 1479 br i1 %exitcond, label %for.end, label %for.body 1480 1481for.end: ; preds = %for.body, %entry 1482 ret void 1483} 1484 1485declare float @llvm.minimum.f32(float, float) nounwind readnone 1486 1487;CHECK-LABEL: @minimum_f32( 1488;CHECK: llvm.minimum.v4f32 1489;CHECK: ret void 1490define void @minimum_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable { 1491entry: 1492 %cmp9 = icmp sgt i32 %n, 0 1493 br i1 %cmp9, label %for.body, label %for.end 1494 1495for.body: ; preds = %entry, %for.body 1496 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1497 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 1498 %0 = load float, float* %arrayidx, align 4 1499 %arrayidx2 = getelementptr inbounds float, float* %z, i64 %indvars.iv 1500 %1 = load float, float* %arrayidx2, align 4 1501 %call = tail call float @llvm.minimum.f32(float %0, float %1) nounwind readnone 1502 %arrayidx4 = getelementptr inbounds float, float* %x, i64 %indvars.iv 1503 store float %call, float* %arrayidx4, align 4 1504 %indvars.iv.next = add i64 %indvars.iv, 1 1505 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1506 %exitcond = icmp eq i32 %lftr.wideiv, %n 1507 br i1 %exitcond, label %for.end, label %for.body 1508 1509for.end: ; preds = %for.body, %entry 1510 ret void 1511} 1512 1513declare float @llvm.maximum.f32(float, float) nounwind readnone 1514 1515;CHECK-LABEL: @maximum_f32( 1516;CHECK: llvm.maximum.v4f32 1517;CHECK: ret void 1518define void @maximum_f32(i32 %n, float* noalias %y, float* noalias %x, float* noalias %z) nounwind uwtable { 1519entry: 1520 %cmp9 = icmp sgt i32 %n, 0 1521 br i1 %cmp9, label %for.body, label %for.end 1522 1523for.body: ; preds = %entry, %for.body 1524 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 1525 %arrayidx = getelementptr inbounds float, float* %y, i64 %indvars.iv 1526 %0 = load float, float* %arrayidx, align 4 1527 %arrayidx2 = getelementptr inbounds float, float* %z, i64 %indvars.iv 1528 %1 = load float, float* %arrayidx2, align 4 1529 %call = tail call float @llvm.maximum.f32(float %0, float %1) nounwind readnone 1530 %arrayidx4 = getelementptr inbounds float, float* %x, i64 %indvars.iv 1531 store float %call, float* %arrayidx4, align 4 1532 %indvars.iv.next = add i64 %indvars.iv, 1 1533 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 1534 %exitcond = icmp eq i32 %lftr.wideiv, %n 1535 br i1 %exitcond, label %for.end, label %for.body 1536 1537for.end: ; preds = %for.body, %entry 1538 ret void 1539} 1540