Skip to content

Commit 59d2e93

Browse files
committed
[LV] Add test with to check different interleave counts for fmaxnum.
This adds additional test coverage for folding FCMP uno (llvm/llvm-project#166823)
1 parent d99c840 commit 59d2e93

File tree

1 file changed

+211
-0
lines changed

1 file changed

+211
-0
lines changed
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none --filter-out-after "loop:" --version 6
2+
; RUN: opt -p loop-vectorize -force-vector-width=4 -force-vector-interleave=3 -S %s | FileCheck --check-prefix=IC3 %s
3+
; RUN: opt -p loop-vectorize -force-vector-width=4 -force-vector-interleave=4 -S %s | FileCheck --check-prefix=IC4 %s
4+
; RUN: opt -p loop-vectorize -force-vector-width=4 -force-vector-interleave=5 -S %s | FileCheck --check-prefix=IC5 %s
5+
6+
define float @fmaxnum(ptr %src, i64 %n) {
7+
; IC3-LABEL: define float @fmaxnum(
8+
; IC3-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
9+
; IC3-NEXT: [[ENTRY:.*]]:
10+
; IC3-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[N]], 12
11+
; IC3-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
12+
; IC3: [[VECTOR_PH]]:
13+
; IC3-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[N]], 12
14+
; IC3-NEXT: [[N_VEC:%.*]] = sub i64 [[N]], [[N_MOD_VF]]
15+
; IC3-NEXT: br label %[[VECTOR_BODY:.*]]
16+
; IC3: [[VECTOR_BODY]]:
17+
; IC3-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
18+
; IC3-NEXT: [[VEC_PHI:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP3:%.*]], %[[VECTOR_BODY]] ]
19+
; IC3-NEXT: [[VEC_PHI1:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP4:%.*]], %[[VECTOR_BODY]] ]
20+
; IC3-NEXT: [[VEC_PHI2:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP5:%.*]], %[[VECTOR_BODY]] ]
21+
; IC3-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[INDEX]]
22+
; IC3-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 4
23+
; IC3-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 8
24+
; IC3-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP0]], align 4
25+
; IC3-NEXT: [[WIDE_LOAD3:%.*]] = load <4 x float>, ptr [[TMP1]], align 4
26+
; IC3-NEXT: [[WIDE_LOAD4:%.*]] = load <4 x float>, ptr [[TMP2]], align 4
27+
; IC3-NEXT: [[TMP3]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI]], <4 x float> [[WIDE_LOAD]])
28+
; IC3-NEXT: [[TMP4]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI1]], <4 x float> [[WIDE_LOAD3]])
29+
; IC3-NEXT: [[TMP5]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI2]], <4 x float> [[WIDE_LOAD4]])
30+
; IC3-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 12
31+
; IC3-NEXT: [[TMP6:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD]], [[WIDE_LOAD]]
32+
; IC3-NEXT: [[TMP7:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD3]], [[WIDE_LOAD3]]
33+
; IC3-NEXT: [[TMP8:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD4]], [[WIDE_LOAD4]]
34+
; IC3-NEXT: [[TMP9:%.*]] = freeze <4 x i1> [[TMP6]]
35+
; IC3-NEXT: [[TMP10:%.*]] = freeze <4 x i1> [[TMP7]]
36+
; IC3-NEXT: [[TMP11:%.*]] = or <4 x i1> [[TMP9]], [[TMP10]]
37+
; IC3-NEXT: [[TMP12:%.*]] = freeze <4 x i1> [[TMP8]]
38+
; IC3-NEXT: [[TMP13:%.*]] = or <4 x i1> [[TMP11]], [[TMP12]]
39+
; IC3-NEXT: [[TMP14:%.*]] = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> [[TMP13]])
40+
; IC3-NEXT: [[TMP15:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
41+
; IC3-NEXT: [[TMP16:%.*]] = or i1 [[TMP14]], [[TMP15]]
42+
; IC3-NEXT: br i1 [[TMP16]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
43+
; IC3: [[MIDDLE_BLOCK]]:
44+
; IC3-NEXT: [[TMP17:%.*]] = select i1 [[TMP14]], <4 x float> [[VEC_PHI]], <4 x float> [[TMP3]]
45+
; IC3-NEXT: [[TMP18:%.*]] = select i1 [[TMP14]], <4 x float> [[VEC_PHI1]], <4 x float> [[TMP4]]
46+
; IC3-NEXT: [[TMP19:%.*]] = select i1 [[TMP14]], <4 x float> [[VEC_PHI2]], <4 x float> [[TMP5]]
47+
; IC3-NEXT: [[TMP20:%.*]] = select i1 [[TMP14]], i64 [[INDEX]], i64 [[N_VEC]]
48+
; IC3-NEXT: [[RDX_MINMAX:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP17]], <4 x float> [[TMP18]])
49+
; IC3-NEXT: [[RDX_MINMAX5:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[RDX_MINMAX]], <4 x float> [[TMP19]])
50+
; IC3-NEXT: [[TMP21:%.*]] = call float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[RDX_MINMAX5]])
51+
; IC3-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[N]], [[N_VEC]]
52+
; IC3-NEXT: [[TMP22:%.*]] = xor i1 [[TMP14]], true
53+
; IC3-NEXT: [[TMP23:%.*]] = and i1 [[CMP_N]], [[TMP22]]
54+
; IC3-NEXT: br i1 [[TMP23]], [[EXIT:label %.*]], label %[[SCALAR_PH]]
55+
; IC3: [[SCALAR_PH]]:
56+
; IC3-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[TMP20]], %[[MIDDLE_BLOCK]] ], [ 0, %[[ENTRY]] ]
57+
; IC3-NEXT: [[BC_MERGE_RDX:%.*]] = phi float [ [[TMP21]], %[[MIDDLE_BLOCK]] ], [ -1.000000e+07, %[[ENTRY]] ]
58+
; IC3-NEXT: br label %[[LOOP:.*]]
59+
; IC3: [[LOOP]]:
60+
;
61+
; IC4-LABEL: define float @fmaxnum(
62+
; IC4-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
63+
; IC4-NEXT: [[ENTRY:.*]]:
64+
; IC4-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[N]], 16
65+
; IC4-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
66+
; IC4: [[VECTOR_PH]]:
67+
; IC4-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[N]], 16
68+
; IC4-NEXT: [[N_VEC:%.*]] = sub i64 [[N]], [[N_MOD_VF]]
69+
; IC4-NEXT: br label %[[VECTOR_BODY:.*]]
70+
; IC4: [[VECTOR_BODY]]:
71+
; IC4-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
72+
; IC4-NEXT: [[VEC_PHI:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP4:%.*]], %[[VECTOR_BODY]] ]
73+
; IC4-NEXT: [[VEC_PHI1:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP5:%.*]], %[[VECTOR_BODY]] ]
74+
; IC4-NEXT: [[VEC_PHI2:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP6:%.*]], %[[VECTOR_BODY]] ]
75+
; IC4-NEXT: [[VEC_PHI3:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP7:%.*]], %[[VECTOR_BODY]] ]
76+
; IC4-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[INDEX]]
77+
; IC4-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 4
78+
; IC4-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 8
79+
; IC4-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 12
80+
; IC4-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP0]], align 4
81+
; IC4-NEXT: [[WIDE_LOAD4:%.*]] = load <4 x float>, ptr [[TMP1]], align 4
82+
; IC4-NEXT: [[WIDE_LOAD5:%.*]] = load <4 x float>, ptr [[TMP2]], align 4
83+
; IC4-NEXT: [[WIDE_LOAD6:%.*]] = load <4 x float>, ptr [[TMP3]], align 4
84+
; IC4-NEXT: [[TMP4]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI]], <4 x float> [[WIDE_LOAD]])
85+
; IC4-NEXT: [[TMP5]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI1]], <4 x float> [[WIDE_LOAD4]])
86+
; IC4-NEXT: [[TMP6]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI2]], <4 x float> [[WIDE_LOAD5]])
87+
; IC4-NEXT: [[TMP7]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI3]], <4 x float> [[WIDE_LOAD6]])
88+
; IC4-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16
89+
; IC4-NEXT: [[TMP8:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD]], [[WIDE_LOAD]]
90+
; IC4-NEXT: [[TMP9:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD4]], [[WIDE_LOAD4]]
91+
; IC4-NEXT: [[TMP24:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD5]], [[WIDE_LOAD5]]
92+
; IC4-NEXT: [[TMP25:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD6]], [[WIDE_LOAD6]]
93+
; IC4-NEXT: [[TMP10:%.*]] = freeze <4 x i1> [[TMP8]]
94+
; IC4-NEXT: [[TMP11:%.*]] = freeze <4 x i1> [[TMP9]]
95+
; IC4-NEXT: [[TMP12:%.*]] = or <4 x i1> [[TMP10]], [[TMP11]]
96+
; IC4-NEXT: [[TMP26:%.*]] = freeze <4 x i1> [[TMP24]]
97+
; IC4-NEXT: [[TMP27:%.*]] = or <4 x i1> [[TMP12]], [[TMP26]]
98+
; IC4-NEXT: [[TMP28:%.*]] = freeze <4 x i1> [[TMP25]]
99+
; IC4-NEXT: [[TMP29:%.*]] = or <4 x i1> [[TMP27]], [[TMP28]]
100+
; IC4-NEXT: [[TMP13:%.*]] = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> [[TMP29]])
101+
; IC4-NEXT: [[TMP14:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
102+
; IC4-NEXT: [[TMP15:%.*]] = or i1 [[TMP13]], [[TMP14]]
103+
; IC4-NEXT: br i1 [[TMP15]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
104+
; IC4: [[MIDDLE_BLOCK]]:
105+
; IC4-NEXT: [[TMP16:%.*]] = select i1 [[TMP13]], <4 x float> [[VEC_PHI]], <4 x float> [[TMP4]]
106+
; IC4-NEXT: [[TMP17:%.*]] = select i1 [[TMP13]], <4 x float> [[VEC_PHI1]], <4 x float> [[TMP5]]
107+
; IC4-NEXT: [[TMP18:%.*]] = select i1 [[TMP13]], <4 x float> [[VEC_PHI2]], <4 x float> [[TMP6]]
108+
; IC4-NEXT: [[TMP19:%.*]] = select i1 [[TMP13]], <4 x float> [[VEC_PHI3]], <4 x float> [[TMP7]]
109+
; IC4-NEXT: [[TMP20:%.*]] = select i1 [[TMP13]], i64 [[INDEX]], i64 [[N_VEC]]
110+
; IC4-NEXT: [[RDX_MINMAX:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP16]], <4 x float> [[TMP17]])
111+
; IC4-NEXT: [[RDX_MINMAX7:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[RDX_MINMAX]], <4 x float> [[TMP18]])
112+
; IC4-NEXT: [[RDX_MINMAX8:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[RDX_MINMAX7]], <4 x float> [[TMP19]])
113+
; IC4-NEXT: [[TMP21:%.*]] = call float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[RDX_MINMAX8]])
114+
; IC4-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[N]], [[N_VEC]]
115+
; IC4-NEXT: [[TMP22:%.*]] = xor i1 [[TMP13]], true
116+
; IC4-NEXT: [[TMP23:%.*]] = and i1 [[CMP_N]], [[TMP22]]
117+
; IC4-NEXT: br i1 [[TMP23]], [[EXIT:label %.*]], label %[[SCALAR_PH]]
118+
; IC4: [[SCALAR_PH]]:
119+
; IC4-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[TMP20]], %[[MIDDLE_BLOCK]] ], [ 0, %[[ENTRY]] ]
120+
; IC4-NEXT: [[BC_MERGE_RDX:%.*]] = phi float [ [[TMP21]], %[[MIDDLE_BLOCK]] ], [ -1.000000e+07, %[[ENTRY]] ]
121+
; IC4-NEXT: br label %[[LOOP:.*]]
122+
; IC4: [[LOOP]]:
123+
;
124+
; IC5-LABEL: define float @fmaxnum(
125+
; IC5-SAME: ptr [[SRC:%.*]], i64 [[N:%.*]]) {
126+
; IC5-NEXT: [[ENTRY:.*]]:
127+
; IC5-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[N]], 20
128+
; IC5-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
129+
; IC5: [[VECTOR_PH]]:
130+
; IC5-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[N]], 20
131+
; IC5-NEXT: [[N_VEC:%.*]] = sub i64 [[N]], [[N_MOD_VF]]
132+
; IC5-NEXT: br label %[[VECTOR_BODY:.*]]
133+
; IC5: [[VECTOR_BODY]]:
134+
; IC5-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
135+
; IC5-NEXT: [[VEC_PHI:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP5:%.*]], %[[VECTOR_BODY]] ]
136+
; IC5-NEXT: [[VEC_PHI1:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP6:%.*]], %[[VECTOR_BODY]] ]
137+
; IC5-NEXT: [[VEC_PHI2:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP7:%.*]], %[[VECTOR_BODY]] ]
138+
; IC5-NEXT: [[VEC_PHI3:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP8:%.*]], %[[VECTOR_BODY]] ]
139+
; IC5-NEXT: [[VEC_PHI4:%.*]] = phi <4 x float> [ splat (float -1.000000e+07), %[[VECTOR_PH]] ], [ [[TMP9:%.*]], %[[VECTOR_BODY]] ]
140+
; IC5-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw float, ptr [[SRC]], i64 [[INDEX]]
141+
; IC5-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 4
142+
; IC5-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 8
143+
; IC5-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 12
144+
; IC5-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw float, ptr [[TMP0]], i32 16
145+
; IC5-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP0]], align 4
146+
; IC5-NEXT: [[WIDE_LOAD5:%.*]] = load <4 x float>, ptr [[TMP1]], align 4
147+
; IC5-NEXT: [[WIDE_LOAD6:%.*]] = load <4 x float>, ptr [[TMP2]], align 4
148+
; IC5-NEXT: [[WIDE_LOAD7:%.*]] = load <4 x float>, ptr [[TMP3]], align 4
149+
; IC5-NEXT: [[WIDE_LOAD8:%.*]] = load <4 x float>, ptr [[TMP4]], align 4
150+
; IC5-NEXT: [[TMP5]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI]], <4 x float> [[WIDE_LOAD]])
151+
; IC5-NEXT: [[TMP6]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI1]], <4 x float> [[WIDE_LOAD5]])
152+
; IC5-NEXT: [[TMP7]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI2]], <4 x float> [[WIDE_LOAD6]])
153+
; IC5-NEXT: [[TMP8]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI3]], <4 x float> [[WIDE_LOAD7]])
154+
; IC5-NEXT: [[TMP9]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[VEC_PHI4]], <4 x float> [[WIDE_LOAD8]])
155+
; IC5-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 20
156+
; IC5-NEXT: [[TMP10:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD]], [[WIDE_LOAD]]
157+
; IC5-NEXT: [[TMP11:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD5]], [[WIDE_LOAD5]]
158+
; IC5-NEXT: [[TMP12:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD6]], [[WIDE_LOAD6]]
159+
; IC5-NEXT: [[TMP13:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD7]], [[WIDE_LOAD7]]
160+
; IC5-NEXT: [[TMP14:%.*]] = fcmp uno <4 x float> [[WIDE_LOAD8]], [[WIDE_LOAD8]]
161+
; IC5-NEXT: [[TMP15:%.*]] = freeze <4 x i1> [[TMP10]]
162+
; IC5-NEXT: [[TMP16:%.*]] = freeze <4 x i1> [[TMP11]]
163+
; IC5-NEXT: [[TMP17:%.*]] = or <4 x i1> [[TMP15]], [[TMP16]]
164+
; IC5-NEXT: [[TMP18:%.*]] = freeze <4 x i1> [[TMP12]]
165+
; IC5-NEXT: [[TMP19:%.*]] = or <4 x i1> [[TMP17]], [[TMP18]]
166+
; IC5-NEXT: [[TMP20:%.*]] = freeze <4 x i1> [[TMP13]]
167+
; IC5-NEXT: [[TMP21:%.*]] = or <4 x i1> [[TMP19]], [[TMP20]]
168+
; IC5-NEXT: [[TMP22:%.*]] = freeze <4 x i1> [[TMP14]]
169+
; IC5-NEXT: [[TMP23:%.*]] = or <4 x i1> [[TMP21]], [[TMP22]]
170+
; IC5-NEXT: [[TMP24:%.*]] = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> [[TMP23]])
171+
; IC5-NEXT: [[TMP25:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
172+
; IC5-NEXT: [[TMP26:%.*]] = or i1 [[TMP24]], [[TMP25]]
173+
; IC5-NEXT: br i1 [[TMP26]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
174+
; IC5: [[MIDDLE_BLOCK]]:
175+
; IC5-NEXT: [[TMP27:%.*]] = select i1 [[TMP24]], <4 x float> [[VEC_PHI]], <4 x float> [[TMP5]]
176+
; IC5-NEXT: [[TMP28:%.*]] = select i1 [[TMP24]], <4 x float> [[VEC_PHI1]], <4 x float> [[TMP6]]
177+
; IC5-NEXT: [[TMP29:%.*]] = select i1 [[TMP24]], <4 x float> [[VEC_PHI2]], <4 x float> [[TMP7]]
178+
; IC5-NEXT: [[TMP30:%.*]] = select i1 [[TMP24]], <4 x float> [[VEC_PHI3]], <4 x float> [[TMP8]]
179+
; IC5-NEXT: [[TMP31:%.*]] = select i1 [[TMP24]], <4 x float> [[VEC_PHI4]], <4 x float> [[TMP9]]
180+
; IC5-NEXT: [[TMP32:%.*]] = select i1 [[TMP24]], i64 [[INDEX]], i64 [[N_VEC]]
181+
; IC5-NEXT: [[RDX_MINMAX:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP27]], <4 x float> [[TMP28]])
182+
; IC5-NEXT: [[RDX_MINMAX9:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[RDX_MINMAX]], <4 x float> [[TMP29]])
183+
; IC5-NEXT: [[RDX_MINMAX10:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[RDX_MINMAX9]], <4 x float> [[TMP30]])
184+
; IC5-NEXT: [[RDX_MINMAX11:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[RDX_MINMAX10]], <4 x float> [[TMP31]])
185+
; IC5-NEXT: [[TMP33:%.*]] = call float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[RDX_MINMAX11]])
186+
; IC5-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[N]], [[N_VEC]]
187+
; IC5-NEXT: [[TMP34:%.*]] = xor i1 [[TMP24]], true
188+
; IC5-NEXT: [[TMP35:%.*]] = and i1 [[CMP_N]], [[TMP34]]
189+
; IC5-NEXT: br i1 [[TMP35]], [[EXIT:label %.*]], label %[[SCALAR_PH]]
190+
; IC5: [[SCALAR_PH]]:
191+
; IC5-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[TMP32]], %[[MIDDLE_BLOCK]] ], [ 0, %[[ENTRY]] ]
192+
; IC5-NEXT: [[BC_MERGE_RDX:%.*]] = phi float [ [[TMP33]], %[[MIDDLE_BLOCK]] ], [ -1.000000e+07, %[[ENTRY]] ]
193+
; IC5-NEXT: br label %[[LOOP:.*]]
194+
; IC5: [[LOOP]]:
195+
;
196+
entry:
197+
br label %loop
198+
199+
loop:
200+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
201+
%max = phi float [ -1.000000e+07, %entry ], [ %max.next, %loop ]
202+
%gep.src = getelementptr inbounds nuw float, ptr %src, i64 %iv
203+
%l = load float, ptr %gep.src, align 4
204+
%max.next = call float @llvm.maxnum.f32(float %max, float %l)
205+
%iv.next = add nuw nsw i64 %iv, 1
206+
%ec = icmp eq i64 %iv.next, %n
207+
br i1 %ec, label %exit, label %loop
208+
209+
exit:
210+
ret float %max.next
211+
}

0 commit comments

Comments
 (0)