File: reductions-fmin-fmax.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (411 lines) | stat: -rw-r--r-- 25,236 bytes parent folder | download | duplicates (2)
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -mtriple=s390x-unknown-linux -mcpu=z15 -passes=slp-vectorizer %s -S -o - \
; RUN:   | FileCheck %s

; Test vectorization and reassociation of fmin/fmax operations. Vectorization
; is more profitable if the loads are also vectorizable.

define double @fmin_double_4_nums_seq(ptr nocapture noundef readonly %x) {
; CHECK-LABEL: define double @fmin_double_4_nums_seq(
; CHECK-SAME: ptr nocapture noundef readonly [[X:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x double>, ptr [[X]], align 4
; CHECK-NEXT:    [[TMP2:%.*]] = call fast double @llvm.vector.reduce.fmin.v4f64(<4 x double> [[TMP1]])
; CHECK-NEXT:    ret double [[TMP2]]
;
  %g1 = getelementptr inbounds double, ptr %x, i64 1
  %g2 = getelementptr inbounds double, ptr %x, i64 2
  %g3 = getelementptr inbounds double, ptr %x, i64 3
  %t0 = load double, ptr %x, align 4
  %t1 = load double, ptr %g1, align 4
  %t2 = load double, ptr %g2, align 4
  %t3 = load double, ptr %g3, align 4
  %m1 = tail call fast double @llvm.minnum.f64(double %t1, double %t0)
  %m2 = tail call fast double @llvm.minnum.f64(double %t2, double %m1)
  %m3 = tail call fast double @llvm.minnum.f64(double %t3, double %m2)
  ret double %m3
}

define double @fmin_double_16_nums_nonseq(ptr nocapture noundef readonly %x) {
; CHECK-LABEL: define double @fmin_double_16_nums_nonseq(
; CHECK-SAME: ptr nocapture noundef readonly [[X:%.*]]) #[[ATTR0]] {
; CHECK-NEXT:    [[G1:%.*]] = getelementptr inbounds double, ptr [[X]], i64 2
; CHECK-NEXT:    [[G2:%.*]] = getelementptr inbounds double, ptr [[X]], i64 4
; CHECK-NEXT:    [[G3:%.*]] = getelementptr inbounds double, ptr [[X]], i64 6
; CHECK-NEXT:    [[G4:%.*]] = getelementptr inbounds double, ptr [[X]], i64 8
; CHECK-NEXT:    [[G5:%.*]] = getelementptr inbounds double, ptr [[X]], i64 10
; CHECK-NEXT:    [[G6:%.*]] = getelementptr inbounds double, ptr [[X]], i64 12
; CHECK-NEXT:    [[G7:%.*]] = getelementptr inbounds double, ptr [[X]], i64 14
; CHECK-NEXT:    [[G8:%.*]] = getelementptr inbounds double, ptr [[X]], i64 16
; CHECK-NEXT:    [[G9:%.*]] = getelementptr inbounds double, ptr [[X]], i64 18
; CHECK-NEXT:    [[G10:%.*]] = getelementptr inbounds double, ptr [[X]], i64 20
; CHECK-NEXT:    [[G11:%.*]] = getelementptr inbounds double, ptr [[X]], i64 22
; CHECK-NEXT:    [[G12:%.*]] = getelementptr inbounds double, ptr [[X]], i64 24
; CHECK-NEXT:    [[G13:%.*]] = getelementptr inbounds double, ptr [[X]], i64 26
; CHECK-NEXT:    [[G14:%.*]] = getelementptr inbounds double, ptr [[X]], i64 28
; CHECK-NEXT:    [[G15:%.*]] = getelementptr inbounds double, ptr [[X]], i64 30
; CHECK-NEXT:    [[T0:%.*]] = load double, ptr [[X]], align 4
; CHECK-NEXT:    [[T1:%.*]] = load double, ptr [[G1]], align 4
; CHECK-NEXT:    [[T2:%.*]] = load double, ptr [[G2]], align 4
; CHECK-NEXT:    [[T3:%.*]] = load double, ptr [[G3]], align 4
; CHECK-NEXT:    [[T4:%.*]] = load double, ptr [[G4]], align 4
; CHECK-NEXT:    [[T5:%.*]] = load double, ptr [[G5]], align 4
; CHECK-NEXT:    [[T6:%.*]] = load double, ptr [[G6]], align 4
; CHECK-NEXT:    [[T7:%.*]] = load double, ptr [[G7]], align 4
; CHECK-NEXT:    [[T8:%.*]] = load double, ptr [[G8]], align 4
; CHECK-NEXT:    [[T9:%.*]] = load double, ptr [[G9]], align 4
; CHECK-NEXT:    [[T10:%.*]] = load double, ptr [[G10]], align 4
; CHECK-NEXT:    [[T11:%.*]] = load double, ptr [[G11]], align 4
; CHECK-NEXT:    [[T12:%.*]] = load double, ptr [[G12]], align 4
; CHECK-NEXT:    [[T13:%.*]] = load double, ptr [[G13]], align 4
; CHECK-NEXT:    [[T14:%.*]] = load double, ptr [[G14]], align 4
; CHECK-NEXT:    [[T15:%.*]] = load double, ptr [[G15]], align 4
; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <16 x double> poison, double [[T1]], i32 0
; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <16 x double> [[TMP1]], double [[T0]], i32 1
; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <16 x double> [[TMP2]], double [[T2]], i32 2
; CHECK-NEXT:    [[TMP4:%.*]] = insertelement <16 x double> [[TMP3]], double [[T3]], i32 3
; CHECK-NEXT:    [[TMP5:%.*]] = insertelement <16 x double> [[TMP4]], double [[T4]], i32 4
; CHECK-NEXT:    [[TMP6:%.*]] = insertelement <16 x double> [[TMP5]], double [[T5]], i32 5
; CHECK-NEXT:    [[TMP7:%.*]] = insertelement <16 x double> [[TMP6]], double [[T6]], i32 6
; CHECK-NEXT:    [[TMP8:%.*]] = insertelement <16 x double> [[TMP7]], double [[T7]], i32 7
; CHECK-NEXT:    [[TMP9:%.*]] = insertelement <16 x double> [[TMP8]], double [[T8]], i32 8
; CHECK-NEXT:    [[TMP10:%.*]] = insertelement <16 x double> [[TMP9]], double [[T9]], i32 9
; CHECK-NEXT:    [[TMP11:%.*]] = insertelement <16 x double> [[TMP10]], double [[T10]], i32 10
; CHECK-NEXT:    [[TMP12:%.*]] = insertelement <16 x double> [[TMP11]], double [[T11]], i32 11
; CHECK-NEXT:    [[TMP13:%.*]] = insertelement <16 x double> [[TMP12]], double [[T12]], i32 12
; CHECK-NEXT:    [[TMP14:%.*]] = insertelement <16 x double> [[TMP13]], double [[T13]], i32 13
; CHECK-NEXT:    [[TMP15:%.*]] = insertelement <16 x double> [[TMP14]], double [[T14]], i32 14
; CHECK-NEXT:    [[TMP16:%.*]] = insertelement <16 x double> [[TMP15]], double [[T15]], i32 15
; CHECK-NEXT:    [[TMP17:%.*]] = call fast double @llvm.vector.reduce.fmin.v16f64(<16 x double> [[TMP16]])
; CHECK-NEXT:    ret double [[TMP17]]
;
  %g1 = getelementptr inbounds double, ptr %x, i64 2
  %g2 = getelementptr inbounds double, ptr %x, i64 4
  %g3 = getelementptr inbounds double, ptr %x, i64 6
  %g4 = getelementptr inbounds double, ptr %x, i64 8
  %g5 = getelementptr inbounds double, ptr %x, i64 10
  %g6 = getelementptr inbounds double, ptr %x, i64 12
  %g7 = getelementptr inbounds double, ptr %x, i64 14
  %g8 = getelementptr inbounds double, ptr %x, i64 16
  %g9 = getelementptr inbounds double, ptr %x, i64 18
  %g10 = getelementptr inbounds double, ptr %x, i64 20
  %g11 = getelementptr inbounds double, ptr %x, i64 22
  %g12 = getelementptr inbounds double, ptr %x, i64 24
  %g13 = getelementptr inbounds double, ptr %x, i64 26
  %g14 = getelementptr inbounds double, ptr %x, i64 28
  %g15 = getelementptr inbounds double, ptr %x, i64 30
  %t0 = load double, ptr %x, align 4
  %t1 = load double, ptr %g1, align 4
  %t2 = load double, ptr %g2, align 4
  %t3 = load double, ptr %g3, align 4
  %t4 = load double, ptr %g4, align 4
  %t5 = load double, ptr %g5, align 4
  %t6 = load double, ptr %g6, align 4
  %t7 = load double, ptr %g7, align 4
  %t8 = load double, ptr %g8, align 4
  %t9 = load double, ptr %g9, align 4
  %t10 = load double, ptr %g10, align 4
  %t11 = load double, ptr %g11, align 4
  %t12 = load double, ptr %g12, align 4
  %t13 = load double, ptr %g13, align 4
  %t14 = load double, ptr %g14, align 4
  %t15 = load double, ptr %g15, align 4
  %m1 = tail call fast double @llvm.minnum.f64(double %t1, double %t0)
  %m2 = tail call fast double @llvm.minnum.f64(double %t2, double %m1)
  %m3 = tail call fast double @llvm.minnum.f64(double %t3, double %m2)
  %m4 = tail call fast double @llvm.minnum.f64(double %t4, double %m3)
  %m5 = tail call fast double @llvm.minnum.f64(double %t5, double %m4)
  %m6 = tail call fast double @llvm.minnum.f64(double %t6, double %m5)
  %m7 = tail call fast double @llvm.minnum.f64(double %t7, double %m6)
  %m8 = tail call fast double @llvm.minnum.f64(double %t8, double %m7)
  %m9 = tail call fast double @llvm.minnum.f64(double %t9, double %m8)
  %m10 = tail call fast double @llvm.minnum.f64(double %t10, double %m9)
  %m11 = tail call fast double @llvm.minnum.f64(double %t11, double %m10)
  %m12 = tail call fast double @llvm.minnum.f64(double %t12, double %m11)
  %m13 = tail call fast double @llvm.minnum.f64(double %t13, double %m12)
  %m14 = tail call fast double @llvm.minnum.f64(double %t14, double %m13)
  %m15 = tail call fast double @llvm.minnum.f64(double %t15, double %m14)
  ret double %m15
}

define float @fmin_float_12_nums_nonseq(ptr nocapture noundef readonly %x) {
; CHECK-LABEL: define float @fmin_float_12_nums_nonseq(
; CHECK-SAME: ptr nocapture noundef readonly [[X:%.*]]) #[[ATTR0]] {
; CHECK-NEXT:    [[G1:%.*]] = getelementptr inbounds float, ptr [[X]], i64 2
; CHECK-NEXT:    [[G2:%.*]] = getelementptr inbounds float, ptr [[X]], i64 4
; CHECK-NEXT:    [[G3:%.*]] = getelementptr inbounds float, ptr [[X]], i64 6
; CHECK-NEXT:    [[G4:%.*]] = getelementptr inbounds float, ptr [[X]], i64 8
; CHECK-NEXT:    [[G5:%.*]] = getelementptr inbounds float, ptr [[X]], i64 10
; CHECK-NEXT:    [[G6:%.*]] = getelementptr inbounds float, ptr [[X]], i64 12
; CHECK-NEXT:    [[G7:%.*]] = getelementptr inbounds float, ptr [[X]], i64 14
; CHECK-NEXT:    [[G8:%.*]] = getelementptr inbounds float, ptr [[X]], i64 16
; CHECK-NEXT:    [[G9:%.*]] = getelementptr inbounds float, ptr [[X]], i64 18
; CHECK-NEXT:    [[G10:%.*]] = getelementptr inbounds float, ptr [[X]], i64 20
; CHECK-NEXT:    [[G11:%.*]] = getelementptr inbounds float, ptr [[X]], i64 22
; CHECK-NEXT:    [[T0:%.*]] = load float, ptr [[X]], align 4
; CHECK-NEXT:    [[T1:%.*]] = load float, ptr [[G1]], align 4
; CHECK-NEXT:    [[T2:%.*]] = load float, ptr [[G2]], align 4
; CHECK-NEXT:    [[T3:%.*]] = load float, ptr [[G3]], align 4
; CHECK-NEXT:    [[T4:%.*]] = load float, ptr [[G4]], align 4
; CHECK-NEXT:    [[T5:%.*]] = load float, ptr [[G5]], align 4
; CHECK-NEXT:    [[T6:%.*]] = load float, ptr [[G6]], align 4
; CHECK-NEXT:    [[T7:%.*]] = load float, ptr [[G7]], align 4
; CHECK-NEXT:    [[T8:%.*]] = load float, ptr [[G8]], align 4
; CHECK-NEXT:    [[T9:%.*]] = load float, ptr [[G9]], align 4
; CHECK-NEXT:    [[T10:%.*]] = load float, ptr [[G10]], align 4
; CHECK-NEXT:    [[T11:%.*]] = load float, ptr [[G11]], align 4
; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <12 x float> poison, float [[T1]], i32 0
; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <12 x float> [[TMP1]], float [[T0]], i32 1
; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <12 x float> [[TMP2]], float [[T2]], i32 2
; CHECK-NEXT:    [[TMP4:%.*]] = insertelement <12 x float> [[TMP3]], float [[T3]], i32 3
; CHECK-NEXT:    [[TMP5:%.*]] = insertelement <12 x float> [[TMP4]], float [[T4]], i32 4
; CHECK-NEXT:    [[TMP6:%.*]] = insertelement <12 x float> [[TMP5]], float [[T5]], i32 5
; CHECK-NEXT:    [[TMP7:%.*]] = insertelement <12 x float> [[TMP6]], float [[T6]], i32 6
; CHECK-NEXT:    [[TMP8:%.*]] = insertelement <12 x float> [[TMP7]], float [[T7]], i32 7
; CHECK-NEXT:    [[TMP9:%.*]] = insertelement <12 x float> [[TMP8]], float [[T8]], i32 8
; CHECK-NEXT:    [[TMP10:%.*]] = insertelement <12 x float> [[TMP9]], float [[T9]], i32 9
; CHECK-NEXT:    [[TMP11:%.*]] = insertelement <12 x float> [[TMP10]], float [[T10]], i32 10
; CHECK-NEXT:    [[TMP12:%.*]] = insertelement <12 x float> [[TMP11]], float [[T11]], i32 11
; CHECK-NEXT:    [[TMP13:%.*]] = call fast float @llvm.vector.reduce.fmin.v12f32(<12 x float> [[TMP12]])
; CHECK-NEXT:    ret float [[TMP13]]
;
  %g1 = getelementptr inbounds float, ptr %x, i64 2
  %g2 = getelementptr inbounds float, ptr %x, i64 4
  %g3 = getelementptr inbounds float, ptr %x, i64 6
  %g4 = getelementptr inbounds float, ptr %x, i64 8
  %g5 = getelementptr inbounds float, ptr %x, i64 10
  %g6 = getelementptr inbounds float, ptr %x, i64 12
  %g7 = getelementptr inbounds float, ptr %x, i64 14
  %g8 = getelementptr inbounds float, ptr %x, i64 16
  %g9 = getelementptr inbounds float, ptr %x, i64 18
  %g10 = getelementptr inbounds float, ptr %x, i64 20
  %g11 = getelementptr inbounds float, ptr %x, i64 22
  %t0 = load float, ptr %x, align 4
  %t1 = load float, ptr %g1, align 4
  %t2 = load float, ptr %g2, align 4
  %t3 = load float, ptr %g3, align 4
  %t4 = load float, ptr %g4, align 4
  %t5 = load float, ptr %g5, align 4
  %t6 = load float, ptr %g6, align 4
  %t7 = load float, ptr %g7, align 4
  %t8 = load float, ptr %g8, align 4
  %t9 = load float, ptr %g9, align 4
  %t10 = load float, ptr %g10, align 4
  %t11 = load float, ptr %g11, align 4
  %m1 = tail call fast float @llvm.minnum.f32(float %t1, float %t0)
  %m2 = tail call fast float @llvm.minnum.f32(float %t2, float %m1)
  %m3 = tail call fast float @llvm.minnum.f32(float %t3, float %m2)
  %m4 = tail call fast float @llvm.minnum.f32(float %t4, float %m3)
  %m5 = tail call fast float @llvm.minnum.f32(float %t5, float %m4)
  %m6 = tail call fast float @llvm.minnum.f32(float %t6, float %m5)
  %m7 = tail call fast float @llvm.minnum.f32(float %t7, float %m6)
  %m8 = tail call fast float @llvm.minnum.f32(float %t8, float %m7)
  %m9 = tail call fast float @llvm.minnum.f32(float %t9, float %m8)
  %m10 = tail call fast float @llvm.minnum.f32(float %t10, float %m9)
  %m11 = tail call fast float @llvm.minnum.f32(float %t11, float %m10)
  ret float %m11
}

define double @fmax_double_4_nums_seq(ptr nocapture noundef readonly %x) {
; CHECK-LABEL: define double @fmax_double_4_nums_seq(
; CHECK-SAME: ptr nocapture noundef readonly [[X:%.*]]) #[[ATTR0]] {
; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x double>, ptr [[X]], align 4
; CHECK-NEXT:    [[TMP2:%.*]] = call fast double @llvm.vector.reduce.fmax.v4f64(<4 x double> [[TMP1]])
; CHECK-NEXT:    ret double [[TMP2]]
;
  %g1 = getelementptr inbounds double, ptr %x, i64 1
  %g2 = getelementptr inbounds double, ptr %x, i64 2
  %g3 = getelementptr inbounds double, ptr %x, i64 3
  %t0 = load double, ptr %x, align 4
  %t1 = load double, ptr %g1, align 4
  %t2 = load double, ptr %g2, align 4
  %t3 = load double, ptr %g3, align 4
  %m1 = tail call fast double @llvm.maxnum.f64(double %t1, double %t0)
  %m2 = tail call fast double @llvm.maxnum.f64(double %t2, double %m1)
  %m3 = tail call fast double @llvm.maxnum.f64(double %t3, double %m2)
  ret double %m3
}

define double @fmax_double_16_nums_nonseq(ptr nocapture noundef readonly %x) {
; CHECK-LABEL: define double @fmax_double_16_nums_nonseq(
; CHECK-SAME: ptr nocapture noundef readonly [[X:%.*]]) #[[ATTR0]] {
; CHECK-NEXT:    [[G1:%.*]] = getelementptr inbounds double, ptr [[X]], i64 2
; CHECK-NEXT:    [[G2:%.*]] = getelementptr inbounds double, ptr [[X]], i64 4
; CHECK-NEXT:    [[G3:%.*]] = getelementptr inbounds double, ptr [[X]], i64 6
; CHECK-NEXT:    [[G4:%.*]] = getelementptr inbounds double, ptr [[X]], i64 8
; CHECK-NEXT:    [[G5:%.*]] = getelementptr inbounds double, ptr [[X]], i64 10
; CHECK-NEXT:    [[G6:%.*]] = getelementptr inbounds double, ptr [[X]], i64 12
; CHECK-NEXT:    [[G7:%.*]] = getelementptr inbounds double, ptr [[X]], i64 14
; CHECK-NEXT:    [[G8:%.*]] = getelementptr inbounds double, ptr [[X]], i64 16
; CHECK-NEXT:    [[G9:%.*]] = getelementptr inbounds double, ptr [[X]], i64 18
; CHECK-NEXT:    [[G10:%.*]] = getelementptr inbounds double, ptr [[X]], i64 20
; CHECK-NEXT:    [[G11:%.*]] = getelementptr inbounds double, ptr [[X]], i64 22
; CHECK-NEXT:    [[G12:%.*]] = getelementptr inbounds double, ptr [[X]], i64 24
; CHECK-NEXT:    [[G13:%.*]] = getelementptr inbounds double, ptr [[X]], i64 26
; CHECK-NEXT:    [[G14:%.*]] = getelementptr inbounds double, ptr [[X]], i64 28
; CHECK-NEXT:    [[G15:%.*]] = getelementptr inbounds double, ptr [[X]], i64 30
; CHECK-NEXT:    [[T0:%.*]] = load double, ptr [[X]], align 4
; CHECK-NEXT:    [[T1:%.*]] = load double, ptr [[G1]], align 4
; CHECK-NEXT:    [[T2:%.*]] = load double, ptr [[G2]], align 4
; CHECK-NEXT:    [[T3:%.*]] = load double, ptr [[G3]], align 4
; CHECK-NEXT:    [[T4:%.*]] = load double, ptr [[G4]], align 4
; CHECK-NEXT:    [[T5:%.*]] = load double, ptr [[G5]], align 4
; CHECK-NEXT:    [[T6:%.*]] = load double, ptr [[G6]], align 4
; CHECK-NEXT:    [[T7:%.*]] = load double, ptr [[G7]], align 4
; CHECK-NEXT:    [[T8:%.*]] = load double, ptr [[G8]], align 4
; CHECK-NEXT:    [[T9:%.*]] = load double, ptr [[G9]], align 4
; CHECK-NEXT:    [[T10:%.*]] = load double, ptr [[G10]], align 4
; CHECK-NEXT:    [[T11:%.*]] = load double, ptr [[G11]], align 4
; CHECK-NEXT:    [[T12:%.*]] = load double, ptr [[G12]], align 4
; CHECK-NEXT:    [[T13:%.*]] = load double, ptr [[G13]], align 4
; CHECK-NEXT:    [[T14:%.*]] = load double, ptr [[G14]], align 4
; CHECK-NEXT:    [[T15:%.*]] = load double, ptr [[G15]], align 4
; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <16 x double> poison, double [[T1]], i32 0
; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <16 x double> [[TMP1]], double [[T0]], i32 1
; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <16 x double> [[TMP2]], double [[T2]], i32 2
; CHECK-NEXT:    [[TMP4:%.*]] = insertelement <16 x double> [[TMP3]], double [[T3]], i32 3
; CHECK-NEXT:    [[TMP5:%.*]] = insertelement <16 x double> [[TMP4]], double [[T4]], i32 4
; CHECK-NEXT:    [[TMP6:%.*]] = insertelement <16 x double> [[TMP5]], double [[T5]], i32 5
; CHECK-NEXT:    [[TMP7:%.*]] = insertelement <16 x double> [[TMP6]], double [[T6]], i32 6
; CHECK-NEXT:    [[TMP8:%.*]] = insertelement <16 x double> [[TMP7]], double [[T7]], i32 7
; CHECK-NEXT:    [[TMP9:%.*]] = insertelement <16 x double> [[TMP8]], double [[T8]], i32 8
; CHECK-NEXT:    [[TMP10:%.*]] = insertelement <16 x double> [[TMP9]], double [[T9]], i32 9
; CHECK-NEXT:    [[TMP11:%.*]] = insertelement <16 x double> [[TMP10]], double [[T10]], i32 10
; CHECK-NEXT:    [[TMP12:%.*]] = insertelement <16 x double> [[TMP11]], double [[T11]], i32 11
; CHECK-NEXT:    [[TMP13:%.*]] = insertelement <16 x double> [[TMP12]], double [[T12]], i32 12
; CHECK-NEXT:    [[TMP14:%.*]] = insertelement <16 x double> [[TMP13]], double [[T13]], i32 13
; CHECK-NEXT:    [[TMP15:%.*]] = insertelement <16 x double> [[TMP14]], double [[T14]], i32 14
; CHECK-NEXT:    [[TMP16:%.*]] = insertelement <16 x double> [[TMP15]], double [[T15]], i32 15
; CHECK-NEXT:    [[TMP17:%.*]] = call fast double @llvm.vector.reduce.fmax.v16f64(<16 x double> [[TMP16]])
; CHECK-NEXT:    ret double [[TMP17]]
;
  %g1 = getelementptr inbounds double, ptr %x, i64 2
  %g2 = getelementptr inbounds double, ptr %x, i64 4
  %g3 = getelementptr inbounds double, ptr %x, i64 6
  %g4 = getelementptr inbounds double, ptr %x, i64 8
  %g5 = getelementptr inbounds double, ptr %x, i64 10
  %g6 = getelementptr inbounds double, ptr %x, i64 12
  %g7 = getelementptr inbounds double, ptr %x, i64 14
  %g8 = getelementptr inbounds double, ptr %x, i64 16
  %g9 = getelementptr inbounds double, ptr %x, i64 18
  %g10 = getelementptr inbounds double, ptr %x, i64 20
  %g11 = getelementptr inbounds double, ptr %x, i64 22
  %g12 = getelementptr inbounds double, ptr %x, i64 24
  %g13 = getelementptr inbounds double, ptr %x, i64 26
  %g14 = getelementptr inbounds double, ptr %x, i64 28
  %g15 = getelementptr inbounds double, ptr %x, i64 30
  %t0 = load double, ptr %x, align 4
  %t1 = load double, ptr %g1, align 4
  %t2 = load double, ptr %g2, align 4
  %t3 = load double, ptr %g3, align 4
  %t4 = load double, ptr %g4, align 4
  %t5 = load double, ptr %g5, align 4
  %t6 = load double, ptr %g6, align 4
  %t7 = load double, ptr %g7, align 4
  %t8 = load double, ptr %g8, align 4
  %t9 = load double, ptr %g9, align 4
  %t10 = load double, ptr %g10, align 4
  %t11 = load double, ptr %g11, align 4
  %t12 = load double, ptr %g12, align 4
  %t13 = load double, ptr %g13, align 4
  %t14 = load double, ptr %g14, align 4
  %t15 = load double, ptr %g15, align 4
  %m1 = tail call fast double @llvm.maxnum.f64(double %t1, double %t0)
  %m2 = tail call fast double @llvm.maxnum.f64(double %t2, double %m1)
  %m3 = tail call fast double @llvm.maxnum.f64(double %t3, double %m2)
  %m4 = tail call fast double @llvm.maxnum.f64(double %t4, double %m3)
  %m5 = tail call fast double @llvm.maxnum.f64(double %t5, double %m4)
  %m6 = tail call fast double @llvm.maxnum.f64(double %t6, double %m5)
  %m7 = tail call fast double @llvm.maxnum.f64(double %t7, double %m6)
  %m8 = tail call fast double @llvm.maxnum.f64(double %t8, double %m7)
  %m9 = tail call fast double @llvm.maxnum.f64(double %t9, double %m8)
  %m10 = tail call fast double @llvm.maxnum.f64(double %t10, double %m9)
  %m11 = tail call fast double @llvm.maxnum.f64(double %t11, double %m10)
  %m12 = tail call fast double @llvm.maxnum.f64(double %t12, double %m11)
  %m13 = tail call fast double @llvm.maxnum.f64(double %t13, double %m12)
  %m14 = tail call fast double @llvm.maxnum.f64(double %t14, double %m13)
  %m15 = tail call fast double @llvm.maxnum.f64(double %t15, double %m14)
  ret double %m15
}

define float @fmax_float_12_nums_nonseq(ptr nocapture noundef readonly %x) {
; CHECK-LABEL: define float @fmax_float_12_nums_nonseq(
; CHECK-SAME: ptr nocapture noundef readonly [[X:%.*]]) #[[ATTR0]] {
; CHECK-NEXT:    [[G1:%.*]] = getelementptr inbounds float, ptr [[X]], i64 2
; CHECK-NEXT:    [[G2:%.*]] = getelementptr inbounds float, ptr [[X]], i64 4
; CHECK-NEXT:    [[G3:%.*]] = getelementptr inbounds float, ptr [[X]], i64 6
; CHECK-NEXT:    [[G4:%.*]] = getelementptr inbounds float, ptr [[X]], i64 8
; CHECK-NEXT:    [[G5:%.*]] = getelementptr inbounds float, ptr [[X]], i64 10
; CHECK-NEXT:    [[G6:%.*]] = getelementptr inbounds float, ptr [[X]], i64 12
; CHECK-NEXT:    [[G7:%.*]] = getelementptr inbounds float, ptr [[X]], i64 14
; CHECK-NEXT:    [[G8:%.*]] = getelementptr inbounds float, ptr [[X]], i64 16
; CHECK-NEXT:    [[G9:%.*]] = getelementptr inbounds float, ptr [[X]], i64 18
; CHECK-NEXT:    [[G10:%.*]] = getelementptr inbounds float, ptr [[X]], i64 20
; CHECK-NEXT:    [[G11:%.*]] = getelementptr inbounds float, ptr [[X]], i64 22
; CHECK-NEXT:    [[T0:%.*]] = load float, ptr [[X]], align 4
; CHECK-NEXT:    [[T1:%.*]] = load float, ptr [[G1]], align 4
; CHECK-NEXT:    [[T2:%.*]] = load float, ptr [[G2]], align 4
; CHECK-NEXT:    [[T3:%.*]] = load float, ptr [[G3]], align 4
; CHECK-NEXT:    [[T4:%.*]] = load float, ptr [[G4]], align 4
; CHECK-NEXT:    [[T5:%.*]] = load float, ptr [[G5]], align 4
; CHECK-NEXT:    [[T6:%.*]] = load float, ptr [[G6]], align 4
; CHECK-NEXT:    [[T7:%.*]] = load float, ptr [[G7]], align 4
; CHECK-NEXT:    [[T8:%.*]] = load float, ptr [[G8]], align 4
; CHECK-NEXT:    [[T9:%.*]] = load float, ptr [[G9]], align 4
; CHECK-NEXT:    [[T10:%.*]] = load float, ptr [[G10]], align 4
; CHECK-NEXT:    [[T11:%.*]] = load float, ptr [[G11]], align 4
; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <12 x float> poison, float [[T1]], i32 0
; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <12 x float> [[TMP1]], float [[T0]], i32 1
; CHECK-NEXT:    [[TMP3:%.*]] = insertelement <12 x float> [[TMP2]], float [[T2]], i32 2
; CHECK-NEXT:    [[TMP4:%.*]] = insertelement <12 x float> [[TMP3]], float [[T3]], i32 3
; CHECK-NEXT:    [[TMP5:%.*]] = insertelement <12 x float> [[TMP4]], float [[T4]], i32 4
; CHECK-NEXT:    [[TMP6:%.*]] = insertelement <12 x float> [[TMP5]], float [[T5]], i32 5
; CHECK-NEXT:    [[TMP7:%.*]] = insertelement <12 x float> [[TMP6]], float [[T6]], i32 6
; CHECK-NEXT:    [[TMP8:%.*]] = insertelement <12 x float> [[TMP7]], float [[T7]], i32 7
; CHECK-NEXT:    [[TMP9:%.*]] = insertelement <12 x float> [[TMP8]], float [[T8]], i32 8
; CHECK-NEXT:    [[TMP10:%.*]] = insertelement <12 x float> [[TMP9]], float [[T9]], i32 9
; CHECK-NEXT:    [[TMP11:%.*]] = insertelement <12 x float> [[TMP10]], float [[T10]], i32 10
; CHECK-NEXT:    [[TMP12:%.*]] = insertelement <12 x float> [[TMP11]], float [[T11]], i32 11
; CHECK-NEXT:    [[TMP13:%.*]] = call fast float @llvm.vector.reduce.fmax.v12f32(<12 x float> [[TMP12]])
; CHECK-NEXT:    ret float [[TMP13]]
;
  %g1 = getelementptr inbounds float, ptr %x, i64 2
  %g2 = getelementptr inbounds float, ptr %x, i64 4
  %g3 = getelementptr inbounds float, ptr %x, i64 6
  %g4 = getelementptr inbounds float, ptr %x, i64 8
  %g5 = getelementptr inbounds float, ptr %x, i64 10
  %g6 = getelementptr inbounds float, ptr %x, i64 12
  %g7 = getelementptr inbounds float, ptr %x, i64 14
  %g8 = getelementptr inbounds float, ptr %x, i64 16
  %g9 = getelementptr inbounds float, ptr %x, i64 18
  %g10 = getelementptr inbounds float, ptr %x, i64 20
  %g11 = getelementptr inbounds float, ptr %x, i64 22
  %t0 = load float, ptr %x, align 4
  %t1 = load float, ptr %g1, align 4
  %t2 = load float, ptr %g2, align 4
  %t3 = load float, ptr %g3, align 4
  %t4 = load float, ptr %g4, align 4
  %t5 = load float, ptr %g5, align 4
  %t6 = load float, ptr %g6, align 4
  %t7 = load float, ptr %g7, align 4
  %t8 = load float, ptr %g8, align 4
  %t9 = load float, ptr %g9, align 4
  %t10 = load float, ptr %g10, align 4
  %t11 = load float, ptr %g11, align 4
  %m1 = tail call fast float @llvm.maxnum.f32(float %t1, float %t0)
  %m2 = tail call fast float @llvm.maxnum.f32(float %t2, float %m1)
  %m3 = tail call fast float @llvm.maxnum.f32(float %t3, float %m2)
  %m4 = tail call fast float @llvm.maxnum.f32(float %t4, float %m3)
  %m5 = tail call fast float @llvm.maxnum.f32(float %t5, float %m4)
  %m6 = tail call fast float @llvm.maxnum.f32(float %t6, float %m5)
  %m7 = tail call fast float @llvm.maxnum.f32(float %t7, float %m6)
  %m8 = tail call fast float @llvm.maxnum.f32(float %t8, float %m7)
  %m9 = tail call fast float @llvm.maxnum.f32(float %t9, float %m8)
  %m10 = tail call fast float @llvm.maxnum.f32(float %t10, float %m9)
  %m11 = tail call fast float @llvm.maxnum.f32(float %t11, float %m10)
  ret float %m11
}

declare float @llvm.minnum.f32(float, float)
declare double @llvm.minnum.f64(double, double)
declare float @llvm.maxnum.f32(float, float)
declare double @llvm.maxnum.f64(double, double)