Home | History | Annotate | Download | only in X86
      1 ; RUN: opt < %s -basicaa -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | 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-apple-macosx10.7.0"
      5 
      6 @.str = private unnamed_addr constant [6 x i8] c"bingo\00", align 1
      7 
      8 ; We can't vectorize when the roots are used inside the tree.
      9 ;CHECK-LABEL: @in_tree_user(
     10 ;CHECK-NOT: load <2 x double>
     11 ;CHECK: ret
     12 define void @in_tree_user(double* nocapture %A, i32 %n) {
     13 entry:
     14   %conv = sitofp i32 %n to double
     15   br label %for.body
     16 
     17 for.body:                                         ; preds = %for.inc, %entry
     18   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
     19   %0 = shl nsw i64 %indvars.iv, 1
     20   %arrayidx = getelementptr inbounds double* %A, i64 %0
     21   %1 = load double* %arrayidx, align 8
     22   %mul1 = fmul double %conv, %1
     23   %mul2 = fmul double %mul1, 7.000000e+00
     24   %add = fadd double %mul2, 5.000000e+00
     25   %BadValue = fadd double %add, %add    ; <------------------ In tree user.
     26   %2 = or i64 %0, 1
     27   %arrayidx6 = getelementptr inbounds double* %A, i64 %2
     28   %3 = load double* %arrayidx6, align 8
     29   %mul8 = fmul double %conv, %3
     30   %mul9 = fmul double %mul8, 4.000000e+00
     31   %add10 = fadd double %mul9, 9.000000e+00
     32   %cmp11 = fcmp ogt double %add, %add10
     33   br i1 %cmp11, label %if.then, label %for.inc
     34 
     35 if.then:                                          ; preds = %for.body
     36   %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i64 0, i64 0))
     37   br label %for.inc
     38 
     39 for.inc:                                          ; preds = %for.body, %if.then
     40   %indvars.iv.next = add i64 %indvars.iv, 1
     41   %lftr.wideiv = trunc i64 %indvars.iv.next to i32
     42   %exitcond = icmp eq i32 %lftr.wideiv, 100
     43   br i1 %exitcond, label %for.end, label %for.body
     44 
     45 for.end:                                          ; preds = %for.inc
     46   ret void
     47 }
     48 
     49 declare i32 @printf(i8* nocapture, ...)
     50 
     51