xref: /llvm-project/llvm/test/Analysis/CostModel/AArch64/arith-fp.ll (revision 38fffa630ee80163dc65e759392ad29798905679)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2; RUN: opt < %s -enable-no-nans-fp-math  -passes="print<cost-model>" 2>&1 -disable-output -mtriple=aarch64 -mattr=+fullfp16 | FileCheck %s
3
4target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
5
6define i32 @fadd(i32 %arg) {
7; CHECK-LABEL: 'fadd'
8; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = fadd half undef, undef
9; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fadd <4 x half> undef, undef
10; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fadd <8 x half> undef, undef
11; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16F16 = fadd <16 x half> undef, undef
12; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = fadd float undef, undef
13; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fadd <2 x float> undef, undef
14; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fadd <4 x float> undef, undef
15; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fadd <8 x float> undef, undef
16; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = fadd double undef, undef
17; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fadd <2 x double> undef, undef
18; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fadd <4 x double> undef, undef
19; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
20;
21  %F16 = fadd half undef, undef
22  %V4F16 = fadd <4 x half> undef, undef
23  %V8F16 = fadd <8 x half> undef, undef
24  %V16F16 = fadd <16 x half> undef, undef
25
26  %F32 = fadd float undef, undef
27  %V2F32 = fadd <2 x float> undef, undef
28  %V4F32 = fadd <4 x float> undef, undef
29  %V8F32 = fadd <8 x float> undef, undef
30
31  %F64 = fadd double undef, undef
32  %V2F64 = fadd <2 x double> undef, undef
33  %V4F64 = fadd <4 x double> undef, undef
34
35  ret i32 undef
36}
37
38define i32 @fsub(i32 %arg) {
39; CHECK-LABEL: 'fsub'
40; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = fsub half undef, undef
41; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> undef, undef
42; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> undef, undef
43; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16F16 = fsub <16 x half> undef, undef
44; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = fsub float undef, undef
45; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> undef, undef
46; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> undef, undef
47; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> undef, undef
48; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = fsub double undef, undef
49; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> undef, undef
50; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> undef, undef
51; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
52;
53  %F16 = fsub half undef, undef
54  %V4F16 = fsub <4 x half> undef, undef
55  %V8F16 = fsub <8 x half> undef, undef
56  %V16F16 = fsub <16 x half> undef, undef
57
58  %F32 = fsub float undef, undef
59  %V2F32 = fsub <2 x float> undef, undef
60  %V4F32 = fsub <4 x float> undef, undef
61  %V8F32 = fsub <8 x float> undef, undef
62
63  %F64 = fsub double undef, undef
64  %V2F64 = fsub <2 x double> undef, undef
65  %V4F64 = fsub <4 x double> undef, undef
66
67  ret i32 undef
68}
69
70define i32 @fneg_idiom(i32 %arg) {
71; CHECK-LABEL: 'fneg_idiom'
72; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = fsub half 0xH8000, undef
73; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fsub <4 x half> splat (half 0xH8000), undef
74; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fsub <8 x half> splat (half 0xH8000), undef
75; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = fsub float -0.000000e+00, undef
76; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fsub <2 x float> splat (float -0.000000e+00), undef
77; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fsub <4 x float> splat (float -0.000000e+00), undef
78; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fsub <8 x float> splat (float -0.000000e+00), undef
79; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = fsub double -0.000000e+00, undef
80; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fsub <2 x double> splat (double -0.000000e+00), undef
81; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fsub <4 x double> splat (double -0.000000e+00), undef
82; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
83;
84  %F16 = fsub half -0.0, undef
85  %V4F16 = fsub <4 x half> <half -0.0, half -0.0, half -0.0, half -0.0>, undef
86  %V8F16 = fsub <8 x half> <half -0.0, half -0.0, half -0.0, half -0.0, half -0.0, half -0.0, half -0.0, half -0.0>, undef
87
88  %F32 = fsub float -0.0, undef
89  %V2F32 = fsub <2 x float> <float -0.0, float -0.0>, undef
90  %V4F32 = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, undef
91  %V8F32 = fsub <8 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, undef
92
93  %F64 = fsub double -0.0, undef
94  %V2F64 = fsub <2 x double> <double -0.0, double -0.0>, undef
95  %V4F64 = fsub <4 x double> <double -0.0, double -0.0, double -0.0, double -0.0>, undef
96
97  ret i32 undef
98}
99
100define i32 @fneg(i32 %arg) {
101; CHECK-LABEL: 'fneg'
102; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = fneg half undef
103; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F16 = fneg <2 x half> undef
104; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fneg <4 x half> undef
105; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fneg <8 x half> undef
106; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16F16 = fneg <16 x half> undef
107; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = fneg float undef
108; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fneg <2 x float> undef
109; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fneg <4 x float> undef
110; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fneg <8 x float> undef
111; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = fneg double undef
112; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fneg <2 x double> undef
113; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fneg <4 x double> undef
114; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
115;
116  %F16 = fneg half undef
117  %V2F16 = fneg <2 x half> undef
118  %V4F16 = fneg <4 x half> undef
119  %V8F16 = fneg <8 x half> undef
120  %V16F16 = fneg <16 x half> undef
121
122  %F32 = fneg float undef
123  %V2F32 = fneg <2 x float> undef
124  %V4F32 = fneg <4 x float> undef
125  %V8F32 = fneg <8 x float> undef
126
127  %F64 = fneg double undef
128  %V2F64 = fneg <2 x double> undef
129  %V4F64 = fneg <4 x double> undef
130
131  ret i32 undef
132}
133
134define i32 @fmulfneg(i32 %arg) {
135; CHECK-LABEL: 'fmulfneg'
136; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %F16 = fneg half undef
137; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F16M = fmul half %F16, undef
138; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F16 = fneg <2 x half> undef
139; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F16M = fmul <2 x half> %V2F16, undef
140; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fneg <4 x half> undef
141; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F16M = fmul <4 x half> %V4F16, undef
142; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fneg <8 x half> undef
143; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F16M = fmul <8 x half> %V8F16, undef
144; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16F16 = fneg <16 x half> undef
145; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F16M = fmul <16 x half> %V16F16, undef
146; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %F32 = fneg float undef
147; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32M = fmul float %F32, undef
148; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fneg <2 x float> undef
149; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F32M = fmul <2 x float> %V2F32, undef
150; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fneg <4 x float> undef
151; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32M = fmul <4 x float> %V4F32, undef
152; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fneg <8 x float> undef
153; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32M = fmul <8 x float> %V8F32, undef
154; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %F64 = fneg double undef
155; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64M = fmul double %F64, undef
156; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fneg <2 x double> undef
157; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64M = fmul <2 x double> %V2F64, undef
158; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fneg <4 x double> undef
159; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64M = fmul <4 x double> %V4F64, undef
160; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
161;
162  %F16 = fneg half undef
163  %F16M = fmul half %F16, undef
164  %V2F16 = fneg <2 x half> undef
165  %V2F16M = fmul <2 x half> %V2F16, undef
166  %V4F16 = fneg <4 x half> undef
167  %V4F16M = fmul <4 x half> %V4F16, undef
168  %V8F16 = fneg <8 x half> undef
169  %V8F16M = fmul <8 x half> %V8F16, undef
170  %V16F16 = fneg <16 x half> undef
171  %V16F16M = fmul <16 x half> %V16F16, undef
172
173  %F32 = fneg float undef
174  %F32M = fmul float %F32, undef
175  %V2F32 = fneg <2 x float> undef
176  %V2F32M = fmul <2 x float> %V2F32, undef
177  %V4F32 = fneg <4 x float> undef
178  %V4F32M = fmul <4 x float> %V4F32, undef
179  %V8F32 = fneg <8 x float> undef
180  %V8F32M = fmul <8 x float> %V8F32, undef
181
182  %F64 = fneg double undef
183  %F64M = fmul double %F64, undef
184  %V2F64 = fneg <2 x double> undef
185  %V2F64M = fmul <2 x double> %V2F64, undef
186  %V4F64 = fneg <4 x double> undef
187  %V4F64M = fmul <4 x double> %V4F64, undef
188
189  ret i32 undef
190}
191
192define i32 @fnegfmul(i32 %arg) {
193; CHECK-LABEL: 'fnegfmul'
194; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F16M = fmul half undef, undef
195; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %F16 = fneg half %F16M
196; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F16M = fmul <2 x half> undef, undef
197; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F16 = fneg <2 x half> %V2F16M
198; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F16M = fmul <4 x half> undef, undef
199; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = fneg <4 x half> %V4F16M
200; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F16M = fmul <8 x half> undef, undef
201; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = fneg <8 x half> %V8F16M
202; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F16M = fmul <16 x half> undef, undef
203; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V16F16 = fneg <16 x half> %V16F16M
204; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32M = fmul float undef, undef
205; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %F32 = fneg float %F32M
206; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F32M = fmul <2 x float> undef, undef
207; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = fneg <2 x float> %V2F32M
208; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32M = fmul <4 x float> undef, undef
209; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = fneg <4 x float> %V4F32M
210; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32M = fmul <8 x float> undef, undef
211; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F32 = fneg <8 x float> %V8F32M
212; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64M = fmul double undef, undef
213; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %F64 = fneg double %F64M
214; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64M = fmul <2 x double> undef, undef
215; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = fneg <2 x double> %V2F64M
216; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64M = fmul <4 x double> undef, undef
217; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F64 = fneg <4 x double> %V4F64M
218; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
219;
220  %F16M = fmul half undef, undef
221  %F16 = fneg half %F16M
222  %V2F16M = fmul <2 x half> undef, undef
223  %V2F16 = fneg <2 x half> %V2F16M
224  %V4F16M = fmul <4 x half> undef, undef
225  %V4F16 = fneg <4 x half> %V4F16M
226  %V8F16M = fmul <8 x half> undef, undef
227  %V8F16 = fneg <8 x half> %V8F16M
228  %V16F16M = fmul <16 x half> undef, undef
229  %V16F16 = fneg <16 x half> %V16F16M
230
231  %F32M = fmul float undef, undef
232  %F32 = fneg float %F32M
233  %V2F32M = fmul <2 x float> undef, undef
234  %V2F32 = fneg <2 x float> %V2F32M
235  %V4F32M = fmul <4 x float> undef, undef
236  %V4F32 = fneg <4 x float> %V4F32M
237  %V8F32M = fmul <8 x float> undef, undef
238  %V8F32 = fneg <8 x float> %V8F32M
239
240  %F64M = fmul double undef, undef
241  %F64 = fneg double %F64M
242  %V2F64M = fmul <2 x double> undef, undef
243  %V2F64 = fneg <2 x double> %V2F64M
244  %V4F64M = fmul <4 x double> undef, undef
245  %V4F64 = fneg <4 x double> %V4F64M
246
247  ret i32 undef
248}
249
250define i32 @fmul(i32 %arg) {
251; CHECK-LABEL: 'fmul'
252; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F16 = fmul half undef, undef
253; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F16 = fmul <4 x half> undef, undef
254; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F16 = fmul <8 x half> undef, undef
255; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F16 = fmul <16 x half> undef, undef
256; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = fmul float undef, undef
257; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F32 = fmul <2 x float> undef, undef
258; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = fmul <4 x float> undef, undef
259; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32 = fmul <8 x float> undef, undef
260; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = fmul double undef, undef
261; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = fmul <2 x double> undef, undef
262; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = fmul <4 x double> undef, undef
263; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
264;
265  %F16 = fmul half undef, undef
266  %V4F16 = fmul <4 x half> undef, undef
267  %V8F16 = fmul <8 x half> undef, undef
268  %V16F16 = fmul <16 x half> undef, undef
269
270  %F32 = fmul float undef, undef
271  %V2F32 = fmul <2 x float> undef, undef
272  %V4F32 = fmul <4 x float> undef, undef
273  %V8F32 = fmul <8 x float> undef, undef
274
275  %F64 = fmul double undef, undef
276  %V2F64 = fmul <2 x double> undef, undef
277  %V4F64 = fmul <4 x double> undef, undef
278
279  ret i32 undef
280}
281
282define i32 @fdiv(i32 %arg) {
283; CHECK-LABEL: 'fdiv'
284; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F16 = fdiv half undef, undef
285; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F16 = fdiv <4 x half> undef, undef
286; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F16 = fdiv <8 x half> undef, undef
287; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F16 = fdiv <16 x half> undef, undef
288; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = fdiv float undef, undef
289; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F32 = fdiv <2 x float> undef, undef
290; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = fdiv <4 x float> undef, undef
291; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32 = fdiv <8 x float> undef, undef
292; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = fdiv double undef, undef
293; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = fdiv <2 x double> undef, undef
294; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = fdiv <4 x double> undef, undef
295; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
296;
297  %F16 = fdiv half undef, undef
298  %V4F16 = fdiv <4 x half> undef, undef
299  %V8F16 = fdiv <8 x half> undef, undef
300  %V16F16 = fdiv <16 x half> undef, undef
301
302  %F32 = fdiv float undef, undef
303  %V2F32 = fdiv <2 x float> undef, undef
304  %V4F32 = fdiv <4 x float> undef, undef
305  %V8F32 = fdiv <8 x float> undef, undef
306
307  %F64 = fdiv double undef, undef
308  %V2F64 = fdiv <2 x double> undef, undef
309  %V4F64 = fdiv <4 x double> undef, undef
310
311  ret i32 undef
312}
313
314define i32 @frem(i32 %arg) {
315; CHECK-LABEL: 'frem'
316; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %F16 = frem half undef, undef
317; CHECK-NEXT:  Cost Model: Found an estimated cost of 52 for instruction: %V4F16 = frem <4 x half> undef, undef
318; CHECK-NEXT:  Cost Model: Found an estimated cost of 108 for instruction: %V8F16 = frem <8 x half> undef, undef
319; CHECK-NEXT:  Cost Model: Found an estimated cost of 216 for instruction: %V16F16 = frem <16 x half> undef, undef
320; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %F32 = frem float undef, undef
321; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %V2F32 = frem <2 x float> undef, undef
322; CHECK-NEXT:  Cost Model: Found an estimated cost of 52 for instruction: %V4F32 = frem <4 x float> undef, undef
323; CHECK-NEXT:  Cost Model: Found an estimated cost of 104 for instruction: %V8F32 = frem <8 x float> undef, undef
324; CHECK-NEXT:  Cost Model: Found an estimated cost of 10 for instruction: %F64 = frem double undef, undef
325; CHECK-NEXT:  Cost Model: Found an estimated cost of 24 for instruction: %V2F64 = frem <2 x double> undef, undef
326; CHECK-NEXT:  Cost Model: Found an estimated cost of 48 for instruction: %V4F64 = frem <4 x double> undef, undef
327; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
328;
329  %F16 = frem half undef, undef
330  %V4F16 = frem <4 x half> undef, undef
331  %V8F16 = frem <8 x half> undef, undef
332  %V16F16 = frem <16 x half> undef, undef
333
334  %F32 = frem float undef, undef
335  %V2F32 = frem <2 x float> undef, undef
336  %V4F32 = frem <4 x float> undef, undef
337  %V8F32 = frem <8 x float> undef, undef
338
339  %F64 = frem double undef, undef
340  %V2F64 = frem <2 x double> undef, undef
341  %V4F64 = frem <4 x double> undef, undef
342
343  ret i32 undef
344}
345
346define i32 @fsqrt(i32 %arg) {
347; CHECK-LABEL: 'fsqrt'
348; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = call half @llvm.sqrt.f16(half undef)
349; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = call <4 x half> @llvm.sqrt.v4f16(<4 x half> undef)
350; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = call <8 x half> @llvm.sqrt.v8f16(<8 x half> undef)
351; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F16 = call <16 x half> @llvm.sqrt.v16f16(<16 x half> undef)
352; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = call float @llvm.sqrt.f32(float undef)
353; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = call <2 x float> @llvm.sqrt.v2f32(<2 x float> undef)
354; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = call <4 x float> @llvm.sqrt.v4f32(<4 x float> undef)
355; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32 = call <8 x float> @llvm.sqrt.v8f32(<8 x float> undef)
356; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = call double @llvm.sqrt.f64(double undef)
357; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> undef)
358; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = call <4 x double> @llvm.sqrt.v4f64(<4 x double> undef)
359; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
360;
361  %F16 = call half @llvm.sqrt.f16(half undef)
362  %V4F16 = call <4 x half> @llvm.sqrt.v4f16(<4 x half> undef)
363  %V8F16 = call <8 x half> @llvm.sqrt.v8f16(<8 x half> undef)
364  %V16F16 = call <16 x half> @llvm.sqrt.v16f16(<16 x half> undef)
365
366  %F32 = call float @llvm.sqrt.f32(float undef)
367  %V2F32 = call <2 x float> @llvm.sqrt.v2f32(<2 x float> undef)
368  %V4F32 = call <4 x float> @llvm.sqrt.v4f32(<4 x float> undef)
369  %V8F32 = call <8 x float> @llvm.sqrt.v8f32(<8 x float> undef)
370
371  %F64 = call double @llvm.sqrt.f64(double undef)
372  %V2F64 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> undef)
373  %V4F64 = call <4 x double> @llvm.sqrt.v4f64(<4 x double> undef)
374
375  ret i32 undef
376}
377
378define i32 @fabs(i32 %arg) {
379; CHECK-LABEL: 'fabs'
380; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = call half @llvm.fabs.f16(half undef)
381; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = call <4 x half> @llvm.fabs.v4f16(<4 x half> undef)
382; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = call <8 x half> @llvm.fabs.v8f16(<8 x half> undef)
383; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V2F16 = call <16 x half> @llvm.fabs.v16f16(<16 x half> undef)
384; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = call float @llvm.fabs.f32(float undef)
385; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = call <2 x float> @llvm.fabs.v2f32(<2 x float> undef)
386; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef)
387; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32 = call <8 x float> @llvm.fabs.v8f32(<8 x float> undef)
388; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = call double @llvm.fabs.f64(double undef)
389; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = call <2 x double> @llvm.fabs.v2f64(<2 x double> undef)
390; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = call <4 x double> @llvm.fabs.v4f64(<4 x double> undef)
391; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
392;
393  %F16 = call half @llvm.fabs.f16(half undef)
394  %V4F16 = call <4 x half> @llvm.fabs.v4f16(<4 x half> undef)
395  %V8F16 = call <8 x half> @llvm.fabs.v8f16(<8 x half> undef)
396  %V2F16 = call <16 x half> @llvm.fabs.v16f16(<16 x half> undef)
397
398  %F32 = call float @llvm.fabs.f32(float undef)
399  %V2F32 = call <2 x float> @llvm.fabs.v2f32(<2 x float> undef)
400  %V4F32 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef)
401  %V8F32 = call <8 x float> @llvm.fabs.v8f32(<8 x float> undef)
402
403  %F64 = call double @llvm.fabs.f64(double undef)
404  %V2F64 = call <2 x double> @llvm.fabs.v2f64(<2 x double> undef)
405  %V4F64 = call <4 x double> @llvm.fabs.v4f64(<4 x double> undef)
406
407  ret i32 undef
408}
409
410define i32 @fcopysign(i32 %arg) {
411; CHECK-LABEL: 'fcopysign'
412; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F16 = call half @llvm.copysign.f16(half undef, half undef)
413; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F16 = call <4 x half> @llvm.copysign.v4f16(<4 x half> undef, <4 x half> undef)
414; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V8F16 = call <8 x half> @llvm.copysign.v8f16(<8 x half> undef, <8 x half> undef)
415; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F16 = call <16 x half> @llvm.copysign.v16f16(<16 x half> undef, <16 x half> undef)
416; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F32 = call float @llvm.copysign.f32(float undef, float undef)
417; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F32 = call <2 x float> @llvm.copysign.v2f32(<2 x float> undef, <2 x float> undef)
418; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V4F32 = call <4 x float> @llvm.copysign.v4f32(<4 x float> undef, <4 x float> undef)
419; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32 = call <8 x float> @llvm.copysign.v8f32(<8 x float> undef, <8 x float> undef)
420; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %F64 = call double @llvm.copysign.f64(double undef, double undef)
421; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %V2F64 = call <2 x double> @llvm.copysign.v2f64(<2 x double> undef, <2 x double> undef)
422; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = call <4 x double> @llvm.copysign.v4f64(<4 x double> undef, <4 x double> undef)
423; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
424;
425  %F16 = call half @llvm.copysign.f16(half undef, half undef)
426  %V4F16 = call <4 x half> @llvm.copysign.v4f16(<4 x half> undef, <4 x half> undef)
427  %V8F16 = call <8 x half> @llvm.copysign.v8f16(<8 x half> undef, <8 x half> undef)
428  %V16F16 = call <16 x half> @llvm.copysign.v16f16(<16 x half> undef, <16 x half> undef)
429
430  %F32 = call float @llvm.copysign.f32(float undef, float undef)
431  %V2F32 = call <2 x float> @llvm.copysign.v2f32(<2 x float> undef, <2 x float> undef)
432  %V4F32 = call <4 x float> @llvm.copysign.v4f32(<4 x float> undef, <4 x float> undef)
433  %V8F32 = call <8 x float> @llvm.copysign.v8f32(<8 x float> undef, <8 x float> undef)
434
435  %F64 = call double @llvm.copysign.f64(double undef, double undef)
436  %V2F64 = call <2 x double> @llvm.copysign.v2f64(<2 x double> undef, <2 x double> undef)
437  %V4F64 = call <4 x double> @llvm.copysign.v4f64(<4 x double> undef, <4 x double> undef)
438
439  ret i32 undef
440}
441
442define i32 @fma(i32 %arg) {
443; CHECK-LABEL: 'fma'
444; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F16 = call float @llvm.fma.f32(float undef, float undef, float undef)
445; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F16 = call <4 x half> @llvm.fma.v4f16(<4 x half> undef, <4 x half> undef, <4 x half> undef)
446; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V8F16 = call <8 x half> @llvm.fma.v8f16(<8 x half> undef, <8 x half> undef, <8 x half> undef)
447; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V16F16 = call <16 x half> @llvm.fma.v16f16(<16 x half> undef, <16 x half> undef, <16 x half> undef)
448; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F32 = call float @llvm.fma.f32(float undef, float undef, float undef)
449; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F32 = call <2 x float> @llvm.fma.v2f32(<2 x float> undef, <2 x float> undef, <2 x float> undef)
450; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V4F32 = call <4 x float> @llvm.fma.v4f32(<4 x float> undef, <4 x float> undef, <4 x float> undef)
451; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V8F32 = call <8 x float> @llvm.fma.v8f32(<8 x float> undef, <8 x float> undef, <8 x float> undef)
452; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %F64 = call double @llvm.fma.f64(double undef, double undef, double undef)
453; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %V2F64 = call <2 x double> @llvm.fma.v2f64(<2 x double> undef, <2 x double> undef, <2 x double> undef)
454; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %V4F64 = call <4 x double> @llvm.fma.v4f64(<4 x double> undef, <4 x double> undef, <4 x double> undef)
455; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
456;
457  %F16 = call float @llvm.fma.f32(float undef, float undef, float undef)
458  %V4F16 = call <4 x half> @llvm.fma.v4f16(<4 x half> undef, <4 x half> undef, <4 x half> undef)
459  %V8F16 = call <8 x half> @llvm.fma.v8f16(<8 x half> undef, <8 x half> undef, <8 x half> undef)
460  %V16F16 = call <16 x half> @llvm.fma.v16f16(<16 x half> undef, <16 x half> undef, <16 x half> undef)
461
462  %F32 = call float @llvm.fma.f32(float undef, float undef, float undef)
463  %V2F32 = call <2 x float> @llvm.fma.v2f32(<2 x float> undef, <2 x float> undef, <2 x float> undef)
464  %V4F32 = call <4 x float> @llvm.fma.v4f32(<4 x float> undef, <4 x float> undef, <4 x float> undef)
465  %V8F32 = call <8 x float> @llvm.fma.v8f32(<8 x float> undef, <8 x float> undef, <8 x float> undef)
466
467  %F64 = call double @llvm.fma.f64(double undef, double undef, double undef)
468  %V2F64 = call <2 x double> @llvm.fma.v2f64(<2 x double> undef, <2 x double> undef, <2 x double> undef)
469  %V4F64 = call <4 x double> @llvm.fma.v4f64(<4 x double> undef, <4 x double> undef, <4 x double> undef)
470
471  ret i32 undef
472}
473
474declare half @llvm.sqrt.f16(half)
475declare <4 x half> @llvm.sqrt.v4f16(<4 x half>)
476declare <8 x half> @llvm.sqrt.v8f16(<8 x half>)
477declare <16 x half> @llvm.sqrt.v16f16(<16 x half>)
478
479declare float @llvm.sqrt.f32(float)
480declare <2 x float> @llvm.sqrt.v2f32(<2 x float>)
481declare <4 x float> @llvm.sqrt.v4f32(<4 x float>)
482declare <8 x float> @llvm.sqrt.v8f32(<8 x float>)
483
484declare double @llvm.sqrt.f64(double)
485declare <2 x double> @llvm.sqrt.v2f64(<2 x double>)
486declare <4 x double> @llvm.sqrt.v4f64(<4 x double>)
487
488declare half @llvm.fabs.f16(half)
489declare <4 x half> @llvm.fabs.v4f16(<4 x half>)
490declare <8 x half> @llvm.fabs.v8f16(<8 x half>)
491declare <16 x half> @llvm.fabs.v16f16(<16 x half>)
492
493declare float @llvm.fabs.f32(float)
494declare <2 x float> @llvm.fabs.v2f32(<2 x float>)
495declare <4 x float> @llvm.fabs.v4f32(<4 x float>)
496declare <8 x float> @llvm.fabs.v8f32(<8 x float>)
497
498declare double @llvm.fabs.f64(double)
499declare <2 x double> @llvm.fabs.v2f64(<2 x double>)
500declare <4 x double> @llvm.fabs.v4f64(<4 x double>)
501
502declare half @llvm.copysign.f16(half, half)
503declare <4 x half> @llvm.copysign.v4f16(<4 x half>, <4 x half>)
504declare <8 x half> @llvm.copysign.v8f16(<8 x half>, <8 x half>)
505declare <16 x half> @llvm.copysign.v16f16(<16 x half>, <16 x half>)
506
507declare float @llvm.copysign.f32(float, float)
508declare <2 x float> @llvm.copysign.v2f32(<2 x float>, <2 x float>)
509declare <4 x float> @llvm.copysign.v4f32(<4 x float>, <4 x float>)
510declare <8 x float> @llvm.copysign.v8f32(<8 x float>, <8 x float>)
511
512declare double @llvm.copysign.f64(double, double)
513declare <2 x double> @llvm.copysign.v2f64(<2 x double>, <2 x double>)
514declare <4 x double> @llvm.copysign.v4f64(<4 x double>, <4 x double>)
515
516declare half @llvm.fma.f16(half, half, half)
517declare <4 x half> @llvm.fma.v4f16(<4 x half>, <4 x half>, <4 x half>)
518declare <8 x half> @llvm.fma.v8f16(<8 x half>, <8 x half>, <8 x half>)
519declare <16 x half> @llvm.fma.v16f16(<16 x half>, <16 x half>, <16 x half>)
520
521declare float @llvm.fma.f32(float, float, float)
522declare <2 x float> @llvm.fma.v2f32(<2 x float>, <2 x float>, <2 x float>)
523declare <4 x float> @llvm.fma.v4f32(<4 x float>, <4 x float>, <4 x float>)
524declare <8 x float> @llvm.fma.v8f32(<8 x float>, <8 x float>, <8 x float>)
525
526declare double @llvm.fma.f64(double, double, double)
527declare <2 x double> @llvm.fma.v2f64(<2 x double>, <2 x double>, <2 x double>)
528declare <4 x double> @llvm.fma.v4f64(<4 x double>, <4 x double>, <4 x double>)
529