1 ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
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"
6 define i32 @foo(ptr nocapture %A) nounwind uwtable readonly ssp {
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 ], [ %11, %vector.body ]
13 %0 = getelementptr inbounds i32, ptr %A, i64 %index
14 %1 = load <2 x i32>, ptr %0, align 4
15 %2 = sext <2 x i32> %1 to <2 x i64>
16 ;CHECK: cost of 1 {{.*}} extract
17 %3 = extractelement <2 x i64> %2, i32 0
18 %4 = getelementptr inbounds i32, ptr %A, i64 %3
19 ;CHECK: cost of 1 {{.*}} extract
20 %5 = extractelement <2 x i64> %2, i32 1
21 %6 = getelementptr inbounds i32, ptr %A, i64 %5
22 %7 = load i32, ptr %4, align 4
23 ;CHECK: cost of 0 {{.*}} insert
24 %8 = insertelement <2 x i32> poison, i32 %7, i32 0
25 %9 = load i32, ptr %6, align 4
26 ;CHECK: cost of 1 {{.*}} insert
27 %10 = insertelement <2 x i32> %8, i32 %9, i32 1
28 %11 = add nsw <2 x i32> %10, %vec.phi
29 %index.next = add i64 %index, 2
30 %12 = icmp eq i64 %index.next, 192
31 br i1 %12, label %for.end, label %vector.body
33 for.end: ; preds = %vector.body
34 %13 = extractelement <2 x i32> %11, i32 0
35 %14 = extractelement <2 x i32> %11, i32 1
36 %15 = add i32 %13, %14