1; RUN: opt < %s  -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s
2
3target 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"
4target triple = "x86_64-apple-macosx10.8.0"
5
6define i32 @stores(i32 %arg) {
7
8  ;CHECK: cost of 1 {{.*}} store
9  store i8 undef, i8* undef, align 4
10  ;CHECK: cost of 1 {{.*}} store
11  store i16 undef, i16* undef, align 4
12  ;CHECK: cost of 1 {{.*}} store
13  store i32 undef, i32* undef, align 4
14  ;CHECK: cost of 1 {{.*}} store
15  store i64 undef, i64* undef, align 4
16  ;CHECK: cost of 2 {{.*}} store
17  store i128 undef, i128* undef, align 4
18
19  ;CHECK: cost of 1 {{.*}} store
20  store <4 x i16> undef, <4 x i16>* undef, align 4
21  ;CHECK: cost of 1 {{.*}} store
22  store <4 x i32> undef, <4 x i32>* undef, align 4
23  ;CHECK: cost of 2 {{.*}} store
24  store <4 x i64> undef, <4 x i64>* undef, align 4
25
26  ;CHECK: cost of 1 {{.*}} store
27  store <8 x i16> undef, <8 x i16>* undef, align 4
28  ;CHECK: cost of 2 {{.*}} store
29  store <8 x i32> undef, <8 x i32>* undef, align 4
30  ;CHECK: cost of 4 {{.*}} store
31  store <8 x i64> undef, <8 x i64>* undef, align 4
32
33  ret i32 undef
34}
35define i32 @loads(i32 %arg) {
36  ;CHECK: cost of 1 {{.*}} load
37  load i8, i8* undef, align 4
38  ;CHECK: cost of 1 {{.*}} load
39  load i16, i16* undef, align 4
40  ;CHECK: cost of 1 {{.*}} load
41  load i32, i32* undef, align 4
42  ;CHECK: cost of 1 {{.*}} load
43  load i64, i64* undef, align 4
44  ;CHECK: cost of 2 {{.*}} load
45  load i128, i128* undef, align 4
46
47  ;CHECK: cost of 1 {{.*}} load
48  load <2 x i32>, <2 x i32>* undef, align 4
49  ;CHECK: cost of 1 {{.*}} load
50  load <4 x i32>, <4 x i32>* undef, align 4
51  ;CHECK: cost of 2 {{.*}} load
52  load <8 x i32>, <8 x i32>* undef, align 4
53
54
55  ;CHECK: cost of 1 {{.*}} load
56  load <2 x i64>, <2 x i64>* undef, align 4
57  ;CHECK: cost of 2 {{.*}} load
58  load <4 x i64>, <4 x i64>* undef, align 4
59  ;CHECK: cost of 4 {{.*}} load
60  load <8 x i64>, <8 x i64>* undef, align 4
61
62
63  ;CHECK: cost of 3 {{.*}} load
64  load <3 x float>, <3 x float>* undef, align 4
65
66  ;CHECK: cost of 3 {{.*}} load
67  load <3 x double>, <3 x double>* undef, align 4
68
69  ;CHECK: cost of 3 {{.*}} load
70  load <3 x i32>, <3 x i32>* undef, align 4
71
72  ;CHECK: cost of 3 {{.*}} load
73  load <3 x i64>, <3 x i64>* undef, align 4
74
75  ;CHECK: cost of 10 {{.*}} load
76  load <5 x i32>, <5 x i32>* undef, align 4
77
78  ;CHECK: cost of 10 {{.*}} load
79  load <5 x i64>, <5 x i64>* undef, align 4
80
81  ret i32 undef
82}
83
84