1; RUN: opt < %s  -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck -check-prefix=CHECK -check-prefix=AVX1 %s
2; RUN: opt < %s  -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core-avx2 | FileCheck -check-prefix=CHECK -check-prefix=AVX2 %s
3; RUN: opt < %s  -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=knl | FileCheck -check-prefix=CHECK -check-prefix=AVX512 %s
4
5target 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"
6target triple = "x86_64-apple-macosx10.8.0"
7
8define i32 @cmp(i32 %arg) {
9  ;  -- floats --
10  ;AVX1: cost of 1 {{.*}} fcmp
11  ;AVX2: cost of 1 {{.*}} fcmp
12  %A = fcmp olt <2 x float> undef, undef
13  ;AVX1: cost of 1 {{.*}} fcmp
14  ;AVX2: cost of 1 {{.*}} fcmp
15  %B = fcmp olt <4 x float> undef, undef
16  ;AVX1: cost of 1 {{.*}} fcmp
17  ;AVX2: cost of 1 {{.*}} fcmp
18  %C = fcmp olt <8 x float> undef, undef
19  ;AVX1: cost of 1 {{.*}} fcmp
20  ;AVX2: cost of 1 {{.*}} fcmp
21  %D = fcmp olt <2 x double> undef, undef
22  ;AVX1: cost of 1 {{.*}} fcmp
23  ;AVX2: cost of 1 {{.*}} fcmp
24  %E = fcmp olt <4 x double> undef, undef
25
26  ; AVX512: cost of 1 {{.*}} %E1 = fcmp
27  %E1 = fcmp olt <16 x float> undef, undef
28  ; AVX512: cost of 2 {{.*}} %E2 = fcmp
29  %E2 = fcmp olt <16 x double> undef, undef
30
31  ;  -- integers --
32
33  ;AVX1: cost of 1 {{.*}} icmp
34  ;AVX2: cost of 1 {{.*}} icmp
35  %F = icmp eq <16 x i8> undef, undef
36  ;AVX1: cost of 1 {{.*}} icmp
37  ;AVX2: cost of 1 {{.*}} icmp
38  %G = icmp eq <8 x i16> undef, undef
39  ;AVX1: cost of 1 {{.*}} icmp
40  ;AVX2: cost of 1 {{.*}} icmp
41  %H = icmp eq <4 x i32> undef, undef
42  ;AVX1: cost of 1 {{.*}} icmp
43  ;AVX2: cost of 1 {{.*}} icmp
44  %I = icmp eq <2 x i64> undef, undef
45  ;AVX1: cost of 4 {{.*}} icmp
46  ;AVX2: cost of 1 {{.*}} icmp
47  %J = icmp eq <4 x i64> undef, undef
48  ;AVX1: cost of 4 {{.*}} icmp
49  ;AVX2: cost of 1 {{.*}} icmp
50  %K = icmp eq <8 x i32> undef, undef
51  ;AVX1: cost of 4 {{.*}} icmp
52  ;AVX2: cost of 1 {{.*}} icmp
53  %L = icmp eq <16 x i16> undef, undef
54  ;AVX1: cost of 4 {{.*}} icmp
55  ;AVX2: cost of 1 {{.*}} icmp
56  %M = icmp eq <32 x i8> undef, undef
57
58  ; AVX512: cost of 1 {{.*}} %M1 = icmp
59  %M1 = icmp eq <16 x i32> undef, undef
60  ; AVX512: cost of 2 {{.*}} %M2 = icmp
61  %M2 = icmp eq <16 x i64> undef, undef
62
63  ;CHECK: cost of 0 {{.*}} ret
64  ret i32 undef
65}
66
67
68