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.8.0"
      5 
      6 ;CHECK-LABEL: @foo(
      7 ;CHECK: load <4 x i32>
      8 ;CHECK: add <4 x i32>
      9 ;CHECK: store <4 x i32>
     10 ;CHECK: load <4 x i32>
     11 ;CHECK: add <4 x i32>
     12 ;CHECK: store <4 x i32>
     13 ;CHECK: ret
     14 define i32 @foo(i32* nocapture %A, i32 %n) #0 {
     15 entry:
     16   %cmp62 = icmp sgt i32 %n, 0
     17   br i1 %cmp62, label %for.body, label %for.end
     18 
     19 for.body:                                         ; preds = %entry, %for.body
     20   %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
     21   %arrayidx = getelementptr inbounds i32* %A, i64 %indvars.iv
     22   %0 = load i32* %arrayidx, align 4
     23   %add1 = add nsw i32 %0, %n
     24   store i32 %add1, i32* %arrayidx, align 4
     25   %1 = or i64 %indvars.iv, 1
     26   %arrayidx4 = getelementptr inbounds i32* %A, i64 %1
     27   %2 = load i32* %arrayidx4, align 4
     28   %add5 = add nsw i32 %2, %n
     29   store i32 %add5, i32* %arrayidx4, align 4
     30   %3 = or i64 %indvars.iv, 2
     31   %arrayidx8 = getelementptr inbounds i32* %A, i64 %3
     32   %4 = load i32* %arrayidx8, align 4
     33   %add9 = add nsw i32 %4, %n
     34   store i32 %add9, i32* %arrayidx8, align 4
     35   %5 = or i64 %indvars.iv, 3
     36   %arrayidx12 = getelementptr inbounds i32* %A, i64 %5
     37   %6 = load i32* %arrayidx12, align 4
     38   %add13 = add nsw i32 %6, %n
     39   store i32 %add13, i32* %arrayidx12, align 4
     40   %7 = or i64 %indvars.iv, 4
     41   %arrayidx16 = getelementptr inbounds i32* %A, i64 %7
     42   %8 = load i32* %arrayidx16, align 4
     43   %add17 = add nsw i32 %8, %n
     44   store i32 %add17, i32* %arrayidx16, align 4
     45   %9 = or i64 %indvars.iv, 5
     46   %arrayidx20 = getelementptr inbounds i32* %A, i64 %9
     47   %10 = load i32* %arrayidx20, align 4
     48   %add21 = add nsw i32 %10, %n
     49   store i32 %add21, i32* %arrayidx20, align 4
     50   %11 = or i64 %indvars.iv, 6
     51   %arrayidx24 = getelementptr inbounds i32* %A, i64 %11
     52   %12 = load i32* %arrayidx24, align 4
     53   %add25 = add nsw i32 %12, %n
     54   store i32 %add25, i32* %arrayidx24, align 4
     55   %13 = or i64 %indvars.iv, 7
     56   %arrayidx28 = getelementptr inbounds i32* %A, i64 %13
     57   %14 = load i32* %arrayidx28, align 4
     58   %add29 = add nsw i32 %14, %n
     59   store i32 %add29, i32* %arrayidx28, align 4
     60   %indvars.iv.next = add i64 %indvars.iv, 8
     61   %15 = trunc i64 %indvars.iv.next to i32
     62   %cmp = icmp slt i32 %15, %n
     63   br i1 %cmp, label %for.body, label %for.end
     64 
     65 for.end:                                          ; preds = %for.body, %entry
     66   ret i32 undef
     67 }
     68 
     69 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
     70