aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Analysis/CostModel/ARM/cmps.ll
blob: 6b19be542a381b95a2c7758bd27f3e40a9a5295c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mtriple=thumbv8.1m.main-none-eabi -mattr=+mve.fp < %s | FileCheck %s --check-prefix=CHECK-MVE
; RUN: opt -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mtriple=thumbv8m.main-none-eabi < %s | FileCheck %s --check-prefix=CHECK-V8M-MAIN
; RUN: opt -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mtriple=thumbv8m.base-none-eabi < %s | FileCheck %s --check-prefix=CHECK-V8M-BASE
; RUN: opt -passes="print<cost-model>" -cost-kind=all 2>&1 -disable-output -mtriple=armv8r-none-eabi -mattr=+neon,+fp-armv8 < %s | FileCheck %s --check-prefix=CHECK-V8R

target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"

define i32 @cmps() {
; CHECK-MVE-LABEL: 'cmps'
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %a = icmp slt i8 undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %b = icmp ult i16 undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %c = icmp sge i32 undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %d = icmp ne i64 undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %e = icmp slt <16 x i8> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %f = icmp ult <8 x i16> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %g = icmp sge <4 x i32> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %a7 = fcmp oge half undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %a8 = fcmp ogt float undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %a9 = fcmp ogt double undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %a10 = fcmp olt <8 x half> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %a11 = fcmp oge <4 x float> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:4 Lat:8 SizeLat:8 for: %a12 = fcmp oge <2 x double> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %p = icmp eq ptr undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %q = icmp eq <4 x ptr> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
;
; CHECK-V8M-MAIN-LABEL: 'cmps'
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %a = icmp slt i8 undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %b = icmp ult i16 undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %c = icmp sge i32 undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %d = icmp ne i64 undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 32 for: %e = icmp slt <16 x i8> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 16 for: %f = icmp ult <8 x i16> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 8 for: %g = icmp sge <4 x i32> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %a7 = fcmp oge half undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %a8 = fcmp ogt float undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %a9 = fcmp ogt double undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 16 for: %a10 = fcmp olt <8 x half> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 8 for: %a11 = fcmp oge <4 x float> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 6 for: %a12 = fcmp oge <2 x double> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %p = icmp eq ptr undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 8 for: %q = icmp eq <4 x ptr> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: ret i32 undef
;
; CHECK-V8M-BASE-LABEL: 'cmps'
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %a = icmp slt i8 undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %b = icmp ult i16 undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %c = icmp sge i32 undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %d = icmp ne i64 undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 32 for: %e = icmp slt <16 x i8> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 16 for: %f = icmp ult <8 x i16> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 8 for: %g = icmp sge <4 x i32> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %a7 = fcmp oge half undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %a8 = fcmp ogt float undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %a9 = fcmp ogt double undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 16 for: %a10 = fcmp olt <8 x half> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 8 for: %a11 = fcmp oge <4 x float> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 6 for: %a12 = fcmp oge <2 x double> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %p = icmp eq ptr undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 8 for: %q = icmp eq <4 x ptr> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: ret i32 undef
;
; CHECK-V8R-LABEL: 'cmps'
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %a = icmp slt i8 undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %b = icmp ult i16 undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %c = icmp sge i32 undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %d = icmp ne i64 undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %e = icmp slt <16 x i8> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %f = icmp ult <8 x i16> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %g = icmp sge <4 x i32> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %a7 = fcmp oge half undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %a8 = fcmp ogt float undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %a9 = fcmp ogt double undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 24 for: %a10 = fcmp olt <8 x half> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %a11 = fcmp oge <4 x float> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 4 for: %a12 = fcmp oge <2 x double> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %p = icmp eq ptr undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %q = icmp eq <4 x ptr> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret i32 undef
;
  %a = icmp slt i8 undef, undef
  %b = icmp ult i16 undef, undef
  %c = icmp sge i32 undef, undef
  %d = icmp ne i64 undef, undef
  %e = icmp slt <16 x i8> undef, undef
  %f = icmp ult <8 x i16> undef, undef
  %g = icmp sge <4 x i32> undef, undef
  %a7 = fcmp oge half undef, undef
  %a8 = fcmp ogt float undef, undef
  %a9 = fcmp ogt double undef, undef
  %a10 = fcmp olt <8 x half> undef, undef
  %a11 = fcmp oge <4 x float> undef, undef
  %a12 = fcmp oge <2 x double> undef, undef
  %p = icmp eq ptr undef, undef
  %q = icmp eq <4 x ptr> undef, undef
  ret i32 undef
}

define void @minmax() {
; CHECK-MVE-LABEL: 'minmax'
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %c1 = icmp slt i8 undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s1 = select i1 %c1, i8 undef, i8 undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %c2 = icmp slt i16 undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s2 = select i1 %c2, i16 undef, i16 undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %c3 = icmp slt i32 undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s3 = select i1 %c3, i32 undef, i32 undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 0 for: %c4 = icmp slt <4 x i32> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of 1 for: %c5 = icmp slt ptr undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s5 = select i1 %c5, ptr undef, ptr undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %c6 = icmp slt <4 x ptr> undef, undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:2 CodeSize:1 Lat:2 SizeLat:2 for: %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef
; CHECK-MVE-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
;
; CHECK-V8M-MAIN-LABEL: 'minmax'
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %c1 = icmp slt i8 undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s1 = select i1 %c1, i8 undef, i8 undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %c2 = icmp slt i16 undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s2 = select i1 %c2, i16 undef, i16 undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %c3 = icmp slt i32 undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s3 = select i1 %c3, i32 undef, i32 undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 0 for: %c4 = icmp slt <4 x i32> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of RThru:16 CodeSize:20 Lat:16 SizeLat:16 for: %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: %c5 = icmp slt ptr undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s5 = select i1 %c5, ptr undef, ptr undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 8 for: %c6 = icmp slt <4 x ptr> undef, undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:12 Lat:8 SizeLat:8 for: %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef
; CHECK-V8M-MAIN-NEXT:  Cost Model: Found costs of 1 for: ret void
;
; CHECK-V8M-BASE-LABEL: 'minmax'
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %c1 = icmp slt i8 undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s1 = select i1 %c1, i8 undef, i8 undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %c2 = icmp slt i16 undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s2 = select i1 %c2, i16 undef, i16 undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %c3 = icmp slt i32 undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s3 = select i1 %c3, i32 undef, i32 undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 0 for: %c4 = icmp slt <4 x i32> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of RThru:16 CodeSize:20 Lat:16 SizeLat:16 for: %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: %c5 = icmp slt ptr undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of RThru:1 CodeSize:2 Lat:1 SizeLat:1 for: %s5 = select i1 %c5, ptr undef, ptr undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 8 for: %c6 = icmp slt <4 x ptr> undef, undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of RThru:8 CodeSize:12 Lat:8 SizeLat:8 for: %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef
; CHECK-V8M-BASE-NEXT:  Cost Model: Found costs of 1 for: ret void
;
; CHECK-V8R-LABEL: 'minmax'
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %c1 = icmp slt i8 undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %s1 = select i1 %c1, i8 undef, i8 undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %c2 = icmp slt i16 undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %s2 = select i1 %c2, i16 undef, i16 undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %c3 = icmp slt i32 undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %s3 = select i1 %c3, i32 undef, i32 undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 0 for: %c4 = icmp slt <4 x i32> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %c5 = icmp slt ptr undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %s5 = select i1 %c5, ptr undef, ptr undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %c6 = icmp slt <4 x ptr> undef, undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of 1 for: %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef
; CHECK-V8R-NEXT:  Cost Model: Found costs of RThru:0 CodeSize:1 Lat:1 SizeLat:1 for: ret void
;
  %c1 = icmp slt i8 undef, undef
  %s1 = select i1 %c1, i8 undef, i8 undef
  %c2 = icmp slt i16 undef, undef
  %s2 = select i1 %c2, i16 undef, i16 undef
  %c3 = icmp slt i32 undef, undef
  %s3 = select i1 %c3, i32 undef, i32 undef
  %c4 = icmp slt <4 x i32> undef, undef
  %s4 = select <4 x i1> %c4, <4 x i32> undef, <4 x i32> undef
  %c5 = icmp slt ptr undef, undef
  %s5 = select i1 %c5, ptr undef, ptr undef
  %c6 = icmp slt <4 x ptr> undef, undef
  %s6 = select <4 x i1> %c6, <4 x ptr> undef, <4 x ptr> undef
  ret void
}