Home | History | Annotate | Download | only in X86
      1 ; RUN: opt < %s  -loop-vectorize -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 -S | FileCheck %s
      2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      3 target triple = "x86_64-unknown-linux-gnu"
      4 
      5 ; Function Attrs: nounwind uwtable
      6 define void @test1(float* noalias nocapture %a, float* noalias nocapture readonly %b) #0 {
      7 entry:
      8   br label %for.body
      9 
     10 ; CHECK-LABEL: @test1
     11 ; CHECK: vector.body:
     12 ; CHECK: @llvm.assume
     13 ; CHECK: @llvm.assume
     14 ; CHECK: @llvm.assume
     15 ; CHECK: @llvm.assume
     16 ; CHECK: @llvm.assume
     17 ; CHECK: @llvm.assume
     18 ; CHECK: @llvm.assume
     19 ; CHECK: @llvm.assume
     20 ; CHECK: for.body:
     21 ; CHECK: ret void
     22 
     23 for.body:                                         ; preds = %for.body, %entry
     24   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
     25   %arrayidx = getelementptr inbounds float, float* %b, i64 %indvars.iv
     26   %0 = load float, float* %arrayidx, align 4
     27   %cmp1 = fcmp ogt float %0, 1.000000e+02
     28   tail call void @llvm.assume(i1 %cmp1)
     29   %add = fadd float %0, 1.000000e+00
     30   %arrayidx5 = getelementptr inbounds float, float* %a, i64 %indvars.iv
     31   store float %add, float* %arrayidx5, align 4
     32   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
     33   %exitcond = icmp eq i64 %indvars.iv, 1599
     34   br i1 %exitcond, label %for.end, label %for.body
     35 
     36 for.end:                                          ; preds = %for.body
     37   ret void
     38 }
     39 
     40 ; Function Attrs: nounwind
     41 declare void @llvm.assume(i1) #1
     42 
     43 attributes #0 = { nounwind uwtable }
     44 attributes #1 = { nounwind }
     45 
     46 %struct.data = type { float*, float* }
     47 
     48 ; Function Attrs: nounwind uwtable
     49 define void @test2(%struct.data* nocapture readonly %d) #0 {
     50 entry:
     51   %b = getelementptr inbounds %struct.data, %struct.data* %d, i64 0, i32 1
     52   %0 = load float*, float** %b, align 8
     53   %ptrint = ptrtoint float* %0 to i64
     54   %maskedptr = and i64 %ptrint, 31
     55   %maskcond = icmp eq i64 %maskedptr, 0
     56   %a = getelementptr inbounds %struct.data, %struct.data* %d, i64 0, i32 0
     57   %1 = load float*, float** %a, align 8
     58   %ptrint2 = ptrtoint float* %1 to i64
     59   %maskedptr3 = and i64 %ptrint2, 31
     60   %maskcond4 = icmp eq i64 %maskedptr3, 0
     61   br label %for.body
     62 
     63 ; CHECK-LABEL: @test2
     64 ; CHECK: vector.body:
     65 ; CHECK: @llvm.assume
     66 ; CHECK: @llvm.assume
     67 ; CHECK: @llvm.assume
     68 ; CHECK: @llvm.assume
     69 ; CHECK: @llvm.assume
     70 ; CHECK: @llvm.assume
     71 ; CHECK: @llvm.assume
     72 ; CHECK: @llvm.assume
     73 ; CHECK: @llvm.assume
     74 ; CHECK: @llvm.assume
     75 ; CHECK: @llvm.assume
     76 ; CHECK: @llvm.assume
     77 ; CHECK: @llvm.assume
     78 ; CHECK: @llvm.assume
     79 ; CHECK: @llvm.assume
     80 ; CHECK: @llvm.assume
     81 ; CHECK: for.body:
     82 ; CHECK: ret void
     83 
     84 for.body:                                         ; preds = %for.body, %entry
     85   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
     86   tail call void @llvm.assume(i1 %maskcond)
     87   %arrayidx = getelementptr inbounds float, float* %0, i64 %indvars.iv
     88   %2 = load float, float* %arrayidx, align 4
     89   %add = fadd float %2, 1.000000e+00
     90   tail call void @llvm.assume(i1 %maskcond4)
     91   %arrayidx5 = getelementptr inbounds float, float* %1, i64 %indvars.iv
     92   store float %add, float* %arrayidx5, align 4
     93   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
     94   %exitcond = icmp eq i64 %indvars.iv, 1599
     95   br i1 %exitcond, label %for.end, label %for.body
     96 
     97 for.end:                                          ; preds = %for.body
     98   ret void
     99 }
    100 
    101