Home | History | Annotate | Download | only in X86
      1 ; RUN: opt < %s  -cost-model -analyze -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.9.0"
      5 
      6 define i32 @foo(i32* nocapture %A) nounwind uwtable readonly ssp {
      7 vector.ph:
      8   br label %vector.body
      9 
     10 vector.body:                                      ; preds = %vector.body, %vector.ph
     11   %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
     12   %vec.phi = phi <2 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
     13   %0 = getelementptr inbounds i32, i32* %A, i64 %index
     14   %1 = bitcast i32* %0 to <2 x i32>*
     15   %2 = load <2 x i32>, <2 x i32>* %1, align 4
     16   %3 = sext <2 x i32> %2 to <2 x i64>
     17   ;CHECK: cost of 1 {{.*}} extract
     18   %4 = extractelement <2 x i64> %3, i32 0
     19   %5 = getelementptr inbounds i32, i32* %A, i64 %4
     20   ;CHECK: cost of 1 {{.*}} extract
     21   %6 = extractelement <2 x i64> %3, i32 1
     22   %7 = getelementptr inbounds i32, i32* %A, i64 %6
     23   %8 = load i32, i32* %5, align 4
     24   ;CHECK: cost of 1 {{.*}} insert
     25   %9 = insertelement <2 x i32> undef, i32 %8, i32 0
     26   %10 = load i32, i32* %7, align 4
     27   ;CHECK: cost of 1 {{.*}} insert
     28   %11 = insertelement <2 x i32> %9, i32 %10, i32 1
     29   %12 = add nsw <2 x i32> %11, %vec.phi
     30   %index.next = add i64 %index, 2
     31   %13 = icmp eq i64 %index.next, 192
     32   br i1 %13, label %for.end, label %vector.body
     33 
     34 for.end:                                          ; preds = %vector.body
     35   %14 = extractelement <2 x i32> %12, i32 0
     36   %15 = extractelement <2 x i32> %12, i32 1
     37   %16 = add i32 %14, %15
     38   ret i32 %16
     39 }
     40