xref: /llvm-project/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll (revision 38fffa630ee80163dc65e759392ad29798905679)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
2; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-simplifylib,instcombine -amdgpu-prelink %s | FileCheck %s
3
4target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9"
5
6declare float @_Z5rootnfi(float, i32)
7declare <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float>, <2 x i32>)
8declare <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float>, <3 x i32>)
9declare <4 x float> @_Z5rootnDv4_fDv4_i(<4 x float>, <4 x i32>)
10declare <8 x float> @_Z5rootnDv8_fDv8_i(<8 x float>, <8 x i32>)
11declare <16 x float> @_Z5rootnDv16_fDv16_i(<16 x float>, <16 x i32>)
12declare double @_Z5rootndi(double, i32)
13declare <2 x double> @_Z5rootnDv2_dDv2_i(<2 x double>, <2 x i32>)
14declare <3 x double> @_Z5rootnDv3_dDv3_i(<3 x double>, <3 x i32>)
15declare <4 x double> @_Z5rootnDv4_dDv4_i(<4 x double>, <4 x i32>)
16declare <8 x double> @_Z5rootnDv8_dDv8_i(<8 x double>, <8 x i32>)
17declare <16 x double> @_Z5rootnDv16_dDv16_i(<16 x double>, <16 x i32>)
18declare half @_Z5rootnDhi(half, i32)
19declare <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half>, <2 x i32>)
20declare <3 x half> @_Z5rootnDv3_DhDv3_i(<3 x half>, <3 x i32>)
21declare <4 x half> @_Z5rootnDv4_DhDv4_i(<4 x half>, <4 x i32>)
22declare <8 x half> @_Z5rootnDv8_DhDv8_i(<8 x half>, <8 x i32>)
23declare <16 x half> @_Z5rootnDv16_DhDv16_i(<16 x half>, <16 x i32>)
24
25define float @test_rootn_f32(float %x, i32 %y) {
26; CHECK-LABEL: define float @test_rootn_f32(
27; CHECK-SAME: float [[X:%.*]], i32 [[Y:%.*]]) {
28; CHECK-NEXT:  entry:
29; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 [[Y]])
30; CHECK-NEXT:    ret float [[CALL]]
31;
32entry:
33  %call = tail call float @_Z5rootnfi(float %x, i32 %y)
34  ret float %call
35}
36
37define float @test_rootn_f32_flags(float %x, i32 %y) {
38; CHECK-LABEL: define float @test_rootn_f32_flags(
39; CHECK-SAME: float [[X:%.*]], i32 [[Y:%.*]]) {
40; CHECK-NEXT:  entry:
41; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan nsz float @_Z5rootnfi(float [[X]], i32 [[Y]])
42; CHECK-NEXT:    ret float [[CALL]]
43;
44entry:
45  %call = tail call nnan nsz float @_Z5rootnfi(float %x, i32 %y)
46  ret float %call
47}
48
49define <2 x float> @test_rootn_v2f32(<2 x float> %x, <2 x i32> %y) {
50; CHECK-LABEL: define <2 x float> @test_rootn_v2f32(
51; CHECK-SAME: <2 x float> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
52; CHECK-NEXT:  entry:
53; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> [[Y]])
54; CHECK-NEXT:    ret <2 x float> [[CALL]]
55;
56entry:
57  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> %y)
58  ret <2 x float> %call
59}
60
61define <3 x float> @test_rootn_v3f32(<3 x float> %x, <3 x i32> %y) {
62; CHECK-LABEL: define <3 x float> @test_rootn_v3f32(
63; CHECK-SAME: <3 x float> [[X:%.*]], <3 x i32> [[Y:%.*]]) {
64; CHECK-NEXT:  entry:
65; CHECK-NEXT:    [[CALL:%.*]] = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> [[X]], <3 x i32> [[Y]])
66; CHECK-NEXT:    ret <3 x float> [[CALL]]
67;
68entry:
69  %call = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> %x, <3 x i32> %y)
70  ret <3 x float> %call
71}
72
73define <4 x float> @test_rootn_v4f32(<4 x float> %x, <4 x i32> %y) {
74; CHECK-LABEL: define <4 x float> @test_rootn_v4f32(
75; CHECK-SAME: <4 x float> [[X:%.*]], <4 x i32> [[Y:%.*]]) {
76; CHECK-NEXT:  entry:
77; CHECK-NEXT:    [[CALL:%.*]] = tail call <4 x float> @_Z5rootnDv4_fDv4_i(<4 x float> [[X]], <4 x i32> [[Y]])
78; CHECK-NEXT:    ret <4 x float> [[CALL]]
79;
80entry:
81  %call = tail call <4 x float> @_Z5rootnDv4_fDv4_i(<4 x float> %x, <4 x i32> %y)
82  ret <4 x float> %call
83}
84
85define <8 x float> @test_rootn_v8f32(<8 x float> %x, <8 x i32> %y) {
86; CHECK-LABEL: define <8 x float> @test_rootn_v8f32(
87; CHECK-SAME: <8 x float> [[X:%.*]], <8 x i32> [[Y:%.*]]) {
88; CHECK-NEXT:  entry:
89; CHECK-NEXT:    [[CALL:%.*]] = tail call <8 x float> @_Z5rootnDv8_fDv8_i(<8 x float> [[X]], <8 x i32> [[Y]])
90; CHECK-NEXT:    ret <8 x float> [[CALL]]
91;
92entry:
93  %call = tail call <8 x float> @_Z5rootnDv8_fDv8_i(<8 x float> %x, <8 x i32> %y)
94  ret <8 x float> %call
95}
96
97define <16 x float> @test_rootn_v16f32(<16 x float> %x, <16 x i32> %y) {
98; CHECK-LABEL: define <16 x float> @test_rootn_v16f32(
99; CHECK-SAME: <16 x float> [[X:%.*]], <16 x i32> [[Y:%.*]]) {
100; CHECK-NEXT:  entry:
101; CHECK-NEXT:    [[CALL:%.*]] = tail call <16 x float> @_Z5rootnDv16_fDv16_i(<16 x float> [[X]], <16 x i32> [[Y]])
102; CHECK-NEXT:    ret <16 x float> [[CALL]]
103;
104entry:
105  %call = tail call <16 x float> @_Z5rootnDv16_fDv16_i(<16 x float> %x, <16 x i32> %y)
106  ret <16 x float> %call
107}
108
109define double @test_rootn_f64(double %x, i32 %y) {
110; CHECK-LABEL: define double @test_rootn_f64(
111; CHECK-SAME: double [[X:%.*]], i32 [[Y:%.*]]) {
112; CHECK-NEXT:  entry:
113; CHECK-NEXT:    [[CALL:%.*]] = tail call double @_Z5rootndi(double [[X]], i32 [[Y]])
114; CHECK-NEXT:    ret double [[CALL]]
115;
116entry:
117  %call = tail call double @_Z5rootndi(double %x, i32 %y)
118  ret double %call
119}
120
121define <2 x double> @test_rootn_v2f64(<2 x double> %x, <2 x i32> %y) {
122; CHECK-LABEL: define <2 x double> @test_rootn_v2f64(
123; CHECK-SAME: <2 x double> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
124; CHECK-NEXT:  entry:
125; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x double> @_Z5rootnDv2_dDv2_i(<2 x double> [[X]], <2 x i32> [[Y]])
126; CHECK-NEXT:    ret <2 x double> [[CALL]]
127;
128entry:
129  %call = tail call <2 x double> @_Z5rootnDv2_dDv2_i(<2 x double> %x, <2 x i32> %y)
130  ret <2 x double> %call
131}
132
133define <3 x double> @test_rootn_v3f64(<3 x double> %x, <3 x i32> %y) {
134; CHECK-LABEL: define <3 x double> @test_rootn_v3f64(
135; CHECK-SAME: <3 x double> [[X:%.*]], <3 x i32> [[Y:%.*]]) {
136; CHECK-NEXT:  entry:
137; CHECK-NEXT:    [[CALL:%.*]] = tail call <3 x double> @_Z5rootnDv3_dDv3_i(<3 x double> [[X]], <3 x i32> [[Y]])
138; CHECK-NEXT:    ret <3 x double> [[CALL]]
139;
140entry:
141  %call = tail call <3 x double> @_Z5rootnDv3_dDv3_i(<3 x double> %x, <3 x i32> %y)
142  ret <3 x double> %call
143}
144
145define <4 x double> @test_rootn_v4f64(<4 x double> %x, <4 x i32> %y) {
146; CHECK-LABEL: define <4 x double> @test_rootn_v4f64(
147; CHECK-SAME: <4 x double> [[X:%.*]], <4 x i32> [[Y:%.*]]) {
148; CHECK-NEXT:  entry:
149; CHECK-NEXT:    [[CALL:%.*]] = tail call <4 x double> @_Z5rootnDv4_dDv4_i(<4 x double> [[X]], <4 x i32> [[Y]])
150; CHECK-NEXT:    ret <4 x double> [[CALL]]
151;
152entry:
153  %call = tail call <4 x double> @_Z5rootnDv4_dDv4_i(<4 x double> %x, <4 x i32> %y)
154  ret <4 x double> %call
155}
156
157define <8 x double> @test_rootn_v8f64(<8 x double> %x, <8 x i32> %y) {
158; CHECK-LABEL: define <8 x double> @test_rootn_v8f64(
159; CHECK-SAME: <8 x double> [[X:%.*]], <8 x i32> [[Y:%.*]]) {
160; CHECK-NEXT:  entry:
161; CHECK-NEXT:    [[CALL:%.*]] = tail call <8 x double> @_Z5rootnDv8_dDv8_i(<8 x double> [[X]], <8 x i32> [[Y]])
162; CHECK-NEXT:    ret <8 x double> [[CALL]]
163;
164entry:
165  %call = tail call <8 x double> @_Z5rootnDv8_dDv8_i(<8 x double> %x, <8 x i32> %y)
166  ret <8 x double> %call
167}
168
169define <16 x double> @test_rootn_v16f64(<16 x double> %x, <16 x i32> %y) {
170; CHECK-LABEL: define <16 x double> @test_rootn_v16f64(
171; CHECK-SAME: <16 x double> [[X:%.*]], <16 x i32> [[Y:%.*]]) {
172; CHECK-NEXT:  entry:
173; CHECK-NEXT:    [[CALL:%.*]] = tail call <16 x double> @_Z5rootnDv16_dDv16_i(<16 x double> [[X]], <16 x i32> [[Y]])
174; CHECK-NEXT:    ret <16 x double> [[CALL]]
175;
176entry:
177  %call = tail call <16 x double> @_Z5rootnDv16_dDv16_i(<16 x double> %x, <16 x i32> %y)
178  ret <16 x double> %call
179}
180
181define half @test_rootn_f16(half %x, i32 %y) {
182; CHECK-LABEL: define half @test_rootn_f16(
183; CHECK-SAME: half [[X:%.*]], i32 [[Y:%.*]]) {
184; CHECK-NEXT:  entry:
185; CHECK-NEXT:    [[CALL:%.*]] = tail call half @_Z5rootnDhi(half [[X]], i32 [[Y]])
186; CHECK-NEXT:    ret half [[CALL]]
187;
188entry:
189  %call = tail call half @_Z5rootnDhi(half %x, i32 %y)
190  ret half %call
191}
192
193define <2 x half> @test_rootn_v2f16(<2 x half> %x, <2 x i32> %y) {
194; CHECK-LABEL: define <2 x half> @test_rootn_v2f16(
195; CHECK-SAME: <2 x half> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
196; CHECK-NEXT:  entry:
197; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> [[X]], <2 x i32> [[Y]])
198; CHECK-NEXT:    ret <2 x half> [[CALL]]
199;
200entry:
201  %call = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> %y)
202  ret <2 x half> %call
203}
204
205define <3 x half> @test_rootn_v3f16(<3 x half> %x, <3 x i32> %y) {
206; CHECK-LABEL: define <3 x half> @test_rootn_v3f16(
207; CHECK-SAME: <3 x half> [[X:%.*]], <3 x i32> [[Y:%.*]]) {
208; CHECK-NEXT:  entry:
209; CHECK-NEXT:    [[CALL:%.*]] = tail call <3 x half> @_Z5rootnDv3_DhDv3_i(<3 x half> [[X]], <3 x i32> [[Y]])
210; CHECK-NEXT:    ret <3 x half> [[CALL]]
211;
212entry:
213  %call = tail call <3 x half> @_Z5rootnDv3_DhDv3_i(<3 x half> %x, <3 x i32> %y)
214  ret <3 x half> %call
215}
216
217define <4 x half> @test_rootn_v4f16(<4 x half> %x, <4 x i32> %y) {
218; CHECK-LABEL: define <4 x half> @test_rootn_v4f16(
219; CHECK-SAME: <4 x half> [[X:%.*]], <4 x i32> [[Y:%.*]]) {
220; CHECK-NEXT:  entry:
221; CHECK-NEXT:    [[CALL:%.*]] = tail call <4 x half> @_Z5rootnDv4_DhDv4_i(<4 x half> [[X]], <4 x i32> [[Y]])
222; CHECK-NEXT:    ret <4 x half> [[CALL]]
223;
224entry:
225  %call = tail call <4 x half> @_Z5rootnDv4_DhDv4_i(<4 x half> %x, <4 x i32> %y)
226  ret <4 x half> %call
227}
228
229define <8 x half> @test_rootn_v8f16(<8 x half> %x, <8 x i32> %y) {
230; CHECK-LABEL: define <8 x half> @test_rootn_v8f16(
231; CHECK-SAME: <8 x half> [[X:%.*]], <8 x i32> [[Y:%.*]]) {
232; CHECK-NEXT:  entry:
233; CHECK-NEXT:    [[CALL:%.*]] = tail call <8 x half> @_Z5rootnDv8_DhDv8_i(<8 x half> [[X]], <8 x i32> [[Y]])
234; CHECK-NEXT:    ret <8 x half> [[CALL]]
235;
236entry:
237  %call = tail call <8 x half> @_Z5rootnDv8_DhDv8_i(<8 x half> %x, <8 x i32> %y)
238  ret <8 x half> %call
239}
240
241define <16 x half> @test_rootn_v16f16(<16 x half> %x, <16 x i32> %y) {
242; CHECK-LABEL: define <16 x half> @test_rootn_v16f16(
243; CHECK-SAME: <16 x half> [[X:%.*]], <16 x i32> [[Y:%.*]]) {
244; CHECK-NEXT:  entry:
245; CHECK-NEXT:    [[CALL:%.*]] = tail call <16 x half> @_Z5rootnDv16_DhDv16_i(<16 x half> [[X]], <16 x i32> [[Y]])
246; CHECK-NEXT:    ret <16 x half> [[CALL]]
247;
248entry:
249  %call = tail call <16 x half> @_Z5rootnDv16_DhDv16_i(<16 x half> %x, <16 x i32> %y)
250  ret <16 x half> %call
251}
252
253define half @test_rootn_f16_0(half %x) {
254; CHECK-LABEL: define half @test_rootn_f16_0(
255; CHECK-SAME: half [[X:%.*]]) {
256; CHECK-NEXT:    [[CALL:%.*]] = tail call half @_Z5rootnDhi(half [[X]], i32 0)
257; CHECK-NEXT:    ret half [[CALL]]
258;
259  %call = tail call half @_Z5rootnDhi(half %x, i32 0)
260  ret half %call
261}
262
263define half @test_rootn_f16_1(half %x) {
264; CHECK-LABEL: define half @test_rootn_f16_1(
265; CHECK-SAME: half [[X:%.*]]) {
266; CHECK-NEXT:    ret half [[X]]
267;
268  %call = tail call half @_Z5rootnDhi(half %x, i32 1)
269  ret half %call
270}
271
272define half @test_rootn_f16_2(half %x) {
273; CHECK-LABEL: define half @test_rootn_f16_2(
274; CHECK-SAME: half [[X:%.*]]) {
275; CHECK-NEXT:    [[CALL:%.*]] = call half @llvm.sqrt.f16(half [[X]]), !fpmath [[META0:![0-9]+]]
276; CHECK-NEXT:    ret half [[CALL]]
277;
278  %call = tail call half @_Z5rootnDhi(half %x, i32 2)
279  ret half %call
280}
281
282define half @test_rootn_f16_3(half %x) {
283; CHECK-LABEL: define half @test_rootn_f16_3(
284; CHECK-SAME: half [[X:%.*]]) {
285; CHECK-NEXT:    [[__ROOTN2CBRT:%.*]] = call half @_Z4cbrtDh(half [[X]])
286; CHECK-NEXT:    ret half [[__ROOTN2CBRT]]
287;
288  %call = tail call half @_Z5rootnDhi(half %x, i32 3)
289  ret half %call
290}
291
292define half @test_rootn_f16_neg1(half %x) {
293; CHECK-LABEL: define half @test_rootn_f16_neg1(
294; CHECK-SAME: half [[X:%.*]]) {
295; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv half 0xH3C00, [[X]]
296; CHECK-NEXT:    ret half [[__ROOTN2DIV]]
297;
298  %call = tail call half @_Z5rootnDhi(half %x, i32 -1)
299  ret half %call
300}
301
302define half @test_rootn_f16_neg2(half %x) {
303; CHECK-LABEL: define half @test_rootn_f16_neg2(
304; CHECK-SAME: half [[X:%.*]]) {
305; CHECK-NEXT:    [[TMP1:%.*]] = call contract half @llvm.sqrt.f16(half [[X]])
306; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = fdiv contract half 0xH3C00, [[TMP1]], !fpmath [[META0]]
307; CHECK-NEXT:    ret half [[__ROOTN2RSQRT]]
308;
309  %call = tail call half @_Z5rootnDhi(half %x, i32 -2)
310  ret half %call
311}
312
313define half @test_rootn_f16_neg3(half %x) {
314; CHECK-LABEL: define half @test_rootn_f16_neg3(
315; CHECK-SAME: half [[X:%.*]]) {
316; CHECK-NEXT:    [[CALL:%.*]] = tail call half @_Z5rootnDhi(half [[X]], i32 -3)
317; CHECK-NEXT:    ret half [[CALL]]
318;
319  %call = tail call half @_Z5rootnDhi(half %x, i32 -3)
320  ret half %call
321}
322
323define half @test_rootn_f16_neg4(half %x) {
324; CHECK-LABEL: define half @test_rootn_f16_neg4(
325; CHECK-SAME: half [[X:%.*]]) {
326; CHECK-NEXT:    [[CALL:%.*]] = tail call half @_Z5rootnDhi(half [[X]], i32 -4)
327; CHECK-NEXT:    ret half [[CALL]]
328;
329  %call = tail call half @_Z5rootnDhi(half %x, i32 -4)
330  ret half %call
331}
332
333define <2 x half> @test_rootn_v2f16_0(<2 x half> %x) {
334; CHECK-LABEL: define <2 x half> @test_rootn_v2f16_0(
335; CHECK-SAME: <2 x half> [[X:%.*]]) {
336; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> [[X]], <2 x i32> zeroinitializer)
337; CHECK-NEXT:    ret <2 x half> [[CALL]]
338;
339  %call = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> zeroinitializer)
340  ret <2 x half> %call
341}
342
343define <2 x half> @test_rootn_v2f16_1(<2 x half> %x) {
344; CHECK-LABEL: define <2 x half> @test_rootn_v2f16_1(
345; CHECK-SAME: <2 x half> [[X:%.*]]) {
346; CHECK-NEXT:    ret <2 x half> [[X]]
347;
348  %call = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> <i32 1, i32 1>)
349  ret <2 x half> %call
350}
351
352define <2 x half> @test_rootn_v2f16_2(<2 x half> %x) {
353; CHECK-LABEL: define <2 x half> @test_rootn_v2f16_2(
354; CHECK-SAME: <2 x half> [[X:%.*]]) {
355; CHECK-NEXT:    [[CALL:%.*]] = call <2 x half> @llvm.sqrt.v2f16(<2 x half> [[X]]), !fpmath [[META0]]
356; CHECK-NEXT:    ret <2 x half> [[CALL]]
357;
358  %call = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> <i32 2, i32 2>)
359  ret <2 x half> %call
360}
361
362define <2 x half> @test_rootn_v2f16_neg1(<2 x half> %x) {
363; CHECK-LABEL: define <2 x half> @test_rootn_v2f16_neg1(
364; CHECK-SAME: <2 x half> [[X:%.*]]) {
365; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv <2 x half> splat (half 0xH3C00), [[X]]
366; CHECK-NEXT:    ret <2 x half> [[__ROOTN2DIV]]
367;
368  %call = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> <i32 -1, i32 -1>)
369  ret <2 x half> %call
370}
371
372define <2 x half> @test_rootn_v2f16_neg2(<2 x half> %x) {
373; CHECK-LABEL: define <2 x half> @test_rootn_v2f16_neg2(
374; CHECK-SAME: <2 x half> [[X:%.*]]) {
375; CHECK-NEXT:    [[TMP1:%.*]] = call contract <2 x half> @llvm.sqrt.v2f16(<2 x half> [[X]])
376; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = fdiv contract <2 x half> splat (half 0xH3C00), [[TMP1]], !fpmath [[META0]]
377; CHECK-NEXT:    ret <2 x half> [[__ROOTN2RSQRT]]
378;
379  %call = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> <i32 -2, i32 -2>)
380  ret <2 x half> %call
381}
382
383define <2 x half> @test_rootn_v2f16_neg3(<2 x half> %x) {
384; CHECK-LABEL: define <2 x half> @test_rootn_v2f16_neg3(
385; CHECK-SAME: <2 x half> [[X:%.*]]) {
386; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> [[X]], <2 x i32> splat (i32 -3))
387; CHECK-NEXT:    ret <2 x half> [[CALL]]
388;
389  %call = tail call <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> <i32 -3, i32 -3>)
390  ret <2 x half> %call
391}
392
393define float @test_rootn_f32__y_0(float %x) {
394; CHECK-LABEL: define float @test_rootn_f32__y_0(
395; CHECK-SAME: float [[X:%.*]]) {
396; CHECK-NEXT:  entry:
397; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 0)
398; CHECK-NEXT:    ret float [[CALL]]
399;
400entry:
401  %call = tail call float @_Z5rootnfi(float %x, i32 0)
402  ret float %call
403}
404
405define float @test_rootn_f32__y_poison(float %x) {
406; CHECK-LABEL: define float @test_rootn_f32__y_poison(
407; CHECK-SAME: float [[X:%.*]]) {
408; CHECK-NEXT:  entry:
409; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 poison)
410; CHECK-NEXT:    ret float [[CALL]]
411;
412entry:
413  %call = tail call float @_Z5rootnfi(float %x, i32 poison)
414  ret float %call
415}
416
417define <2 x float> @test_rootn_v2f32__y_poison(<2 x float> %x) {
418; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_poison(
419; CHECK-SAME: <2 x float> [[X:%.*]]) {
420; CHECK-NEXT:  entry:
421; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> poison)
422; CHECK-NEXT:    ret <2 x float> [[CALL]]
423;
424entry:
425  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> poison)
426  ret <2 x float> %call
427}
428
429define <2 x float> @test_rootn_v2f32__y_0(<2 x float> %x) {
430; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_0(
431; CHECK-SAME: <2 x float> [[X:%.*]]) {
432; CHECK-NEXT:  entry:
433; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> zeroinitializer)
434; CHECK-NEXT:    ret <2 x float> [[CALL]]
435;
436entry:
437  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> zeroinitializer)
438  ret <2 x float> %call
439}
440
441define <2 x float> @test_rootn_v2f32__y_0_undef(<2 x float> %x) {
442; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_0_undef(
443; CHECK-SAME: <2 x float> [[X:%.*]]) {
444; CHECK-NEXT:  entry:
445; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> <i32 0, i32 poison>)
446; CHECK-NEXT:    ret <2 x float> [[CALL]]
447;
448entry:
449  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 0, i32 poison>)
450  ret <2 x float> %call
451}
452
453define <3 x float> @test_rootn_v3f32__y_0(<3 x float> %x) {
454; CHECK-LABEL: define <3 x float> @test_rootn_v3f32__y_0(
455; CHECK-SAME: <3 x float> [[X:%.*]]) {
456; CHECK-NEXT:  entry:
457; CHECK-NEXT:    [[CALL:%.*]] = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> [[X]], <3 x i32> zeroinitializer)
458; CHECK-NEXT:    ret <3 x float> [[CALL]]
459;
460entry:
461  %call = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> %x, <3 x i32> zeroinitializer)
462  ret <3 x float> %call
463}
464
465define <4 x float> @test_rootn_v4f32__y_0(<4 x float> %x) {
466; CHECK-LABEL: define <4 x float> @test_rootn_v4f32__y_0(
467; CHECK-SAME: <4 x float> [[X:%.*]]) {
468; CHECK-NEXT:  entry:
469; CHECK-NEXT:    [[CALL:%.*]] = tail call <4 x float> @_Z5rootnDv4_fDv4_i(<4 x float> [[X]], <4 x i32> zeroinitializer)
470; CHECK-NEXT:    ret <4 x float> [[CALL]]
471;
472entry:
473  %call = tail call <4 x float> @_Z5rootnDv4_fDv4_i(<4 x float> %x, <4 x i32> zeroinitializer)
474  ret <4 x float> %call
475}
476
477define <8 x float> @test_rootn_v8f32__y_0(<8 x float> %x) {
478; CHECK-LABEL: define <8 x float> @test_rootn_v8f32__y_0(
479; CHECK-SAME: <8 x float> [[X:%.*]]) {
480; CHECK-NEXT:  entry:
481; CHECK-NEXT:    [[CALL:%.*]] = tail call <8 x float> @_Z5rootnDv8_fDv8_i(<8 x float> [[X]], <8 x i32> zeroinitializer)
482; CHECK-NEXT:    ret <8 x float> [[CALL]]
483;
484entry:
485  %call = tail call <8 x float> @_Z5rootnDv8_fDv8_i(<8 x float> %x, <8 x i32> zeroinitializer)
486  ret <8 x float> %call
487}
488
489define <16 x float> @test_rootn_v16f32__y_0(<16 x float> %x) {
490; CHECK-LABEL: define <16 x float> @test_rootn_v16f32__y_0(
491; CHECK-SAME: <16 x float> [[X:%.*]]) {
492; CHECK-NEXT:  entry:
493; CHECK-NEXT:    [[CALL:%.*]] = tail call <16 x float> @_Z5rootnDv16_fDv16_i(<16 x float> [[X]], <16 x i32> zeroinitializer)
494; CHECK-NEXT:    ret <16 x float> [[CALL]]
495;
496entry:
497  %call = tail call <16 x float> @_Z5rootnDv16_fDv16_i(<16 x float> %x, <16 x i32> zeroinitializer)
498  ret <16 x float> %call
499}
500
501define float @test_rootn_f32__y_1(float %x) {
502; CHECK-LABEL: define float @test_rootn_f32__y_1(
503; CHECK-SAME: float [[X:%.*]]) {
504; CHECK-NEXT:  entry:
505; CHECK-NEXT:    ret float [[X]]
506;
507entry:
508  %call = tail call float @_Z5rootnfi(float %x, i32 1)
509  ret float %call
510}
511
512define float @test_rootn_f32__y_1__strictfp(float %x) #1 {
513; CHECK-LABEL: define float @test_rootn_f32__y_1__strictfp(
514; CHECK-SAME: float [[X:%.*]]) #[[ATTR0:[0-9]+]] {
515; CHECK-NEXT:  entry:
516; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 1) #[[ATTR0]]
517; CHECK-NEXT:    ret float [[CALL]]
518;
519entry:
520  %call = tail call float @_Z5rootnfi(float %x, i32 1) #1
521  ret float %call
522}
523
524define <2 x float> @test_rootn_v2f32__y_1(<2 x float> %x) {
525; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_1(
526; CHECK-SAME: <2 x float> [[X:%.*]]) {
527; CHECK-NEXT:  entry:
528; CHECK-NEXT:    ret <2 x float> [[X]]
529;
530entry:
531  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 1, i32 1>)
532  ret <2 x float> %call
533}
534
535define <2 x float> @test_rootn_v2f32__y_1__strictfp(<2 x float> %x) #1 {
536; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_1__strictfp(
537; CHECK-SAME: <2 x float> [[X:%.*]]) #[[ATTR0]] {
538; CHECK-NEXT:  entry:
539; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> splat (i32 1)) #[[ATTR0]]
540; CHECK-NEXT:    ret <2 x float> [[CALL]]
541;
542entry:
543  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 1, i32 1>) #1
544  ret <2 x float> %call
545}
546
547define <2 x float> @test_rootn_v2f32__y_1_undef(<2 x float> %x) {
548; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_1_undef(
549; CHECK-SAME: <2 x float> [[X:%.*]]) {
550; CHECK-NEXT:  entry:
551; CHECK-NEXT:    ret <2 x float> [[X]]
552;
553entry:
554  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 1, i32 poison>)
555  ret <2 x float> %call
556}
557
558define <3 x float> @test_rootn_v3f32__y_1(<3 x float> %x) {
559; CHECK-LABEL: define <3 x float> @test_rootn_v3f32__y_1(
560; CHECK-SAME: <3 x float> [[X:%.*]]) {
561; CHECK-NEXT:  entry:
562; CHECK-NEXT:    ret <3 x float> [[X]]
563;
564entry:
565  %call = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> %x, <3 x i32> <i32 1, i32 1, i32 1>)
566  ret <3 x float> %call
567}
568
569define <3 x float> @test_rootn_v3f32__y_1_undef(<3 x float> %x) {
570; CHECK-LABEL: define <3 x float> @test_rootn_v3f32__y_1_undef(
571; CHECK-SAME: <3 x float> [[X:%.*]]) {
572; CHECK-NEXT:  entry:
573; CHECK-NEXT:    ret <3 x float> [[X]]
574;
575entry:
576  %call = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> %x, <3 x i32> <i32 1, i32 1, i32 poison>)
577  ret <3 x float> %call
578}
579
580define <4 x float> @test_rootn_v4f32__y_1(<4 x float> %x) {
581; CHECK-LABEL: define <4 x float> @test_rootn_v4f32__y_1(
582; CHECK-SAME: <4 x float> [[X:%.*]]) {
583; CHECK-NEXT:  entry:
584; CHECK-NEXT:    ret <4 x float> [[X]]
585;
586entry:
587  %call = tail call <4 x float> @_Z5rootnDv4_fDv4_i(<4 x float> %x, <4 x i32> <i32 1, i32 1, i32 1, i32 1>)
588  ret <4 x float> %call
589}
590
591define <8 x float> @test_rootn_v8f32__y_1(<8 x float> %x) {
592; CHECK-LABEL: define <8 x float> @test_rootn_v8f32__y_1(
593; CHECK-SAME: <8 x float> [[X:%.*]]) {
594; CHECK-NEXT:  entry:
595; CHECK-NEXT:    ret <8 x float> [[X]]
596;
597entry:
598  %call = tail call <8 x float> @_Z5rootnDv8_fDv8_i(<8 x float> %x, <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>)
599  ret <8 x float> %call
600}
601
602define <16 x float> @test_rootn_v16f32__y_1(<16 x float> %x) {
603; CHECK-LABEL: define <16 x float> @test_rootn_v16f32__y_1(
604; CHECK-SAME: <16 x float> [[X:%.*]]) {
605; CHECK-NEXT:  entry:
606; CHECK-NEXT:    ret <16 x float> [[X]]
607;
608entry:
609  %call = tail call <16 x float> @_Z5rootnDv16_fDv16_i(<16 x float> %x, <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>)
610  ret <16 x float> %call
611}
612
613define float @test_rootn_f32__y_2(float %x) {
614; CHECK-LABEL: define float @test_rootn_f32__y_2(
615; CHECK-SAME: float [[X:%.*]]) {
616; CHECK-NEXT:  entry:
617; CHECK-NEXT:    [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[X]]), !fpmath [[META0]]
618; CHECK-NEXT:    ret float [[CALL]]
619;
620entry:
621  %call = tail call float @_Z5rootnfi(float %x, i32 2)
622  ret float %call
623}
624
625define float @test_rootn_f32__y_2_flags(float %x) {
626; CHECK-LABEL: define float @test_rootn_f32__y_2_flags(
627; CHECK-SAME: float [[X:%.*]]) {
628; CHECK-NEXT:  entry:
629; CHECK-NEXT:    [[CALL:%.*]] = call nnan nsz float @llvm.sqrt.f32(float [[X]]), !fpmath [[META0]]
630; CHECK-NEXT:    ret float [[CALL]]
631;
632entry:
633  %call = tail call nnan nsz float @_Z5rootnfi(float %x, i32 2)
634  ret float %call
635}
636
637; Should retain looser existing !fpmath requirements.
638define float @test_rootn_f32__y_2_fpmath_3(float %x) {
639; CHECK-LABEL: define float @test_rootn_f32__y_2_fpmath_3(
640; CHECK-SAME: float [[X:%.*]]) {
641; CHECK-NEXT:  entry:
642; CHECK-NEXT:    [[CALL:%.*]] = call nnan nsz float @llvm.sqrt.f32(float [[X]]), !fpmath [[META1:![0-9]+]]
643; CHECK-NEXT:    ret float [[CALL]]
644;
645entry:
646  %call = tail call nnan nsz float @_Z5rootnfi(float %x, i32 2), !fpmath !0
647  ret float %call
648}
649
650define <2 x float> @test_rootn_v2f32__y_2_flags(<2 x float> %x) {
651; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_2_flags(
652; CHECK-SAME: <2 x float> [[X:%.*]]) {
653; CHECK-NEXT:  entry:
654; CHECK-NEXT:    [[CALL:%.*]] = call nnan nsz <2 x float> @llvm.sqrt.v2f32(<2 x float> [[X]]), !fpmath [[META0]]
655; CHECK-NEXT:    ret <2 x float> [[CALL]]
656;
657entry:
658  %call = tail call nnan nsz <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 2, i32 2>)
659  ret <2 x float> %call
660}
661
662define <3 x float> @test_rootn_v3f32__y_2(<3 x float> %x) {
663; CHECK-LABEL: define <3 x float> @test_rootn_v3f32__y_2(
664; CHECK-SAME: <3 x float> [[X:%.*]]) {
665; CHECK-NEXT:  entry:
666; CHECK-NEXT:    [[CALL:%.*]] = call <3 x float> @llvm.sqrt.v3f32(<3 x float> [[X]]), !fpmath [[META0]]
667; CHECK-NEXT:    ret <3 x float> [[CALL]]
668;
669entry:
670  %call = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> %x, <3 x i32> <i32 2, i32 2, i32 2>)
671  ret <3 x float> %call
672}
673
674define <3 x float> @test_rootn_v3f32__y_2_undef(<3 x float> %x) {
675; CHECK-LABEL: define <3 x float> @test_rootn_v3f32__y_2_undef(
676; CHECK-SAME: <3 x float> [[X:%.*]]) {
677; CHECK-NEXT:  entry:
678; CHECK-NEXT:    [[CALL:%.*]] = call <3 x float> @llvm.sqrt.v3f32(<3 x float> [[X]]), !fpmath [[META0]]
679; CHECK-NEXT:    ret <3 x float> [[CALL]]
680;
681entry:
682  %call = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> %x, <3 x i32> <i32 2, i32 poison, i32 2>)
683  ret <3 x float> %call
684}
685
686define <4 x float> @test_rootn_v4f32__y_2(<4 x float> %x) {
687; CHECK-LABEL: define <4 x float> @test_rootn_v4f32__y_2(
688; CHECK-SAME: <4 x float> [[X:%.*]]) {
689; CHECK-NEXT:  entry:
690; CHECK-NEXT:    [[CALL:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[X]]), !fpmath [[META0]]
691; CHECK-NEXT:    ret <4 x float> [[CALL]]
692;
693entry:
694  %call = tail call <4 x float> @_Z5rootnDv4_fDv4_i(<4 x float> %x, <4 x i32> <i32 2, i32 2, i32 2, i32 2>)
695  ret <4 x float> %call
696}
697
698define <8 x float> @test_rootn_v8f32__y_2(<8 x float> %x) {
699; CHECK-LABEL: define <8 x float> @test_rootn_v8f32__y_2(
700; CHECK-SAME: <8 x float> [[X:%.*]]) {
701; CHECK-NEXT:  entry:
702; CHECK-NEXT:    [[CALL:%.*]] = call <8 x float> @llvm.sqrt.v8f32(<8 x float> [[X]]), !fpmath [[META0]]
703; CHECK-NEXT:    ret <8 x float> [[CALL]]
704;
705entry:
706  %call = tail call <8 x float> @_Z5rootnDv8_fDv8_i(<8 x float> %x, <8 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>)
707  ret <8 x float> %call
708}
709
710define <16 x float> @test_rootn_v16f32__y_2(<16 x float> %x) {
711; CHECK-LABEL: define <16 x float> @test_rootn_v16f32__y_2(
712; CHECK-SAME: <16 x float> [[X:%.*]]) {
713; CHECK-NEXT:  entry:
714; CHECK-NEXT:    [[CALL:%.*]] = call <16 x float> @llvm.sqrt.v16f32(<16 x float> [[X]]), !fpmath [[META0]]
715; CHECK-NEXT:    ret <16 x float> [[CALL]]
716;
717entry:
718  %call = tail call <16 x float> @_Z5rootnDv16_fDv16_i(<16 x float> %x, <16 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2>)
719  ret <16 x float> %call
720}
721
722define float @test_rootn_f32__y_3(float %x) {
723; CHECK-LABEL: define float @test_rootn_f32__y_3(
724; CHECK-SAME: float [[X:%.*]]) {
725; CHECK-NEXT:  entry:
726; CHECK-NEXT:    [[__ROOTN2CBRT:%.*]] = call float @_Z4cbrtf(float [[X]])
727; CHECK-NEXT:    ret float [[__ROOTN2CBRT]]
728;
729entry:
730  %call = tail call float @_Z5rootnfi(float %x, i32 3)
731  ret float %call
732}
733
734define <2 x float> @test_rootn_v2f32__y_3(<2 x float> %x) {
735; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_3(
736; CHECK-SAME: <2 x float> [[X:%.*]]) {
737; CHECK-NEXT:  entry:
738; CHECK-NEXT:    [[__ROOTN2CBRT:%.*]] = call <2 x float> @_Z4cbrtDv2_f(<2 x float> [[X]])
739; CHECK-NEXT:    ret <2 x float> [[__ROOTN2CBRT]]
740;
741entry:
742  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 3, i32 3>)
743  ret <2 x float> %call
744}
745
746define <2 x float> @test_rootn_v2f32__y_nonsplat_2_3(<2 x float> %x) {
747; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_nonsplat_2_3(
748; CHECK-SAME: <2 x float> [[X:%.*]]) {
749; CHECK-NEXT:  entry:
750; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> <i32 2, i32 3>)
751; CHECK-NEXT:    ret <2 x float> [[CALL]]
752;
753entry:
754  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 2, i32 3>)
755  ret <2 x float> %call
756}
757
758define <2 x float> @test_rootn_v2f32__y_nonsplat_2_poison(<2 x float> %x) {
759; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_nonsplat_2_poison(
760; CHECK-SAME: <2 x float> [[X:%.*]]) {
761; CHECK-NEXT:  entry:
762; CHECK-NEXT:    [[CALL:%.*]] = call <2 x float> @llvm.sqrt.v2f32(<2 x float> [[X]]), !fpmath [[META0]]
763; CHECK-NEXT:    ret <2 x float> [[CALL]]
764;
765entry:
766  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 2, i32 poison>)
767  ret <2 x float> %call
768}
769
770define <2 x float> @test_rootn_v2f32__y_nonsplat_2_5(<2 x float> %x) {
771; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_nonsplat_2_5(
772; CHECK-SAME: <2 x float> [[X:%.*]]) {
773; CHECK-NEXT:  entry:
774; CHECK-NEXT:    [[CALL:%.*]] = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> <i32 2, i32 5>)
775; CHECK-NEXT:    ret <2 x float> [[CALL]]
776;
777entry:
778  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 2, i32 5>)
779  ret <2 x float> %call
780}
781
782define float @test_rootn_f32__y_neg1(float %x) {
783; CHECK-LABEL: define float @test_rootn_f32__y_neg1(
784; CHECK-SAME: float [[X:%.*]]) {
785; CHECK-NEXT:  entry:
786; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv float 1.000000e+00, [[X]]
787; CHECK-NEXT:    ret float [[__ROOTN2DIV]]
788;
789entry:
790  %call = tail call float @_Z5rootnfi(float %x, i32 -1)
791  ret float %call
792}
793
794define <2 x float> @test_rootn_v2f32__y_neg1(<2 x float> %x) {
795; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_neg1(
796; CHECK-SAME: <2 x float> [[X:%.*]]) {
797; CHECK-NEXT:  entry:
798; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv <2 x float> splat (float 1.000000e+00), [[X]]
799; CHECK-NEXT:    ret <2 x float> [[__ROOTN2DIV]]
800;
801entry:
802  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 -1, i32 -1>)
803  ret <2 x float> %call
804}
805
806define <3 x float> @test_rootn_v3f32__y_neg1(<3 x float> %x) {
807; CHECK-LABEL: define <3 x float> @test_rootn_v3f32__y_neg1(
808; CHECK-SAME: <3 x float> [[X:%.*]]) {
809; CHECK-NEXT:  entry:
810; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv <3 x float> splat (float 1.000000e+00), [[X]]
811; CHECK-NEXT:    ret <3 x float> [[__ROOTN2DIV]]
812;
813entry:
814  %call = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> %x, <3 x i32> <i32 -1, i32 -1, i32 -1>)
815  ret <3 x float> %call
816}
817
818define <3 x float> @test_rootn_v3f32__y_neg1_undef(<3 x float> %x) {
819; CHECK-LABEL: define <3 x float> @test_rootn_v3f32__y_neg1_undef(
820; CHECK-SAME: <3 x float> [[X:%.*]]) {
821; CHECK-NEXT:  entry:
822; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv <3 x float> splat (float 1.000000e+00), [[X]]
823; CHECK-NEXT:    ret <3 x float> [[__ROOTN2DIV]]
824;
825entry:
826  %call = tail call <3 x float> @_Z5rootnDv3_fDv3_i(<3 x float> %x, <3 x i32> <i32 -1, i32 -1, i32 poison>)
827  ret <3 x float> %call
828}
829
830define <4 x float> @test_rootn_v4f32__y_neg1(<4 x float> %x) {
831; CHECK-LABEL: define <4 x float> @test_rootn_v4f32__y_neg1(
832; CHECK-SAME: <4 x float> [[X:%.*]]) {
833; CHECK-NEXT:  entry:
834; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv <4 x float> splat (float 1.000000e+00), [[X]]
835; CHECK-NEXT:    ret <4 x float> [[__ROOTN2DIV]]
836;
837entry:
838  %call = tail call <4 x float> @_Z5rootnDv4_fDv4_i(<4 x float> %x, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>)
839  ret <4 x float> %call
840}
841
842define <8 x float> @test_rootn_v8f32__y_neg1(<8 x float> %x) {
843; CHECK-LABEL: define <8 x float> @test_rootn_v8f32__y_neg1(
844; CHECK-SAME: <8 x float> [[X:%.*]]) {
845; CHECK-NEXT:  entry:
846; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv <8 x float> splat (float 1.000000e+00), [[X]]
847; CHECK-NEXT:    ret <8 x float> [[__ROOTN2DIV]]
848;
849entry:
850  %call = tail call <8 x float> @_Z5rootnDv8_fDv8_i(<8 x float> %x, <8 x i32> <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>)
851  ret <8 x float> %call
852}
853
854define <16 x float> @test_rootn_v16f32__y_neg1(<16 x float> %x) {
855; CHECK-LABEL: define <16 x float> @test_rootn_v16f32__y_neg1(
856; CHECK-SAME: <16 x float> [[X:%.*]]) {
857; CHECK-NEXT:  entry:
858; CHECK-NEXT:    [[__ROOTN2DIV:%.*]] = fdiv <16 x float> splat (float 1.000000e+00), [[X]]
859; CHECK-NEXT:    ret <16 x float> [[__ROOTN2DIV]]
860;
861entry:
862  %call = tail call <16 x float> @_Z5rootnDv16_fDv16_i(<16 x float> %x, <16 x i32> <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>)
863  ret <16 x float> %call
864}
865
866define float @test_rootn_f32__y_neg2(float %x) {
867; CHECK-LABEL: define float @test_rootn_f32__y_neg2(
868; CHECK-SAME: float [[X:%.*]]) {
869; CHECK-NEXT:  entry:
870; CHECK-NEXT:    [[TMP0:%.*]] = call contract float @llvm.sqrt.f32(float [[X]])
871; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = fdiv contract float 1.000000e+00, [[TMP0]], !fpmath [[META0]]
872; CHECK-NEXT:    ret float [[__ROOTN2RSQRT]]
873;
874entry:
875  %call = tail call float @_Z5rootnfi(float %x, i32 -2)
876  ret float %call
877}
878
879define float @test_rootn_f32__y_neg2__flags(float %x) {
880; CHECK-LABEL: define float @test_rootn_f32__y_neg2__flags(
881; CHECK-SAME: float [[X:%.*]]) {
882; CHECK-NEXT:  entry:
883; CHECK-NEXT:    [[TMP0:%.*]] = call nnan nsz contract float @llvm.sqrt.f32(float [[X]])
884; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = fdiv nnan nsz contract float 1.000000e+00, [[TMP0]], !fpmath [[META0]]
885; CHECK-NEXT:    ret float [[__ROOTN2RSQRT]]
886;
887entry:
888  %call = tail call nsz nnan float @_Z5rootnfi(float %x, i32 -2)
889  ret float %call
890}
891
892define float @test_rootn_f32__y_neg2__strictfp(float %x) #1 {
893; CHECK-LABEL: define float @test_rootn_f32__y_neg2__strictfp(
894; CHECK-SAME: float [[X:%.*]]) #[[ATTR0]] {
895; CHECK-NEXT:  entry:
896; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 -2) #[[ATTR0]]
897; CHECK-NEXT:    ret float [[__ROOTN2RSQRT]]
898;
899entry:
900  %call = tail call float @_Z5rootnfi(float %x, i32 -2) #1
901  ret float %call
902}
903
904define float @test_rootn_f32__y_neg2__noinline(float %x) {
905; CHECK-LABEL: define float @test_rootn_f32__y_neg2__noinline(
906; CHECK-SAME: float [[X:%.*]]) {
907; CHECK-NEXT:  entry:
908; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 -2) #[[ATTR3:[0-9]+]]
909; CHECK-NEXT:    ret float [[__ROOTN2RSQRT]]
910;
911entry:
912  %call = tail call float @_Z5rootnfi(float %x, i32 -2) #2
913  ret float %call
914}
915
916define float @test_rootn_f32__y_neg2__nobuiltin(float %x) {
917; CHECK-LABEL: define float @test_rootn_f32__y_neg2__nobuiltin(
918; CHECK-SAME: float [[X:%.*]]) {
919; CHECK-NEXT:  entry:
920; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 -2) #[[ATTR4:[0-9]+]]
921; CHECK-NEXT:    ret float [[CALL]]
922;
923entry:
924  %call = tail call float @_Z5rootnfi(float %x, i32 -2) #0
925  ret float %call
926}
927
928define <2 x float> @test_rootn_v2f32__y_neg2(<2 x float> %x) {
929; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_neg2(
930; CHECK-SAME: <2 x float> [[X:%.*]]) {
931; CHECK-NEXT:  entry:
932; CHECK-NEXT:    [[TMP0:%.*]] = call contract <2 x float> @llvm.sqrt.v2f32(<2 x float> [[X]])
933; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = fdiv contract <2 x float> splat (float 1.000000e+00), [[TMP0]], !fpmath [[META0]]
934; CHECK-NEXT:    ret <2 x float> [[__ROOTN2RSQRT]]
935;
936entry:
937  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 -2, i32 -2>)
938  ret <2 x float> %call
939}
940
941define <2 x float> @test_rootn_v2f32__y_neg2__flags(<2 x float> %x) {
942; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_neg2__flags(
943; CHECK-SAME: <2 x float> [[X:%.*]]) {
944; CHECK-NEXT:  entry:
945; CHECK-NEXT:    [[TMP0:%.*]] = call nnan nsz contract <2 x float> @llvm.sqrt.v2f32(<2 x float> [[X]])
946; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = fdiv nnan nsz contract <2 x float> splat (float 1.000000e+00), [[TMP0]], !fpmath [[META0]]
947; CHECK-NEXT:    ret <2 x float> [[__ROOTN2RSQRT]]
948;
949entry:
950  %call = tail call nsz nnan <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 -2, i32 -2>)
951  ret <2 x float> %call
952}
953
954define <2 x float> @test_rootn_v2f32__y_neg2__strictfp(<2 x float> %x) #1 {
955; CHECK-LABEL: define <2 x float> @test_rootn_v2f32__y_neg2__strictfp(
956; CHECK-SAME: <2 x float> [[X:%.*]]) #[[ATTR0]] {
957; CHECK-NEXT:  entry:
958; CHECK-NEXT:    [[__ROOTN2RSQRT:%.*]] = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> splat (i32 -2)) #[[ATTR0]]
959; CHECK-NEXT:    ret <2 x float> [[__ROOTN2RSQRT]]
960;
961entry:
962  %call = tail call <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 -2, i32 -2>) #1
963  ret <2 x float> %call
964}
965
966define float @test_rootn_f32__y_neg3(float %x) {
967; CHECK-LABEL: define float @test_rootn_f32__y_neg3(
968; CHECK-SAME: float [[X:%.*]]) {
969; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 -3)
970; CHECK-NEXT:    ret float [[CALL]]
971;
972  %call = tail call float @_Z5rootnfi(float %x, i32 -3)
973  ret float %call
974}
975
976define float @test_rootn_f32__y_neg4(float %x) {
977; CHECK-LABEL: define float @test_rootn_f32__y_neg4(
978; CHECK-SAME: float [[X:%.*]]) {
979; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 -4)
980; CHECK-NEXT:    ret float [[CALL]]
981;
982  %call = tail call float @_Z5rootnfi(float %x, i32 -4)
983  ret float %call
984}
985
986define float @test_rootn_afn_f32(float %x, i32 %y) {
987; CHECK-LABEL: define float @test_rootn_afn_f32(
988; CHECK-SAME: float [[X:%.*]], i32 [[Y:%.*]]) {
989; CHECK-NEXT:  entry:
990; CHECK-NEXT:    [[CALL:%.*]] = tail call afn float @_Z5rootnfi(float [[X]], i32 [[Y]])
991; CHECK-NEXT:    ret float [[CALL]]
992;
993entry:
994  %call = tail call afn float @_Z5rootnfi(float %x, i32 %y)
995  ret float %call
996}
997
998define <2 x float> @test_rootn_afn_v2f32(<2 x float> %x, <2 x i32> %y) {
999; CHECK-LABEL: define <2 x float> @test_rootn_afn_v2f32(
1000; CHECK-SAME: <2 x float> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
1001; CHECK-NEXT:  entry:
1002; CHECK-NEXT:    [[CALL:%.*]] = tail call afn <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> [[Y]])
1003; CHECK-NEXT:    ret <2 x float> [[CALL]]
1004;
1005entry:
1006  %call = tail call afn <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> %y)
1007  ret <2 x float> %call
1008}
1009
1010define double @test_rootn_afn_f64(double %x, i32 %y) {
1011; CHECK-LABEL: define double @test_rootn_afn_f64(
1012; CHECK-SAME: double [[X:%.*]], i32 [[Y:%.*]]) {
1013; CHECK-NEXT:  entry:
1014; CHECK-NEXT:    [[CALL:%.*]] = tail call afn double @_Z5rootndi(double [[X]], i32 [[Y]])
1015; CHECK-NEXT:    ret double [[CALL]]
1016;
1017entry:
1018  %call = tail call afn double @_Z5rootndi(double %x, i32 %y)
1019  ret double %call
1020}
1021
1022define <2 x double> @test_rootn_afn_v2f64(<2 x double> %x, <2 x i32> %y) {
1023; CHECK-LABEL: define <2 x double> @test_rootn_afn_v2f64(
1024; CHECK-SAME: <2 x double> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
1025; CHECK-NEXT:  entry:
1026; CHECK-NEXT:    [[CALL:%.*]] = tail call afn <2 x double> @_Z5rootnDv2_dDv2_i(<2 x double> [[X]], <2 x i32> [[Y]])
1027; CHECK-NEXT:    ret <2 x double> [[CALL]]
1028;
1029entry:
1030  %call = tail call afn <2 x double> @_Z5rootnDv2_dDv2_i(<2 x double> %x, <2 x i32> %y)
1031  ret <2 x double> %call
1032}
1033
1034define half @test_rootn_afn_f16(half %x, i32 %y) {
1035; CHECK-LABEL: define half @test_rootn_afn_f16(
1036; CHECK-SAME: half [[X:%.*]], i32 [[Y:%.*]]) {
1037; CHECK-NEXT:  entry:
1038; CHECK-NEXT:    [[CALL:%.*]] = tail call afn half @_Z5rootnDhi(half [[X]], i32 [[Y]])
1039; CHECK-NEXT:    ret half [[CALL]]
1040;
1041entry:
1042  %call = tail call afn half @_Z5rootnDhi(half %x, i32 %y)
1043  ret half %call
1044}
1045
1046define <2 x half> @test_rootn_afn_v2f16(<2 x half> %x, <2 x i32> %y) {
1047; CHECK-LABEL: define <2 x half> @test_rootn_afn_v2f16(
1048; CHECK-SAME: <2 x half> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
1049; CHECK-NEXT:  entry:
1050; CHECK-NEXT:    [[CALL:%.*]] = tail call afn <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> [[X]], <2 x i32> [[Y]])
1051; CHECK-NEXT:    ret <2 x half> [[CALL]]
1052;
1053entry:
1054  %call = tail call afn <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> %y)
1055  ret <2 x half> %call
1056}
1057
1058define float @test_rootn_afn_nnan_ninf_f32(float %x, i32 %y) {
1059; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32(
1060; CHECK-SAME: float [[X:%.*]], i32 [[Y:%.*]]) {
1061; CHECK-NEXT:  entry:
1062; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 [[Y]])
1063; CHECK-NEXT:    ret float [[CALL]]
1064;
1065entry:
1066  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 %y)
1067  ret float %call
1068}
1069
1070define <2 x float> @test_rootn_afn_nnan_ninf_v2f32(<2 x float> %x, <2 x i32> %y) {
1071; CHECK-LABEL: define <2 x float> @test_rootn_afn_nnan_ninf_v2f32(
1072; CHECK-SAME: <2 x float> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
1073; CHECK-NEXT:  entry:
1074; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> [[Y]])
1075; CHECK-NEXT:    ret <2 x float> [[CALL]]
1076;
1077entry:
1078  %call = tail call nnan ninf afn <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> %y)
1079  ret <2 x float> %call
1080}
1081
1082define double @test_rootn_afn_nnan_ninf_f64(double %x, i32 %y) {
1083; CHECK-LABEL: define double @test_rootn_afn_nnan_ninf_f64(
1084; CHECK-SAME: double [[X:%.*]], i32 [[Y:%.*]]) {
1085; CHECK-NEXT:  entry:
1086; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @_Z5rootndi(double [[X]], i32 [[Y]])
1087; CHECK-NEXT:    ret double [[CALL]]
1088;
1089entry:
1090  %call = tail call nnan ninf afn double @_Z5rootndi(double %x, i32 %y)
1091  ret double %call
1092}
1093
1094define <2 x double> @test_rootn_afn_nnan_ninf_v2f64(<2 x double> %x, <2 x i32> %y) {
1095; CHECK-LABEL: define <2 x double> @test_rootn_afn_nnan_ninf_v2f64(
1096; CHECK-SAME: <2 x double> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
1097; CHECK-NEXT:  entry:
1098; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn <2 x double> @_Z5rootnDv2_dDv2_i(<2 x double> [[X]], <2 x i32> [[Y]])
1099; CHECK-NEXT:    ret <2 x double> [[CALL]]
1100;
1101entry:
1102  %call = tail call nnan ninf afn <2 x double> @_Z5rootnDv2_dDv2_i(<2 x double> %x, <2 x i32> %y)
1103  ret <2 x double> %call
1104}
1105
1106define half @test_rootn_afn_nnan_ninf_f16(half %x, i32 %y) {
1107; CHECK-LABEL: define half @test_rootn_afn_nnan_ninf_f16(
1108; CHECK-SAME: half [[X:%.*]], i32 [[Y:%.*]]) {
1109; CHECK-NEXT:  entry:
1110; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn half @_Z5rootnDhi(half [[X]], i32 [[Y]])
1111; CHECK-NEXT:    ret half [[CALL]]
1112;
1113entry:
1114  %call = tail call nnan ninf afn half @_Z5rootnDhi(half %x, i32 %y)
1115  ret half %call
1116}
1117
1118define <2 x half> @test_rootn_afn_nnan_ninf_v2f16(<2 x half> %x, <2 x i32> %y) {
1119; CHECK-LABEL: define <2 x half> @test_rootn_afn_nnan_ninf_v2f16(
1120; CHECK-SAME: <2 x half> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
1121; CHECK-NEXT:  entry:
1122; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> [[X]], <2 x i32> [[Y]])
1123; CHECK-NEXT:    ret <2 x half> [[CALL]]
1124;
1125entry:
1126  %call = tail call nnan ninf afn <2 x half> @_Z5rootnDv2_DhDv2_i(<2 x half> %x, <2 x i32> %y)
1127  ret <2 x half> %call
1128}
1129
1130define float @test_rootn_fast_f32_nobuiltin(float %x, i32 %y) {
1131; CHECK-LABEL: define float @test_rootn_fast_f32_nobuiltin(
1132; CHECK-SAME: float [[X:%.*]], i32 [[Y:%.*]]) {
1133; CHECK-NEXT:  entry:
1134; CHECK-NEXT:    [[CALL:%.*]] = tail call fast float @_Z5rootnfi(float [[X]], i32 [[Y]]) #[[ATTR4]]
1135; CHECK-NEXT:    ret float [[CALL]]
1136;
1137entry:
1138  %call = tail call fast float @_Z5rootnfi(float %x, i32 %y) #0
1139  ret float %call
1140}
1141
1142define float @test_rootn_fast_f32_strictfp(float %x, i32 %y) #1 {
1143; CHECK-LABEL: define float @test_rootn_fast_f32_strictfp(
1144; CHECK-SAME: float [[X:%.*]], i32 [[Y:%.*]]) #[[ATTR0]] {
1145; CHECK-NEXT:  entry:
1146; CHECK-NEXT:    [[CALL:%.*]] = tail call fast float @_Z5rootnfi(float [[X]], i32 [[Y]]) #[[ATTR0]]
1147; CHECK-NEXT:    ret float [[CALL]]
1148;
1149entry:
1150  %call = tail call fast float @_Z5rootnfi(float %x, i32 %y) #1
1151  ret float %call
1152}
1153
1154define float @test_rootn_fast_f32__y_poison(float %x) {
1155; CHECK-LABEL: define float @test_rootn_fast_f32__y_poison(
1156; CHECK-SAME: float [[X:%.*]]) {
1157; CHECK-NEXT:    [[CALL:%.*]] = tail call fast float @_Z5rootnfi(float [[X]], i32 poison)
1158; CHECK-NEXT:    ret float [[CALL]]
1159;
1160  %call = tail call fast float @_Z5rootnfi(float %x, i32 poison)
1161  ret float %call
1162}
1163
1164define float @test_rootn_afn_nnan_ninf_f32__y_3(float %x) {
1165; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_3(
1166; CHECK-SAME: float [[X:%.*]]) {
1167; CHECK-NEXT:    [[__ROOTN2CBRT:%.*]] = call nnan ninf afn float @_Z4cbrtf(float [[X]])
1168; CHECK-NEXT:    ret float [[__ROOTN2CBRT]]
1169;
1170  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 3)
1171  ret float %call
1172}
1173
1174define float @test_rootn_afn_nnan_ninf_f32__y_neg3(float %x) {
1175; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_neg3(
1176; CHECK-SAME: float [[X:%.*]]) {
1177; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 -3)
1178; CHECK-NEXT:    ret float [[CALL]]
1179;
1180  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 -3)
1181  ret float %call
1182}
1183
1184define float @test_rootn_afn_nnan_ninf_f32__y_4(float %x) {
1185; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_4(
1186; CHECK-SAME: float [[X:%.*]]) {
1187; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 4)
1188; CHECK-NEXT:    ret float [[CALL]]
1189;
1190  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 4)
1191  ret float %call
1192}
1193
1194define float @test_rootn_afn_nnan_ninf_f32__y_neg4(float %x) {
1195; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_neg4(
1196; CHECK-SAME: float [[X:%.*]]) {
1197; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 -4)
1198; CHECK-NEXT:    ret float [[CALL]]
1199;
1200  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 -4)
1201  ret float %call
1202}
1203
1204define float @test_rootn_afn_nnan_ninf_f32__y_5(float %x) {
1205; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_5(
1206; CHECK-SAME: float [[X:%.*]]) {
1207; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 5)
1208; CHECK-NEXT:    ret float [[CALL]]
1209;
1210  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 5)
1211  ret float %call
1212}
1213
1214define float @test_rootn_afn_nnan_ninf_f32__y_neg5(float %x) {
1215; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_neg5(
1216; CHECK-SAME: float [[X:%.*]]) {
1217; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 -5)
1218; CHECK-NEXT:    ret float [[CALL]]
1219;
1220  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 -5)
1221  ret float %call
1222}
1223
1224define float @test_rootn_afn_nnan_ninf_f32__y_7(float %x) {
1225; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_7(
1226; CHECK-SAME: float [[X:%.*]]) {
1227; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 7)
1228; CHECK-NEXT:    ret float [[CALL]]
1229;
1230  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 7)
1231  ret float %call
1232}
1233
1234define float @test_rootn_afn_nnan_ninf_f32__y_neg7(float %x) {
1235; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_neg7(
1236; CHECK-SAME: float [[X:%.*]]) {
1237; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 -7)
1238; CHECK-NEXT:    ret float [[CALL]]
1239;
1240  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 -7)
1241  ret float %call
1242}
1243
1244define float @test_rootn_afn_nnan_ninf_f32__y_8(float %x) {
1245; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_8(
1246; CHECK-SAME: float [[X:%.*]]) {
1247; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 8)
1248; CHECK-NEXT:    ret float [[CALL]]
1249;
1250  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 8)
1251  ret float %call
1252}
1253
1254define float @test_rootn_afn_nnan_ninf_f32__y_neg8(float %x) {
1255; CHECK-LABEL: define float @test_rootn_afn_nnan_ninf_f32__y_neg8(
1256; CHECK-SAME: float [[X:%.*]]) {
1257; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 -8)
1258; CHECK-NEXT:    ret float [[CALL]]
1259;
1260  %call = tail call nnan ninf afn float @_Z5rootnfi(float %x, i32 -8)
1261  ret float %call
1262}
1263
1264define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_3(<2 x float> %x) {
1265; CHECK-LABEL: define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_3(
1266; CHECK-SAME: <2 x float> [[X:%.*]]) {
1267; CHECK-NEXT:  entry:
1268; CHECK-NEXT:    [[__ROOTN2CBRT:%.*]] = call nnan ninf afn <2 x float> @_Z4cbrtDv2_f(<2 x float> [[X]])
1269; CHECK-NEXT:    ret <2 x float> [[__ROOTN2CBRT]]
1270;
1271entry:
1272  %call = tail call afn nnan ninf <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 3, i32 3>)
1273  ret <2 x float> %call
1274}
1275
1276define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_4(<2 x float> %x) {
1277; CHECK-LABEL: define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_4(
1278; CHECK-SAME: <2 x float> [[X:%.*]]) {
1279; CHECK-NEXT:  entry:
1280; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> splat (i32 4))
1281; CHECK-NEXT:    ret <2 x float> [[CALL]]
1282;
1283entry:
1284  %call = tail call afn nnan ninf <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 4, i32 4>)
1285  ret <2 x float> %call
1286}
1287
1288define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_neg3(<2 x float> %x) {
1289; CHECK-LABEL: define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_neg3(
1290; CHECK-SAME: <2 x float> [[X:%.*]]) {
1291; CHECK-NEXT:  entry:
1292; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> splat (i32 -3))
1293; CHECK-NEXT:    ret <2 x float> [[CALL]]
1294;
1295entry:
1296  %call = tail call afn nnan ninf <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 -3, i32 -3>)
1297  ret <2 x float> %call
1298}
1299
1300define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_neg4(<2 x float> %x) {
1301; CHECK-LABEL: define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_neg4(
1302; CHECK-SAME: <2 x float> [[X:%.*]]) {
1303; CHECK-NEXT:  entry:
1304; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> splat (i32 -4))
1305; CHECK-NEXT:    ret <2 x float> [[CALL]]
1306;
1307entry:
1308  %call = tail call afn nnan ninf <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 -4, i32 -4>)
1309  ret <2 x float> %call
1310}
1311
1312define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_5(<2 x float> %x) {
1313; CHECK-LABEL: define <2 x float> @test_rootn_afn_nnan_ninf_v2f32__y_5(
1314; CHECK-SAME: <2 x float> [[X:%.*]]) {
1315; CHECK-NEXT:  entry:
1316; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> [[X]], <2 x i32> splat (i32 5))
1317; CHECK-NEXT:    ret <2 x float> [[CALL]]
1318;
1319entry:
1320  %call = tail call afn nnan ninf <2 x float> @_Z5rootnDv2_fDv2_i(<2 x float> %x, <2 x i32> <i32 5, i32 5>)
1321  ret <2 x float> %call
1322}
1323
1324define float @test_rootn_f32__x_known_positive(float nofpclass(ninf nsub nnorm) %x, i32 %y) {
1325; CHECK-LABEL: define float @test_rootn_f32__x_known_positive(
1326; CHECK-SAME: float nofpclass(ninf nsub nnorm) [[X:%.*]], i32 [[Y:%.*]]) {
1327; CHECK-NEXT:  entry:
1328; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 [[Y]])
1329; CHECK-NEXT:    ret float [[CALL]]
1330;
1331entry:
1332  %call = tail call float @_Z5rootnfi(float %x, i32 %y)
1333  ret float %call
1334}
1335
1336define float @test_rootn_afn_f32__x_known_positive(float nofpclass(ninf nsub nnorm) %x, i32 %y) {
1337; CHECK-LABEL: define float @test_rootn_afn_f32__x_known_positive(
1338; CHECK-SAME: float nofpclass(ninf nsub nnorm) [[X:%.*]], i32 [[Y:%.*]]) {
1339; CHECK-NEXT:  entry:
1340; CHECK-NEXT:    [[CALL:%.*]] = tail call afn float @_Z5rootnfi(float [[X]], i32 [[Y]])
1341; CHECK-NEXT:    ret float [[CALL]]
1342;
1343entry:
1344  %call = tail call afn float @_Z5rootnfi(float %x, i32 %y)
1345  ret float %call
1346}
1347
1348define float @test_rootn_afn_ninf_nnan_f32__x_known_positive(float nofpclass(ninf nsub nnorm) %x, i32 %y) {
1349; CHECK-LABEL: define float @test_rootn_afn_ninf_nnan_f32__x_known_positive(
1350; CHECK-SAME: float nofpclass(ninf nsub nnorm) [[X:%.*]], i32 [[Y:%.*]]) {
1351; CHECK-NEXT:  entry:
1352; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @_Z5rootnfi(float [[X]], i32 [[Y]])
1353; CHECK-NEXT:    ret float [[CALL]]
1354;
1355entry:
1356  %call = tail call afn ninf nnan float @_Z5rootnfi(float %x, i32 %y)
1357  ret float %call
1358}
1359
1360define float @test_rootn_afn_f32__x_known_positive__y_4(float nofpclass(ninf nsub nnorm) %x) {
1361; CHECK-LABEL: define float @test_rootn_afn_f32__x_known_positive__y_4(
1362; CHECK-SAME: float nofpclass(ninf nsub nnorm) [[X:%.*]]) {
1363; CHECK-NEXT:  entry:
1364; CHECK-NEXT:    [[CALL:%.*]] = tail call afn float @_Z5rootnfi(float [[X]], i32 4)
1365; CHECK-NEXT:    ret float [[CALL]]
1366;
1367entry:
1368  %call = tail call afn float @_Z5rootnfi(float %x, i32 4)
1369  ret float %call
1370}
1371
1372define float @test_rootn_f32__x_known_positive__y_4(float nofpclass(ninf nsub nnorm) %x) {
1373; CHECK-LABEL: define float @test_rootn_f32__x_known_positive__y_4(
1374; CHECK-SAME: float nofpclass(ninf nsub nnorm) [[X:%.*]]) {
1375; CHECK-NEXT:  entry:
1376; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 4)
1377; CHECK-NEXT:    ret float [[CALL]]
1378;
1379entry:
1380  %call = tail call float @_Z5rootnfi(float %x, i32 4)
1381  ret float %call
1382}
1383
1384define float @test_rootn_f32_y_known_even(float %x, i32 %y.arg) {
1385; CHECK-LABEL: define float @test_rootn_f32_y_known_even(
1386; CHECK-SAME: float [[X:%.*]], i32 [[Y_ARG:%.*]]) {
1387; CHECK-NEXT:  entry:
1388; CHECK-NEXT:    [[Y:%.*]] = shl i32 [[Y_ARG]], 1
1389; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 [[Y]])
1390; CHECK-NEXT:    ret float [[CALL]]
1391;
1392entry:
1393  %y = shl i32 %y.arg, 1
1394  %call = tail call float @_Z5rootnfi(float %x, i32 %y)
1395  ret float %call
1396}
1397
1398define float @test_fast_rootn_f32_y_known_even(float %x, i32 %y.arg) {
1399; CHECK-LABEL: define float @test_fast_rootn_f32_y_known_even(
1400; CHECK-SAME: float [[X:%.*]], i32 [[Y_ARG:%.*]]) {
1401; CHECK-NEXT:  entry:
1402; CHECK-NEXT:    [[Y:%.*]] = shl i32 [[Y_ARG]], 1
1403; CHECK-NEXT:    [[CALL:%.*]] = tail call fast float @_Z5rootnfi(float [[X]], i32 [[Y]])
1404; CHECK-NEXT:    ret float [[CALL]]
1405;
1406entry:
1407  %y = shl i32 %y.arg, 1
1408  %call = tail call fast float @_Z5rootnfi(float %x, i32 %y)
1409  ret float %call
1410}
1411
1412define float @test_fast_rootn_f32_known_positive_y_known_even(float nofpclass(ninf nsub nnorm) %x, i32 %y.arg) {
1413; CHECK-LABEL: define float @test_fast_rootn_f32_known_positive_y_known_even(
1414; CHECK-SAME: float nofpclass(ninf nsub nnorm) [[X:%.*]], i32 [[Y_ARG:%.*]]) {
1415; CHECK-NEXT:  entry:
1416; CHECK-NEXT:    [[Y:%.*]] = shl i32 [[Y_ARG]], 1
1417; CHECK-NEXT:    [[CALL:%.*]] = tail call fast float @_Z5rootnfi(float [[X]], i32 [[Y]])
1418; CHECK-NEXT:    ret float [[CALL]]
1419;
1420entry:
1421  %y = shl i32 %y.arg, 1
1422  %call = tail call fast float @_Z5rootnfi(float %x, i32 %y)
1423  ret float %call
1424}
1425
1426define float @test_rootn_f32__y_0_nobuiltin(float %x) {
1427; CHECK-LABEL: define float @test_rootn_f32__y_0_nobuiltin(
1428; CHECK-SAME: float [[X:%.*]]) {
1429; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 0) #[[ATTR4]]
1430; CHECK-NEXT:    ret float [[CALL]]
1431;
1432  %call = tail call float @_Z5rootnfi(float %x, i32 0) #0
1433  ret float %call
1434}
1435
1436define float @test_rootn_f32__y_1_nobuiltin(float %x) {
1437; CHECK-LABEL: define float @test_rootn_f32__y_1_nobuiltin(
1438; CHECK-SAME: float [[X:%.*]]) {
1439; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 1) #[[ATTR4]]
1440; CHECK-NEXT:    ret float [[CALL]]
1441;
1442  %call = tail call float @_Z5rootnfi(float %x, i32 1) #0
1443  ret float %call
1444}
1445
1446define float @test_rootn_f32__y_2_nobuiltin(float %x) {
1447; CHECK-LABEL: define float @test_rootn_f32__y_2_nobuiltin(
1448; CHECK-SAME: float [[X:%.*]]) {
1449; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 2) #[[ATTR4]]
1450; CHECK-NEXT:    ret float [[CALL]]
1451;
1452  %call = tail call float @_Z5rootnfi(float %x, i32 2) #0
1453  ret float %call
1454}
1455
1456define float @test_rootn_f32__y_3_nobuiltin(float %x) {
1457; CHECK-LABEL: define float @test_rootn_f32__y_3_nobuiltin(
1458; CHECK-SAME: float [[X:%.*]]) {
1459; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 3) #[[ATTR4]]
1460; CHECK-NEXT:    ret float [[CALL]]
1461;
1462  %call = tail call float @_Z5rootnfi(float %x, i32 3) #0
1463  ret float %call
1464}
1465
1466define float @test_rootn_f32__y_neg1_nobuiltin(float %x) {
1467; CHECK-LABEL: define float @test_rootn_f32__y_neg1_nobuiltin(
1468; CHECK-SAME: float [[X:%.*]]) {
1469; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 -1) #[[ATTR4]]
1470; CHECK-NEXT:    ret float [[CALL]]
1471;
1472  %call = tail call float @_Z5rootnfi(float %x, i32 -1) #0
1473  ret float %call
1474}
1475
1476define float @test_rootn_f32__y_neg2_nobuiltin(float %x) {
1477; CHECK-LABEL: define float @test_rootn_f32__y_neg2_nobuiltin(
1478; CHECK-SAME: float [[X:%.*]]) {
1479; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z5rootnfi(float [[X]], i32 -2) #[[ATTR4]]
1480; CHECK-NEXT:    ret float [[CALL]]
1481;
1482  %call = tail call float @_Z5rootnfi(float %x, i32 -2) #0
1483  ret float %call
1484}
1485
1486attributes #0 = { nobuiltin }
1487attributes #1 = { strictfp }
1488attributes #2 = { noinline }
1489
1490
1491!0 = !{float 3.0}
1492;.
1493; CHECK: attributes #[[ATTR0]] = { strictfp }
1494; CHECK: attributes #[[ATTR1:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
1495; CHECK: attributes #[[ATTR2:[0-9]+]] = { nounwind memory(read) }
1496; CHECK: attributes #[[ATTR3]] = { noinline }
1497; CHECK: attributes #[[ATTR4]] = { nobuiltin }
1498;.
1499; CHECK: [[META0]] = !{float 2.000000e+00}
1500; CHECK: [[META1]] = !{float 3.000000e+00}
1501;.
1502