• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s  -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift | FileCheck %s
2target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
3target triple = "thumbv7-apple-ios6.0.0"
4
5; CHECK: casts
6define void @casts() {
7    ; Scalar values
8  ; CHECK: cost of 1 {{.*}} select
9  %v1 = select i1 undef, i8 undef, i8 undef
10  ; CHECK: cost of 1 {{.*}} select
11  %v2 = select i1 undef, i16 undef, i16 undef
12  ; CHECK: cost of 1 {{.*}} select
13  %v3 = select i1 undef, i32 undef, i32 undef
14  ; CHECK: cost of 2 {{.*}} select
15  %v4 = select i1 undef, i64 undef, i64 undef
16  ; CHECK: cost of 1 {{.*}} select
17  %v5 = select i1 undef, float undef, float undef
18  ; CHECK: cost of 1 {{.*}} select
19  %v6 = select i1 undef, double undef, double undef
20
21    ; Vector values
22  ; CHECK: cost of 1 {{.*}} select
23  %v7 = select <2 x i1> undef, <2 x i8> undef, <2 x i8> undef
24  ; CHECK: cost of 1 {{.*}} select
25  %v8 = select <4 x i1>  undef, <4 x i8> undef, <4 x i8> undef
26  ; CHECK: cost of 1 {{.*}} select
27  %v9 = select <8 x i1>  undef, <8 x i8> undef, <8 x i8> undef
28  ; CHECK: cost of 1 {{.*}} select
29  %v10 = select <16 x i1>  undef, <16 x i8> undef, <16 x i8> undef
30
31  ; CHECK: cost of 1 {{.*}} select
32  %v11 = select <2 x i1> undef, <2 x i16> undef, <2 x i16> undef
33  ; CHECK: cost of 1 {{.*}} select
34  %v12 = select <4 x i1>  undef, <4 x i16> undef, <4 x i16> undef
35  ; CHECK: cost of 1 {{.*}} select
36  %v13 = select <8 x i1>  undef, <8 x i16> undef, <8 x i16> undef
37  ; CHECK: cost of 2 {{.*}} select
38  %v13b = select <16 x i1>  undef, <16 x i16> undef, <16 x i16> undef
39
40  ; CHECK: cost of 1 {{.*}} select
41  %v14 = select <2 x i1> undef, <2 x i32> undef, <2 x i32> undef
42  ; CHECK: cost of 1 {{.*}} select
43  %v15 = select <4 x i1>  undef, <4 x i32> undef, <4 x i32> undef
44  ; CHECK: cost of 2 {{.*}} select
45  %v15b = select <8 x i1>  undef, <8 x i32> undef, <8 x i32> undef
46  ; CHECK: cost of 4 {{.*}} select
47  %v15c = select <16 x i1>  undef, <16 x i32> undef, <16 x i32> undef
48
49  ; CHECK: cost of 1 {{.*}} select
50  %v16 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
51  ; CHECK: cost of 19 {{.*}} select
52  %v16a = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
53  ; CHECK: cost of 50 {{.*}} select
54  %v16b = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
55  ; CHECK: cost of 100 {{.*}} select
56  %v16c = select <16 x i1> undef, <16 x i64> undef, <16 x i64> undef
57
58  ; CHECK: cost of 1 {{.*}} select
59  %v17 = select <2 x i1> undef, <2 x float> undef, <2 x float> undef
60  ; CHECK: cost of 1 {{.*}} select
61  %v18 = select <4 x i1>  undef, <4 x float> undef, <4 x float> undef
62
63  ; CHECK: cost of 1 {{.*}} select
64  %v19 = select <2 x i1>  undef, <2 x double> undef, <2 x double> undef
65
66  ; odd vectors get legalized and should have similar costs
67  ; CHECK: cost of 1 {{.*}} select
68  %v20 = select <1 x i1>  undef, <1 x i32> undef, <1 x i32> undef
69  ; CHECK: cost of 1 {{.*}} select
70  %v21 = select <3 x i1>  undef, <3 x float> undef, <3 x float> undef
71  ; CHECK: cost of 4 {{.*}} select
72  %v22 = select <5 x i1>  undef, <5 x double> undef, <5 x double> undef
73
74  ret void
75}
76