xref: /llvm-project/clang/test/Headers/__clang_hip_math.hip (revision 7eca38ce76d5d1915f4ab7e665964062c0b37697)
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2// REQUIRES: amdgpu-registered-target
3
4// Test without OCML_BASIC_ROUNDED_OPERATIONS
5// RUN: %clang_cc1 -include __clang_hip_runtime_wrapper.h \
6// RUN:   -internal-isystem %S/../../lib/Headers/cuda_wrappers \
7// RUN:   -internal-isystem %S/Inputs/include \
8// RUN:   -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown \
9// RUN:   -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -O1 -o - \
10// RUN:   -D__HIPCC_RTC__ | FileCheck -check-prefixes=CHECK,DEFAULT %s
11
12// Check that we end up with fast math flags set on intrinsic calls
13// RUN: %clang_cc1 -include __clang_hip_runtime_wrapper.h \
14// RUN:   -internal-isystem %S/../../lib/Headers/cuda_wrappers \
15// RUN:   -internal-isystem %S/Inputs/include \
16// RUN:   -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown \
17// RUN:   -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -O1 -menable-no-infs \
18// RUN:   -menable-no-nans -o - \
19// RUN:   -D__HIPCC_RTC__ | FileCheck -check-prefixes=CHECK,FINITEONLY %s
20
21// Check that we end up with -fapprox-func set on intrinsic calls
22// RUN: %clang_cc1 -include __clang_hip_runtime_wrapper.h \
23// RUN:   -internal-isystem %S/../../lib/Headers/cuda_wrappers \
24// RUN:   -internal-isystem %S/Inputs/include \
25// RUN:   -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown \
26// RUN:   -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -O1 -fgpu-approx-transcendentals -o - \
27// RUN:   -D__HIPCC_RTC__ | FileCheck -check-prefixes=CHECK,APPROX %s
28
29#define BOOL_TYPE int
30typedef unsigned long long uint64_t;
31
32// CHECK-LABEL: @test___make_mantissa_base8(
33// CHECK-NEXT:  entry:
34// CHECK-NEXT:    br label [[WHILE_COND_I:%.*]]
35// CHECK:       while.cond.i:
36// CHECK-NEXT:    [[__TAGP_ADDR_0_I:%.*]] = phi ptr [ [[P:%.*]], [[ENTRY:%.*]] ], [ [[__TAGP_ADDR_1_I:%.*]], [[CLEANUP_I:%.*]] ]
37// CHECK-NEXT:    [[__R_0_I:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[__R_1_I:%.*]], [[CLEANUP_I]] ]
38// CHECK-NEXT:    [[TMP0:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I]], align 1, !tbaa [[TBAA4:![0-9]+]]
39// CHECK-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i8 [[TMP0]], 0
40// CHECK-NEXT:    br i1 [[CMP_NOT_I]], label [[_ZL21__MAKE_MANTISSA_BASE8PKC_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
41// CHECK:       while.body.i:
42// CHECK-NEXT:    [[TMP1:%.*]] = and i8 [[TMP0]], -8
43// CHECK-NEXT:    [[OR_COND_I:%.*]] = icmp eq i8 [[TMP1]], 48
44// CHECK-NEXT:    br i1 [[OR_COND_I]], label [[IF_THEN_I:%.*]], label [[CLEANUP_I]]
45// CHECK:       if.then.i:
46// CHECK-NEXT:    [[MUL_I:%.*]] = shl i64 [[__R_0_I]], 3
47// CHECK-NEXT:    [[CONV5_I:%.*]] = zext nneg i8 [[TMP0]] to i64
48// CHECK-NEXT:    [[ADD_I:%.*]] = add i64 [[MUL_I]], -48
49// CHECK-NEXT:    [[SUB_I:%.*]] = add i64 [[ADD_I]], [[CONV5_I]]
50// CHECK-NEXT:    [[INCDEC_PTR_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I]], i64 1
51// CHECK-NEXT:    br label [[CLEANUP_I]]
52// CHECK:       cleanup.i:
53// CHECK-NEXT:    [[__TAGP_ADDR_1_I]] = phi ptr [ [[INCDEC_PTR_I]], [[IF_THEN_I]] ], [ [[__TAGP_ADDR_0_I]], [[WHILE_BODY_I]] ]
54// CHECK-NEXT:    [[__R_1_I]] = phi i64 [ [[SUB_I]], [[IF_THEN_I]] ], [ [[__R_0_I]], [[WHILE_BODY_I]] ]
55// CHECK-NEXT:    br i1 [[OR_COND_I]], label [[WHILE_COND_I]], label [[_ZL21__MAKE_MANTISSA_BASE8PKC_EXIT]], !llvm.loop [[LOOP7:![0-9]+]]
56// CHECK:       _ZL21__make_mantissa_base8PKc.exit:
57// CHECK-NEXT:    [[RETVAL_2_I:%.*]] = phi i64 [ 0, [[CLEANUP_I]] ], [ [[__R_0_I]], [[WHILE_COND_I]] ]
58// CHECK-NEXT:    ret i64 [[RETVAL_2_I]]
59//
60extern "C" __device__ uint64_t test___make_mantissa_base8(const char *p) {
61  return __make_mantissa_base8(p);
62}
63
64// CHECK-LABEL: @test___make_mantissa_base10(
65// CHECK-NEXT:  entry:
66// CHECK-NEXT:    br label [[WHILE_COND_I:%.*]]
67// CHECK:       while.cond.i:
68// CHECK-NEXT:    [[__TAGP_ADDR_0_I:%.*]] = phi ptr [ [[P:%.*]], [[ENTRY:%.*]] ], [ [[__TAGP_ADDR_1_I:%.*]], [[CLEANUP_I:%.*]] ]
69// CHECK-NEXT:    [[__R_0_I:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[__R_1_I:%.*]], [[CLEANUP_I]] ]
70// CHECK-NEXT:    [[TMP0:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I]], align 1, !tbaa [[TBAA4]]
71// CHECK-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i8 [[TMP0]], 0
72// CHECK-NEXT:    br i1 [[CMP_NOT_I]], label [[_ZL22__MAKE_MANTISSA_BASE10PKC_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
73// CHECK:       while.body.i:
74// CHECK-NEXT:    [[TMP1:%.*]] = add i8 [[TMP0]], -48
75// CHECK-NEXT:    [[OR_COND_I:%.*]] = icmp ult i8 [[TMP1]], 10
76// CHECK-NEXT:    br i1 [[OR_COND_I]], label [[IF_THEN_I:%.*]], label [[CLEANUP_I]]
77// CHECK:       if.then.i:
78// CHECK-NEXT:    [[MUL_I:%.*]] = mul i64 [[__R_0_I]], 10
79// CHECK-NEXT:    [[CONV5_I:%.*]] = zext nneg i8 [[TMP0]] to i64
80// CHECK-NEXT:    [[ADD_I:%.*]] = add i64 [[MUL_I]], -48
81// CHECK-NEXT:    [[SUB_I:%.*]] = add i64 [[ADD_I]], [[CONV5_I]]
82// CHECK-NEXT:    [[INCDEC_PTR_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I]], i64 1
83// CHECK-NEXT:    br label [[CLEANUP_I]]
84// CHECK:       cleanup.i:
85// CHECK-NEXT:    [[__TAGP_ADDR_1_I]] = phi ptr [ [[INCDEC_PTR_I]], [[IF_THEN_I]] ], [ [[__TAGP_ADDR_0_I]], [[WHILE_BODY_I]] ]
86// CHECK-NEXT:    [[__R_1_I]] = phi i64 [ [[SUB_I]], [[IF_THEN_I]] ], [ [[__R_0_I]], [[WHILE_BODY_I]] ]
87// CHECK-NEXT:    br i1 [[OR_COND_I]], label [[WHILE_COND_I]], label [[_ZL22__MAKE_MANTISSA_BASE10PKC_EXIT]], !llvm.loop [[LOOP10:![0-9]+]]
88// CHECK:       _ZL22__make_mantissa_base10PKc.exit:
89// CHECK-NEXT:    [[RETVAL_2_I:%.*]] = phi i64 [ 0, [[CLEANUP_I]] ], [ [[__R_0_I]], [[WHILE_COND_I]] ]
90// CHECK-NEXT:    ret i64 [[RETVAL_2_I]]
91//
92extern "C" __device__ uint64_t test___make_mantissa_base10(const char *p) {
93  return __make_mantissa_base10(p);
94}
95
96// CHECK-LABEL: @test___make_mantissa_base16(
97// CHECK-NEXT:  entry:
98// CHECK-NEXT:    br label [[WHILE_COND_I:%.*]]
99// CHECK:       while.cond.i:
100// CHECK-NEXT:    [[__TAGP_ADDR_0_I:%.*]] = phi ptr [ [[P:%.*]], [[ENTRY:%.*]] ], [ [[__TAGP_ADDR_1_I:%.*]], [[CLEANUP_I:%.*]] ]
101// CHECK-NEXT:    [[__R_0_I:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ [[__R_2_I:%.*]], [[CLEANUP_I]] ]
102// CHECK-NEXT:    [[TMP0:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I]], align 1, !tbaa [[TBAA4]]
103// CHECK-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i8 [[TMP0]], 0
104// CHECK-NEXT:    br i1 [[CMP_NOT_I]], label [[_ZL22__MAKE_MANTISSA_BASE16PKC_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
105// CHECK:       while.body.i:
106// CHECK-NEXT:    [[TMP1:%.*]] = add i8 [[TMP0]], -48
107// CHECK-NEXT:    [[OR_COND_I:%.*]] = icmp ult i8 [[TMP1]], 10
108// CHECK-NEXT:    br i1 [[OR_COND_I]], label [[IF_END31_I:%.*]], label [[IF_ELSE_I:%.*]]
109// CHECK:       if.else.i:
110// CHECK-NEXT:    [[TMP2:%.*]] = add i8 [[TMP0]], -97
111// CHECK-NEXT:    [[OR_COND33_I:%.*]] = icmp ult i8 [[TMP2]], 6
112// CHECK-NEXT:    br i1 [[OR_COND33_I]], label [[IF_END31_I]], label [[IF_ELSE17_I:%.*]]
113// CHECK:       if.else17.i:
114// CHECK-NEXT:    [[TMP3:%.*]] = add i8 [[TMP0]], -65
115// CHECK-NEXT:    [[OR_COND34_I:%.*]] = icmp ult i8 [[TMP3]], 6
116// CHECK-NEXT:    br i1 [[OR_COND34_I]], label [[IF_END31_I]], label [[CLEANUP_I]]
117// CHECK:       if.end31.i:
118// CHECK-NEXT:    [[DOTSINK:%.*]] = phi i64 [ -48, [[WHILE_BODY_I]] ], [ -87, [[IF_ELSE_I]] ], [ -55, [[IF_ELSE17_I]] ]
119// CHECK-NEXT:    [[MUL24_I:%.*]] = shl i64 [[__R_0_I]], 4
120// CHECK-NEXT:    [[CONV25_I:%.*]] = zext nneg i8 [[TMP0]] to i64
121// CHECK-NEXT:    [[ADD26_I:%.*]] = add i64 [[MUL24_I]], [[DOTSINK]]
122// CHECK-NEXT:    [[ADD28_I:%.*]] = add i64 [[ADD26_I]], [[CONV25_I]]
123// CHECK-NEXT:    [[INCDEC_PTR_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I]], i64 1
124// CHECK-NEXT:    br label [[CLEANUP_I]]
125// CHECK:       cleanup.i:
126// CHECK-NEXT:    [[__TAGP_ADDR_1_I]] = phi ptr [ [[INCDEC_PTR_I]], [[IF_END31_I]] ], [ [[__TAGP_ADDR_0_I]], [[IF_ELSE17_I]] ]
127// CHECK-NEXT:    [[__R_2_I]] = phi i64 [ [[ADD28_I]], [[IF_END31_I]] ], [ [[__R_0_I]], [[IF_ELSE17_I]] ]
128// CHECK-NEXT:    [[COND_I:%.*]] = phi i1 [ true, [[IF_END31_I]] ], [ false, [[IF_ELSE17_I]] ]
129// CHECK-NEXT:    br i1 [[COND_I]], label [[WHILE_COND_I]], label [[_ZL22__MAKE_MANTISSA_BASE16PKC_EXIT]], !llvm.loop [[LOOP11:![0-9]+]]
130// CHECK:       _ZL22__make_mantissa_base16PKc.exit:
131// CHECK-NEXT:    [[RETVAL_2_I:%.*]] = phi i64 [ 0, [[CLEANUP_I]] ], [ [[__R_0_I]], [[WHILE_COND_I]] ]
132// CHECK-NEXT:    ret i64 [[RETVAL_2_I]]
133//
134extern "C" __device__ uint64_t test___make_mantissa_base16(const char *p) {
135  return __make_mantissa_base16(p);
136}
137
138// CHECK-LABEL: @test___make_mantissa(
139// CHECK-NEXT:  entry:
140// CHECK-NEXT:    [[TMP0:%.*]] = load i8, ptr [[P:%.*]], align 1, !tbaa [[TBAA4]]
141// CHECK-NEXT:    [[CMP_I:%.*]] = icmp eq i8 [[TMP0]], 48
142// CHECK-NEXT:    br i1 [[CMP_I]], label [[IF_THEN_I:%.*]], label [[WHILE_COND_I14_I:%.*]]
143// CHECK:       if.then.i:
144// CHECK-NEXT:    [[INCDEC_PTR_I:%.*]] = getelementptr inbounds nuw i8, ptr [[P]], i64 1
145// CHECK-NEXT:    [[TMP1:%.*]] = load i8, ptr [[INCDEC_PTR_I]], align 1, !tbaa [[TBAA4]]
146// CHECK-NEXT:    switch i8 [[TMP1]], label [[WHILE_COND_I_I:%.*]] [
147// CHECK-NEXT:      i8 120, label [[WHILE_COND_I30_I_PREHEADER:%.*]]
148// CHECK-NEXT:      i8 88, label [[WHILE_COND_I30_I_PREHEADER]]
149// CHECK-NEXT:    ]
150// CHECK:       while.cond.i30.i.preheader:
151// CHECK-NEXT:    br label [[WHILE_COND_I30_I:%.*]]
152// CHECK:       while.cond.i30.i:
153// CHECK-NEXT:    [[__TAGP_ADDR_0_I31_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I37_I:%.*]], [[CLEANUP_I36_I:%.*]] ], [ [[INCDEC_PTR_I]], [[WHILE_COND_I30_I_PREHEADER]] ]
154// CHECK-NEXT:    [[__R_0_I32_I:%.*]] = phi i64 [ [[__R_2_I_I:%.*]], [[CLEANUP_I36_I]] ], [ 0, [[WHILE_COND_I30_I_PREHEADER]] ]
155// CHECK-NEXT:    [[TMP2:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I31_I]], align 1, !tbaa [[TBAA4]]
156// CHECK-NEXT:    [[CMP_NOT_I33_I:%.*]] = icmp eq i8 [[TMP2]], 0
157// CHECK-NEXT:    br i1 [[CMP_NOT_I33_I]], label [[_ZL15__MAKE_MANTISSAPKC_EXIT:%.*]], label [[WHILE_BODY_I34_I:%.*]]
158// CHECK:       while.body.i34.i:
159// CHECK-NEXT:    [[TMP3:%.*]] = add i8 [[TMP2]], -48
160// CHECK-NEXT:    [[OR_COND_I35_I:%.*]] = icmp ult i8 [[TMP3]], 10
161// CHECK-NEXT:    br i1 [[OR_COND_I35_I]], label [[IF_END31_I_I:%.*]], label [[IF_ELSE_I_I:%.*]]
162// CHECK:       if.else.i.i:
163// CHECK-NEXT:    [[TMP4:%.*]] = add i8 [[TMP2]], -97
164// CHECK-NEXT:    [[OR_COND33_I_I:%.*]] = icmp ult i8 [[TMP4]], 6
165// CHECK-NEXT:    br i1 [[OR_COND33_I_I]], label [[IF_END31_I_I]], label [[IF_ELSE17_I_I:%.*]]
166// CHECK:       if.else17.i.i:
167// CHECK-NEXT:    [[TMP5:%.*]] = add i8 [[TMP2]], -65
168// CHECK-NEXT:    [[OR_COND34_I_I:%.*]] = icmp ult i8 [[TMP5]], 6
169// CHECK-NEXT:    br i1 [[OR_COND34_I_I]], label [[IF_END31_I_I]], label [[CLEANUP_I36_I]]
170// CHECK:       if.end31.i.i:
171// CHECK-NEXT:    [[DOTSINK:%.*]] = phi i64 [ -48, [[WHILE_BODY_I34_I]] ], [ -87, [[IF_ELSE_I_I]] ], [ -55, [[IF_ELSE17_I_I]] ]
172// CHECK-NEXT:    [[MUL24_I_I:%.*]] = shl i64 [[__R_0_I32_I]], 4
173// CHECK-NEXT:    [[CONV25_I_I:%.*]] = zext nneg i8 [[TMP2]] to i64
174// CHECK-NEXT:    [[ADD26_I_I:%.*]] = add i64 [[MUL24_I_I]], [[DOTSINK]]
175// CHECK-NEXT:    [[ADD28_I_I:%.*]] = add i64 [[ADD26_I_I]], [[CONV25_I_I]]
176// CHECK-NEXT:    [[INCDEC_PTR_I40_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I31_I]], i64 1
177// CHECK-NEXT:    br label [[CLEANUP_I36_I]]
178// CHECK:       cleanup.i36.i:
179// CHECK-NEXT:    [[__TAGP_ADDR_1_I37_I]] = phi ptr [ [[INCDEC_PTR_I40_I]], [[IF_END31_I_I]] ], [ [[__TAGP_ADDR_0_I31_I]], [[IF_ELSE17_I_I]] ]
180// CHECK-NEXT:    [[__R_2_I_I]] = phi i64 [ [[ADD28_I_I]], [[IF_END31_I_I]] ], [ [[__R_0_I32_I]], [[IF_ELSE17_I_I]] ]
181// CHECK-NEXT:    [[COND_I_I:%.*]] = phi i1 [ true, [[IF_END31_I_I]] ], [ false, [[IF_ELSE17_I_I]] ]
182// CHECK-NEXT:    br i1 [[COND_I_I]], label [[WHILE_COND_I30_I]], label [[_ZL15__MAKE_MANTISSAPKC_EXIT]], !llvm.loop [[LOOP11]]
183// CHECK:       while.cond.i.i:
184// CHECK-NEXT:    [[__TAGP_ADDR_0_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I_I:%.*]], [[CLEANUP_I_I:%.*]] ], [ [[INCDEC_PTR_I]], [[IF_THEN_I]] ]
185// CHECK-NEXT:    [[__R_0_I_I:%.*]] = phi i64 [ [[__R_1_I_I:%.*]], [[CLEANUP_I_I]] ], [ 0, [[IF_THEN_I]] ]
186// CHECK-NEXT:    [[TMP6:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I_I]], align 1, !tbaa [[TBAA4]]
187// CHECK-NEXT:    [[CMP_NOT_I_I:%.*]] = icmp eq i8 [[TMP6]], 0
188// CHECK-NEXT:    br i1 [[CMP_NOT_I_I]], label [[_ZL15__MAKE_MANTISSAPKC_EXIT]], label [[WHILE_BODY_I_I:%.*]]
189// CHECK:       while.body.i.i:
190// CHECK-NEXT:    [[TMP7:%.*]] = and i8 [[TMP6]], -8
191// CHECK-NEXT:    [[OR_COND_I_I:%.*]] = icmp eq i8 [[TMP7]], 48
192// CHECK-NEXT:    br i1 [[OR_COND_I_I]], label [[IF_THEN_I_I:%.*]], label [[CLEANUP_I_I]]
193// CHECK:       if.then.i.i:
194// CHECK-NEXT:    [[MUL_I_I:%.*]] = shl i64 [[__R_0_I_I]], 3
195// CHECK-NEXT:    [[CONV5_I_I:%.*]] = zext nneg i8 [[TMP6]] to i64
196// CHECK-NEXT:    [[ADD_I_I:%.*]] = add i64 [[MUL_I_I]], -48
197// CHECK-NEXT:    [[SUB_I_I:%.*]] = add i64 [[ADD_I_I]], [[CONV5_I_I]]
198// CHECK-NEXT:    [[INCDEC_PTR_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I_I]], i64 1
199// CHECK-NEXT:    br label [[CLEANUP_I_I]]
200// CHECK:       cleanup.i.i:
201// CHECK-NEXT:    [[__TAGP_ADDR_1_I_I]] = phi ptr [ [[INCDEC_PTR_I_I]], [[IF_THEN_I_I]] ], [ [[__TAGP_ADDR_0_I_I]], [[WHILE_BODY_I_I]] ]
202// CHECK-NEXT:    [[__R_1_I_I]] = phi i64 [ [[SUB_I_I]], [[IF_THEN_I_I]] ], [ [[__R_0_I_I]], [[WHILE_BODY_I_I]] ]
203// CHECK-NEXT:    br i1 [[OR_COND_I_I]], label [[WHILE_COND_I_I]], label [[_ZL15__MAKE_MANTISSAPKC_EXIT]], !llvm.loop [[LOOP7]]
204// CHECK:       while.cond.i14.i:
205// CHECK-NEXT:    [[__TAGP_ADDR_0_I15_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I21_I:%.*]], [[CLEANUP_I20_I:%.*]] ], [ [[P]], [[ENTRY:%.*]] ]
206// CHECK-NEXT:    [[__R_0_I16_I:%.*]] = phi i64 [ [[__R_1_I22_I:%.*]], [[CLEANUP_I20_I]] ], [ 0, [[ENTRY]] ]
207// CHECK-NEXT:    [[TMP8:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I15_I]], align 1, !tbaa [[TBAA4]]
208// CHECK-NEXT:    [[CMP_NOT_I17_I:%.*]] = icmp eq i8 [[TMP8]], 0
209// CHECK-NEXT:    br i1 [[CMP_NOT_I17_I]], label [[_ZL15__MAKE_MANTISSAPKC_EXIT]], label [[WHILE_BODY_I18_I:%.*]]
210// CHECK:       while.body.i18.i:
211// CHECK-NEXT:    [[TMP9:%.*]] = add i8 [[TMP8]], -48
212// CHECK-NEXT:    [[OR_COND_I19_I:%.*]] = icmp ult i8 [[TMP9]], 10
213// CHECK-NEXT:    br i1 [[OR_COND_I19_I]], label [[IF_THEN_I24_I:%.*]], label [[CLEANUP_I20_I]]
214// CHECK:       if.then.i24.i:
215// CHECK-NEXT:    [[MUL_I25_I:%.*]] = mul i64 [[__R_0_I16_I]], 10
216// CHECK-NEXT:    [[CONV5_I26_I:%.*]] = zext nneg i8 [[TMP8]] to i64
217// CHECK-NEXT:    [[ADD_I27_I:%.*]] = add i64 [[MUL_I25_I]], -48
218// CHECK-NEXT:    [[SUB_I28_I:%.*]] = add i64 [[ADD_I27_I]], [[CONV5_I26_I]]
219// CHECK-NEXT:    [[INCDEC_PTR_I29_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I15_I]], i64 1
220// CHECK-NEXT:    br label [[CLEANUP_I20_I]]
221// CHECK:       cleanup.i20.i:
222// CHECK-NEXT:    [[__TAGP_ADDR_1_I21_I]] = phi ptr [ [[INCDEC_PTR_I29_I]], [[IF_THEN_I24_I]] ], [ [[__TAGP_ADDR_0_I15_I]], [[WHILE_BODY_I18_I]] ]
223// CHECK-NEXT:    [[__R_1_I22_I]] = phi i64 [ [[SUB_I28_I]], [[IF_THEN_I24_I]] ], [ [[__R_0_I16_I]], [[WHILE_BODY_I18_I]] ]
224// CHECK-NEXT:    br i1 [[OR_COND_I19_I]], label [[WHILE_COND_I14_I]], label [[_ZL15__MAKE_MANTISSAPKC_EXIT]], !llvm.loop [[LOOP10]]
225// CHECK:       _ZL15__make_mantissaPKc.exit:
226// CHECK-NEXT:    [[RETVAL_0_I:%.*]] = phi i64 [ 0, [[CLEANUP_I_I]] ], [ [[__R_0_I_I]], [[WHILE_COND_I_I]] ], [ 0, [[CLEANUP_I36_I]] ], [ [[__R_0_I32_I]], [[WHILE_COND_I30_I]] ], [ 0, [[CLEANUP_I20_I]] ], [ [[__R_0_I16_I]], [[WHILE_COND_I14_I]] ]
227// CHECK-NEXT:    ret i64 [[RETVAL_0_I]]
228//
229extern "C" __device__ uint64_t test___make_mantissa(const char *p) {
230  return __make_mantissa(p);
231}
232
233// CHECK-LABEL: @test_abs(
234// CHECK-NEXT:  entry:
235// CHECK-NEXT:    [[TMP0:%.*]] = tail call noundef range(i32 0, -2147483648) i32 @llvm.abs.i32(i32 [[X:%.*]], i1 true)
236// CHECK-NEXT:    ret i32 [[TMP0]]
237//
238extern "C" __device__ int test_abs(int x) {
239  return abs(x);
240}
241
242// CHECK-LABEL: @test_labs(
243// CHECK-NEXT:  entry:
244// CHECK-NEXT:    [[TMP0:%.*]] = tail call noundef range(i64 0, -9223372036854775808) i64 @llvm.abs.i64(i64 [[X:%.*]], i1 true)
245// CHECK-NEXT:    ret i64 [[TMP0]]
246//
247extern "C" __device__ long test_labs(long x) {
248  return labs(x);
249}
250
251// CHECK-LABEL: @test_llabs(
252// CHECK-NEXT:  entry:
253// CHECK-NEXT:    [[TMP0:%.*]] = tail call noundef range(i64 0, -9223372036854775808) i64 @llvm.abs.i64(i64 [[X:%.*]], i1 true)
254// CHECK-NEXT:    ret i64 [[TMP0]]
255//
256extern "C" __device__ long long test_llabs(long x) {
257  return llabs(x);
258}
259
260// DEFAULT-LABEL: @test_acosf(
261// DEFAULT-NEXT:  entry:
262// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acos_f32(float noundef [[X:%.*]]) #[[ATTR12:[0-9]+]]
263// DEFAULT-NEXT:    ret float [[CALL_I]]
264//
265// FINITEONLY-LABEL: @test_acosf(
266// FINITEONLY-NEXT:  entry:
267// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_acos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12:[0-9]+]]
268// FINITEONLY-NEXT:    ret float [[CALL_I]]
269//
270// APPROX-LABEL: @test_acosf(
271// APPROX-NEXT:  entry:
272// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acos_f32(float noundef [[X:%.*]]) #[[ATTR12:[0-9]+]]
273// APPROX-NEXT:    ret float [[CALL_I]]
274//
275extern "C" __device__ float test_acosf(float x) {
276  return acosf(x);
277}
278
279// DEFAULT-LABEL: @test_acos(
280// DEFAULT-NEXT:  entry:
281// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acos_f64(double noundef [[X:%.*]]) #[[ATTR12]]
282// DEFAULT-NEXT:    ret double [[CALL_I]]
283//
284// FINITEONLY-LABEL: @test_acos(
285// FINITEONLY-NEXT:  entry:
286// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_acos_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
287// FINITEONLY-NEXT:    ret double [[CALL_I]]
288//
289// APPROX-LABEL: @test_acos(
290// APPROX-NEXT:  entry:
291// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acos_f64(double noundef [[X:%.*]]) #[[ATTR12]]
292// APPROX-NEXT:    ret double [[CALL_I]]
293//
294extern "C" __device__ double test_acos(double x) {
295  return acos(x);
296}
297
298// DEFAULT-LABEL: @test_acoshf(
299// DEFAULT-NEXT:  entry:
300// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acosh_f32(float noundef [[X:%.*]]) #[[ATTR13:[0-9]+]]
301// DEFAULT-NEXT:    ret float [[CALL_I]]
302//
303// FINITEONLY-LABEL: @test_acoshf(
304// FINITEONLY-NEXT:  entry:
305// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_acosh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13:[0-9]+]]
306// FINITEONLY-NEXT:    ret float [[CALL_I]]
307//
308// APPROX-LABEL: @test_acoshf(
309// APPROX-NEXT:  entry:
310// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_acosh_f32(float noundef [[X:%.*]]) #[[ATTR13:[0-9]+]]
311// APPROX-NEXT:    ret float [[CALL_I]]
312//
313extern "C" __device__ float test_acoshf(float x) {
314  return acoshf(x);
315}
316
317// DEFAULT-LABEL: @test_acosh(
318// DEFAULT-NEXT:  entry:
319// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acosh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
320// DEFAULT-NEXT:    ret double [[CALL_I]]
321//
322// FINITEONLY-LABEL: @test_acosh(
323// FINITEONLY-NEXT:  entry:
324// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_acosh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
325// FINITEONLY-NEXT:    ret double [[CALL_I]]
326//
327// APPROX-LABEL: @test_acosh(
328// APPROX-NEXT:  entry:
329// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_acosh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
330// APPROX-NEXT:    ret double [[CALL_I]]
331//
332extern "C" __device__ double test_acosh(double x) {
333  return acosh(x);
334}
335
336// DEFAULT-LABEL: @test_asinf(
337// DEFAULT-NEXT:  entry:
338// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asin_f32(float noundef [[X:%.*]]) #[[ATTR12]]
339// DEFAULT-NEXT:    ret float [[CALL_I]]
340//
341// FINITEONLY-LABEL: @test_asinf(
342// FINITEONLY-NEXT:  entry:
343// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_asin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
344// FINITEONLY-NEXT:    ret float [[CALL_I]]
345//
346// APPROX-LABEL: @test_asinf(
347// APPROX-NEXT:  entry:
348// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asin_f32(float noundef [[X:%.*]]) #[[ATTR12]]
349// APPROX-NEXT:    ret float [[CALL_I]]
350//
351extern "C" __device__ float test_asinf(float x) {
352  return asinf(x);
353}
354
355// DEFAULT-LABEL: @test_asin(
356// DEFAULT-NEXT:  entry:
357// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asin_f64(double noundef [[X:%.*]]) #[[ATTR12]]
358// DEFAULT-NEXT:    ret double [[CALL_I]]
359//
360// FINITEONLY-LABEL: @test_asin(
361// FINITEONLY-NEXT:  entry:
362// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_asin_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
363// FINITEONLY-NEXT:    ret double [[CALL_I]]
364//
365// APPROX-LABEL: @test_asin(
366// APPROX-NEXT:  entry:
367// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asin_f64(double noundef [[X:%.*]]) #[[ATTR12]]
368// APPROX-NEXT:    ret double [[CALL_I]]
369//
370extern "C" __device__ double test_asin(double x) {
371
372  return asin(x);
373}
374
375// DEFAULT-LABEL: @test_asinhf(
376// DEFAULT-NEXT:  entry:
377// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asinh_f32(float noundef [[X:%.*]]) #[[ATTR13]]
378// DEFAULT-NEXT:    ret float [[CALL_I]]
379//
380// FINITEONLY-LABEL: @test_asinhf(
381// FINITEONLY-NEXT:  entry:
382// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_asinh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
383// FINITEONLY-NEXT:    ret float [[CALL_I]]
384//
385// APPROX-LABEL: @test_asinhf(
386// APPROX-NEXT:  entry:
387// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_asinh_f32(float noundef [[X:%.*]]) #[[ATTR13]]
388// APPROX-NEXT:    ret float [[CALL_I]]
389//
390extern "C" __device__ float test_asinhf(float x) {
391  return asinhf(x);
392}
393
394// DEFAULT-LABEL: @test_asinh(
395// DEFAULT-NEXT:  entry:
396// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asinh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
397// DEFAULT-NEXT:    ret double [[CALL_I]]
398//
399// FINITEONLY-LABEL: @test_asinh(
400// FINITEONLY-NEXT:  entry:
401// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_asinh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
402// FINITEONLY-NEXT:    ret double [[CALL_I]]
403//
404// APPROX-LABEL: @test_asinh(
405// APPROX-NEXT:  entry:
406// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_asinh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
407// APPROX-NEXT:    ret double [[CALL_I]]
408//
409extern "C" __device__ double test_asinh(double x) {
410  return asinh(x);
411}
412
413// DEFAULT-LABEL: @test_atan2f(
414// DEFAULT-NEXT:  entry:
415// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan2_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
416// DEFAULT-NEXT:    ret float [[CALL_I]]
417//
418// FINITEONLY-LABEL: @test_atan2f(
419// FINITEONLY-NEXT:  entry:
420// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atan2_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
421// FINITEONLY-NEXT:    ret float [[CALL_I]]
422//
423// APPROX-LABEL: @test_atan2f(
424// APPROX-NEXT:  entry:
425// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan2_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
426// APPROX-NEXT:    ret float [[CALL_I]]
427//
428extern "C" __device__ float test_atan2f(float x, float y) {
429  return atan2f(x, y);
430}
431
432// DEFAULT-LABEL: @test_atan2(
433// DEFAULT-NEXT:  entry:
434// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan2_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
435// DEFAULT-NEXT:    ret double [[CALL_I]]
436//
437// FINITEONLY-LABEL: @test_atan2(
438// FINITEONLY-NEXT:  entry:
439// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atan2_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
440// FINITEONLY-NEXT:    ret double [[CALL_I]]
441//
442// APPROX-LABEL: @test_atan2(
443// APPROX-NEXT:  entry:
444// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan2_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
445// APPROX-NEXT:    ret double [[CALL_I]]
446//
447extern "C" __device__ double test_atan2(double x, double y) {
448  return atan2(x, y);
449}
450
451// DEFAULT-LABEL: @test_atanf(
452// DEFAULT-NEXT:  entry:
453// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan_f32(float noundef [[X:%.*]]) #[[ATTR12]]
454// DEFAULT-NEXT:    ret float [[CALL_I]]
455//
456// FINITEONLY-LABEL: @test_atanf(
457// FINITEONLY-NEXT:  entry:
458// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atan_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
459// FINITEONLY-NEXT:    ret float [[CALL_I]]
460//
461// APPROX-LABEL: @test_atanf(
462// APPROX-NEXT:  entry:
463// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atan_f32(float noundef [[X:%.*]]) #[[ATTR12]]
464// APPROX-NEXT:    ret float [[CALL_I]]
465//
466extern "C" __device__ float test_atanf(float x) {
467  return atanf(x);
468}
469
470// DEFAULT-LABEL: @test_atan(
471// DEFAULT-NEXT:  entry:
472// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan_f64(double noundef [[X:%.*]]) #[[ATTR12]]
473// DEFAULT-NEXT:    ret double [[CALL_I]]
474//
475// FINITEONLY-LABEL: @test_atan(
476// FINITEONLY-NEXT:  entry:
477// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atan_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
478// FINITEONLY-NEXT:    ret double [[CALL_I]]
479//
480// APPROX-LABEL: @test_atan(
481// APPROX-NEXT:  entry:
482// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atan_f64(double noundef [[X:%.*]]) #[[ATTR12]]
483// APPROX-NEXT:    ret double [[CALL_I]]
484//
485extern "C" __device__ double test_atan(double x) {
486  return atan(x);
487}
488
489// DEFAULT-LABEL: @test_atanhf(
490// DEFAULT-NEXT:  entry:
491// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atanh_f32(float noundef [[X:%.*]]) #[[ATTR13]]
492// DEFAULT-NEXT:    ret float [[CALL_I]]
493//
494// FINITEONLY-LABEL: @test_atanhf(
495// FINITEONLY-NEXT:  entry:
496// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_atanh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
497// FINITEONLY-NEXT:    ret float [[CALL_I]]
498//
499// APPROX-LABEL: @test_atanhf(
500// APPROX-NEXT:  entry:
501// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_atanh_f32(float noundef [[X:%.*]]) #[[ATTR13]]
502// APPROX-NEXT:    ret float [[CALL_I]]
503//
504extern "C" __device__ float test_atanhf(float x) {
505  return atanhf(x);
506}
507
508// DEFAULT-LABEL: @test_atanh(
509// DEFAULT-NEXT:  entry:
510// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atanh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
511// DEFAULT-NEXT:    ret double [[CALL_I]]
512//
513// FINITEONLY-LABEL: @test_atanh(
514// FINITEONLY-NEXT:  entry:
515// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_atanh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
516// FINITEONLY-NEXT:    ret double [[CALL_I]]
517//
518// APPROX-LABEL: @test_atanh(
519// APPROX-NEXT:  entry:
520// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_atanh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
521// APPROX-NEXT:    ret double [[CALL_I]]
522//
523extern "C" __device__ double test_atanh(double x) {
524  return atanh(x);
525}
526
527// DEFAULT-LABEL: @test_cbrtf(
528// DEFAULT-NEXT:  entry:
529// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cbrt_f32(float noundef [[X:%.*]]) #[[ATTR13]]
530// DEFAULT-NEXT:    ret float [[CALL_I]]
531//
532// FINITEONLY-LABEL: @test_cbrtf(
533// FINITEONLY-NEXT:  entry:
534// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cbrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
535// FINITEONLY-NEXT:    ret float [[CALL_I]]
536//
537// APPROX-LABEL: @test_cbrtf(
538// APPROX-NEXT:  entry:
539// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cbrt_f32(float noundef [[X:%.*]]) #[[ATTR13]]
540// APPROX-NEXT:    ret float [[CALL_I]]
541//
542extern "C" __device__ float test_cbrtf(float x) {
543  return cbrtf(x);
544}
545
546// DEFAULT-LABEL: @test_cbrt(
547// DEFAULT-NEXT:  entry:
548// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cbrt_f64(double noundef [[X:%.*]]) #[[ATTR13]]
549// DEFAULT-NEXT:    ret double [[CALL_I]]
550//
551// FINITEONLY-LABEL: @test_cbrt(
552// FINITEONLY-NEXT:  entry:
553// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cbrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
554// FINITEONLY-NEXT:    ret double [[CALL_I]]
555//
556// APPROX-LABEL: @test_cbrt(
557// APPROX-NEXT:  entry:
558// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cbrt_f64(double noundef [[X:%.*]]) #[[ATTR13]]
559// APPROX-NEXT:    ret double [[CALL_I]]
560//
561extern "C" __device__ double test_cbrt(double x) {
562  return cbrt(x);
563}
564
565// DEFAULT-LABEL: @test_ceilf(
566// DEFAULT-NEXT:  entry:
567// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.ceil.f32(float [[X:%.*]])
568// DEFAULT-NEXT:    ret float [[TMP0]]
569//
570// FINITEONLY-LABEL: @test_ceilf(
571// FINITEONLY-NEXT:  entry:
572// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.ceil.f32(float [[X:%.*]])
573// FINITEONLY-NEXT:    ret float [[TMP0]]
574//
575// APPROX-LABEL: @test_ceilf(
576// APPROX-NEXT:  entry:
577// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.ceil.f32(float [[X:%.*]])
578// APPROX-NEXT:    ret float [[TMP0]]
579//
580extern "C" __device__ float test_ceilf(float x) {
581  return ceilf(x);
582}
583
584// DEFAULT-LABEL: @test_ceil(
585// DEFAULT-NEXT:  entry:
586// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.ceil.f64(double [[X:%.*]])
587// DEFAULT-NEXT:    ret double [[TMP0]]
588//
589// FINITEONLY-LABEL: @test_ceil(
590// FINITEONLY-NEXT:  entry:
591// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.ceil.f64(double [[X:%.*]])
592// FINITEONLY-NEXT:    ret double [[TMP0]]
593//
594// APPROX-LABEL: @test_ceil(
595// APPROX-NEXT:  entry:
596// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.ceil.f64(double [[X:%.*]])
597// APPROX-NEXT:    ret double [[TMP0]]
598//
599extern "C" __device__ double test_ceil(double x) {
600  return ceil(x);
601}
602
603// DEFAULT-LABEL: @test_copysignf(
604// DEFAULT-NEXT:  entry:
605// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.copysign.f32(float [[X:%.*]], float [[Y:%.*]])
606// DEFAULT-NEXT:    ret float [[TMP0]]
607//
608// FINITEONLY-LABEL: @test_copysignf(
609// FINITEONLY-NEXT:  entry:
610// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.copysign.f32(float [[X:%.*]], float [[Y:%.*]])
611// FINITEONLY-NEXT:    ret float [[TMP0]]
612//
613// APPROX-LABEL: @test_copysignf(
614// APPROX-NEXT:  entry:
615// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.copysign.f32(float [[X:%.*]], float [[Y:%.*]])
616// APPROX-NEXT:    ret float [[TMP0]]
617//
618extern "C" __device__ float test_copysignf(float x, float y) {
619  return copysignf(x, y);
620}
621
622// DEFAULT-LABEL: @test_copysign(
623// DEFAULT-NEXT:  entry:
624// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.copysign.f64(double [[X:%.*]], double [[Y:%.*]])
625// DEFAULT-NEXT:    ret double [[TMP0]]
626//
627// FINITEONLY-LABEL: @test_copysign(
628// FINITEONLY-NEXT:  entry:
629// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.copysign.f64(double [[X:%.*]], double [[Y:%.*]])
630// FINITEONLY-NEXT:    ret double [[TMP0]]
631//
632// APPROX-LABEL: @test_copysign(
633// APPROX-NEXT:  entry:
634// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.copysign.f64(double [[X:%.*]], double [[Y:%.*]])
635// APPROX-NEXT:    ret double [[TMP0]]
636//
637extern "C" __device__ double test_copysign(double x, double y) {
638  return copysign(x, y);
639}
640
641// DEFAULT-LABEL: @test_cosf(
642// DEFAULT-NEXT:  entry:
643// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cos_f32(float noundef [[X:%.*]]) #[[ATTR14:[0-9]+]]
644// DEFAULT-NEXT:    ret float [[CALL_I]]
645//
646// FINITEONLY-LABEL: @test_cosf(
647// FINITEONLY-NEXT:  entry:
648// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14:[0-9]+]]
649// FINITEONLY-NEXT:    ret float [[CALL_I]]
650//
651// APPROX-LABEL: @test_cosf(
652// APPROX-NEXT:  entry:
653// APPROX-NEXT:    [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR14:[0-9]+]]
654// APPROX-NEXT:    ret float [[CALL_I1]]
655//
656extern "C" __device__ float test_cosf(float x) {
657  return cosf(x);
658}
659
660// DEFAULT-LABEL: @test_cos(
661// DEFAULT-NEXT:  entry:
662// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cos_f64(double noundef [[X:%.*]]) #[[ATTR14]]
663// DEFAULT-NEXT:    ret double [[CALL_I]]
664//
665// FINITEONLY-LABEL: @test_cos(
666// FINITEONLY-NEXT:  entry:
667// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cos_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
668// FINITEONLY-NEXT:    ret double [[CALL_I]]
669//
670// APPROX-LABEL: @test_cos(
671// APPROX-NEXT:  entry:
672// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cos_f64(double noundef [[X:%.*]]) #[[ATTR14]]
673// APPROX-NEXT:    ret double [[CALL_I]]
674//
675extern "C" __device__ double test_cos(double x) {
676  return cos(x);
677}
678
679// DEFAULT-LABEL: @test_coshf(
680// DEFAULT-NEXT:  entry:
681// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cosh_f32(float noundef [[X:%.*]]) #[[ATTR13]]
682// DEFAULT-NEXT:    ret float [[CALL_I]]
683//
684// FINITEONLY-LABEL: @test_coshf(
685// FINITEONLY-NEXT:  entry:
686// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cosh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
687// FINITEONLY-NEXT:    ret float [[CALL_I]]
688//
689// APPROX-LABEL: @test_coshf(
690// APPROX-NEXT:  entry:
691// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cosh_f32(float noundef [[X:%.*]]) #[[ATTR13]]
692// APPROX-NEXT:    ret float [[CALL_I]]
693//
694extern "C" __device__ float test_coshf(float x) {
695  return coshf(x);
696}
697
698// DEFAULT-LABEL: @test_cosh(
699// DEFAULT-NEXT:  entry:
700// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cosh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
701// DEFAULT-NEXT:    ret double [[CALL_I]]
702//
703// FINITEONLY-LABEL: @test_cosh(
704// FINITEONLY-NEXT:  entry:
705// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cosh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
706// FINITEONLY-NEXT:    ret double [[CALL_I]]
707//
708// APPROX-LABEL: @test_cosh(
709// APPROX-NEXT:  entry:
710// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cosh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
711// APPROX-NEXT:    ret double [[CALL_I]]
712//
713extern "C" __device__ double test_cosh(double x) {
714  return cosh(x);
715}
716
717// DEFAULT-LABEL: @test_cospif(
718// DEFAULT-NEXT:  entry:
719// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cospi_f32(float noundef [[X:%.*]]) #[[ATTR14]]
720// DEFAULT-NEXT:    ret float [[CALL_I]]
721//
722// FINITEONLY-LABEL: @test_cospif(
723// FINITEONLY-NEXT:  entry:
724// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_cospi_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
725// FINITEONLY-NEXT:    ret float [[CALL_I]]
726//
727// APPROX-LABEL: @test_cospif(
728// APPROX-NEXT:  entry:
729// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_cospi_f32(float noundef [[X:%.*]]) #[[ATTR14]]
730// APPROX-NEXT:    ret float [[CALL_I]]
731//
732extern "C" __device__ float test_cospif(float x) {
733  return cospif(x);
734}
735
736// DEFAULT-LABEL: @test_cospi(
737// DEFAULT-NEXT:  entry:
738// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cospi_f64(double noundef [[X:%.*]]) #[[ATTR14]]
739// DEFAULT-NEXT:    ret double [[CALL_I]]
740//
741// FINITEONLY-LABEL: @test_cospi(
742// FINITEONLY-NEXT:  entry:
743// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_cospi_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
744// FINITEONLY-NEXT:    ret double [[CALL_I]]
745//
746// APPROX-LABEL: @test_cospi(
747// APPROX-NEXT:  entry:
748// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_cospi_f64(double noundef [[X:%.*]]) #[[ATTR14]]
749// APPROX-NEXT:    ret double [[CALL_I]]
750//
751extern "C" __device__ double test_cospi(double x) {
752  return cospi(x);
753}
754
755// DEFAULT-LABEL: @test_cyl_bessel_i0f(
756// DEFAULT-NEXT:  entry:
757// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i0_f32(float noundef [[X:%.*]]) #[[ATTR14]]
758// DEFAULT-NEXT:    ret float [[CALL_I]]
759//
760// FINITEONLY-LABEL: @test_cyl_bessel_i0f(
761// FINITEONLY-NEXT:  entry:
762// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_i0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
763// FINITEONLY-NEXT:    ret float [[CALL_I]]
764//
765// APPROX-LABEL: @test_cyl_bessel_i0f(
766// APPROX-NEXT:  entry:
767// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i0_f32(float noundef [[X:%.*]]) #[[ATTR14]]
768// APPROX-NEXT:    ret float [[CALL_I]]
769//
770extern "C" __device__ float test_cyl_bessel_i0f(float x) {
771  return cyl_bessel_i0f(x);
772}
773
774// DEFAULT-LABEL: @test_cyl_bessel_i0(
775// DEFAULT-NEXT:  entry:
776// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i0_f64(double noundef [[X:%.*]]) #[[ATTR14]]
777// DEFAULT-NEXT:    ret double [[CALL_I]]
778//
779// FINITEONLY-LABEL: @test_cyl_bessel_i0(
780// FINITEONLY-NEXT:  entry:
781// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_i0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
782// FINITEONLY-NEXT:    ret double [[CALL_I]]
783//
784// APPROX-LABEL: @test_cyl_bessel_i0(
785// APPROX-NEXT:  entry:
786// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i0_f64(double noundef [[X:%.*]]) #[[ATTR14]]
787// APPROX-NEXT:    ret double [[CALL_I]]
788//
789extern "C" __device__ double test_cyl_bessel_i0(double x) {
790  return cyl_bessel_i0(x);
791}
792
793// DEFAULT-LABEL: @test_cyl_bessel_i1f(
794// DEFAULT-NEXT:  entry:
795// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i1_f32(float noundef [[X:%.*]]) #[[ATTR14]]
796// DEFAULT-NEXT:    ret float [[CALL_I]]
797//
798// FINITEONLY-LABEL: @test_cyl_bessel_i1f(
799// FINITEONLY-NEXT:  entry:
800// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_i1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
801// FINITEONLY-NEXT:    ret float [[CALL_I]]
802//
803// APPROX-LABEL: @test_cyl_bessel_i1f(
804// APPROX-NEXT:  entry:
805// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_i1_f32(float noundef [[X:%.*]]) #[[ATTR14]]
806// APPROX-NEXT:    ret float [[CALL_I]]
807//
808extern "C" __device__ float test_cyl_bessel_i1f(float x) {
809  return cyl_bessel_i1f(x);
810}
811
812// DEFAULT-LABEL: @test_cyl_bessel_i1(
813// DEFAULT-NEXT:  entry:
814// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i1_f64(double noundef [[X:%.*]]) #[[ATTR14]]
815// DEFAULT-NEXT:    ret double [[CALL_I]]
816//
817// FINITEONLY-LABEL: @test_cyl_bessel_i1(
818// FINITEONLY-NEXT:  entry:
819// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_i1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
820// FINITEONLY-NEXT:    ret double [[CALL_I]]
821//
822// APPROX-LABEL: @test_cyl_bessel_i1(
823// APPROX-NEXT:  entry:
824// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_i1_f64(double noundef [[X:%.*]]) #[[ATTR14]]
825// APPROX-NEXT:    ret double [[CALL_I]]
826//
827extern "C" __device__ double test_cyl_bessel_i1(double x) {
828  return cyl_bessel_i1(x);
829}
830
831// DEFAULT-LABEL: @test_erfcf(
832// DEFAULT-NEXT:  entry:
833// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfc_f32(float noundef [[X:%.*]]) #[[ATTR13]]
834// DEFAULT-NEXT:    ret float [[CALL_I]]
835//
836// FINITEONLY-LABEL: @test_erfcf(
837// FINITEONLY-NEXT:  entry:
838// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_erfc_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
839// FINITEONLY-NEXT:    ret float [[CALL_I]]
840//
841// APPROX-LABEL: @test_erfcf(
842// APPROX-NEXT:  entry:
843// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfc_f32(float noundef [[X:%.*]]) #[[ATTR13]]
844// APPROX-NEXT:    ret float [[CALL_I]]
845//
846extern "C" __device__ float test_erfcf(float x) {
847  return erfcf(x);
848}
849
850// DEFAULT-LABEL: @test_erfc(
851// DEFAULT-NEXT:  entry:
852// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfc_f64(double noundef [[X:%.*]]) #[[ATTR13]]
853// DEFAULT-NEXT:    ret double [[CALL_I]]
854//
855// FINITEONLY-LABEL: @test_erfc(
856// FINITEONLY-NEXT:  entry:
857// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_erfc_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
858// FINITEONLY-NEXT:    ret double [[CALL_I]]
859//
860// APPROX-LABEL: @test_erfc(
861// APPROX-NEXT:  entry:
862// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfc_f64(double noundef [[X:%.*]]) #[[ATTR13]]
863// APPROX-NEXT:    ret double [[CALL_I]]
864//
865extern "C" __device__ double test_erfc(double x) {
866  return erfc(x);
867}
868
869// DEFAULT-LABEL: @test_erfinvf(
870// DEFAULT-NEXT:  entry:
871// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfinv_f32(float noundef [[X:%.*]]) #[[ATTR13]]
872// DEFAULT-NEXT:    ret float [[CALL_I]]
873//
874// FINITEONLY-LABEL: @test_erfinvf(
875// FINITEONLY-NEXT:  entry:
876// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_erfinv_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
877// FINITEONLY-NEXT:    ret float [[CALL_I]]
878//
879// APPROX-LABEL: @test_erfinvf(
880// APPROX-NEXT:  entry:
881// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_erfinv_f32(float noundef [[X:%.*]]) #[[ATTR13]]
882// APPROX-NEXT:    ret float [[CALL_I]]
883//
884extern "C" __device__ float test_erfinvf(float x) {
885  return erfinvf(x);
886}
887
888// DEFAULT-LABEL: @test_erfinv(
889// DEFAULT-NEXT:  entry:
890// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfinv_f64(double noundef [[X:%.*]]) #[[ATTR13]]
891// DEFAULT-NEXT:    ret double [[CALL_I]]
892//
893// FINITEONLY-LABEL: @test_erfinv(
894// FINITEONLY-NEXT:  entry:
895// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_erfinv_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
896// FINITEONLY-NEXT:    ret double [[CALL_I]]
897//
898// APPROX-LABEL: @test_erfinv(
899// APPROX-NEXT:  entry:
900// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_erfinv_f64(double noundef [[X:%.*]]) #[[ATTR13]]
901// APPROX-NEXT:    ret double [[CALL_I]]
902//
903extern "C" __device__ double test_erfinv(double x) {
904  return erfinv(x);
905}
906
907// DEFAULT-LABEL: @test_exp10f(
908// DEFAULT-NEXT:  entry:
909// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_exp10_f32(float noundef [[X:%.*]]) #[[ATTR13]]
910// DEFAULT-NEXT:    ret float [[CALL_I]]
911//
912// FINITEONLY-LABEL: @test_exp10f(
913// FINITEONLY-NEXT:  entry:
914// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_exp10_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
915// FINITEONLY-NEXT:    ret float [[CALL_I]]
916//
917// APPROX-LABEL: @test_exp10f(
918// APPROX-NEXT:  entry:
919// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_exp10_f32(float noundef [[X:%.*]]) #[[ATTR13]]
920// APPROX-NEXT:    ret float [[CALL_I]]
921//
922extern "C" __device__ float test_exp10f(float x) {
923  return exp10f(x);
924}
925
926// DEFAULT-LABEL: @test_exp10(
927// DEFAULT-NEXT:  entry:
928// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp10_f64(double noundef [[X:%.*]]) #[[ATTR13]]
929// DEFAULT-NEXT:    ret double [[CALL_I]]
930//
931// FINITEONLY-LABEL: @test_exp10(
932// FINITEONLY-NEXT:  entry:
933// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp10_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
934// FINITEONLY-NEXT:    ret double [[CALL_I]]
935//
936// APPROX-LABEL: @test_exp10(
937// APPROX-NEXT:  entry:
938// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp10_f64(double noundef [[X:%.*]]) #[[ATTR13]]
939// APPROX-NEXT:    ret double [[CALL_I]]
940//
941extern "C" __device__ double test_exp10(double x) {
942  return exp10(x);
943}
944
945// DEFAULT-LABEL: @test_exp2f(
946// DEFAULT-NEXT:  entry:
947// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.exp2.f32(float [[X:%.*]])
948// DEFAULT-NEXT:    ret float [[TMP0]]
949//
950// FINITEONLY-LABEL: @test_exp2f(
951// FINITEONLY-NEXT:  entry:
952// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.exp2.f32(float [[X:%.*]])
953// FINITEONLY-NEXT:    ret float [[TMP0]]
954//
955// APPROX-LABEL: @test_exp2f(
956// APPROX-NEXT:  entry:
957// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.exp2.f32(float [[X:%.*]])
958// APPROX-NEXT:    ret float [[TMP0]]
959//
960extern "C" __device__ float test_exp2f(float x) {
961  return exp2f(x);
962}
963
964// DEFAULT-LABEL: @test_exp2(
965// DEFAULT-NEXT:  entry:
966// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp2_f64(double noundef [[X:%.*]]) #[[ATTR13]]
967// DEFAULT-NEXT:    ret double [[CALL_I]]
968//
969// FINITEONLY-LABEL: @test_exp2(
970// FINITEONLY-NEXT:  entry:
971// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp2_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
972// FINITEONLY-NEXT:    ret double [[CALL_I]]
973//
974// APPROX-LABEL: @test_exp2(
975// APPROX-NEXT:  entry:
976// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp2_f64(double noundef [[X:%.*]]) #[[ATTR13]]
977// APPROX-NEXT:    ret double [[CALL_I]]
978//
979extern "C" __device__ double test_exp2(double x) {
980  return exp2(x);
981}
982
983// DEFAULT-LABEL: @test_expf(
984// DEFAULT-NEXT:  entry:
985// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.exp.f32(float [[X:%.*]])
986// DEFAULT-NEXT:    ret float [[TMP0]]
987//
988// FINITEONLY-LABEL: @test_expf(
989// FINITEONLY-NEXT:  entry:
990// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.exp.f32(float [[X:%.*]])
991// FINITEONLY-NEXT:    ret float [[TMP0]]
992//
993// APPROX-LABEL: @test_expf(
994// APPROX-NEXT:  entry:
995// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.exp.f32(float [[X:%.*]])
996// APPROX-NEXT:    ret float [[TMP0]]
997//
998extern "C" __device__ float test_expf(float x) {
999  return expf(x);
1000}
1001
1002// DEFAULT-LABEL: @test_exp(
1003// DEFAULT-NEXT:  entry:
1004// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp_f64(double noundef [[X:%.*]]) #[[ATTR13]]
1005// DEFAULT-NEXT:    ret double [[CALL_I]]
1006//
1007// FINITEONLY-LABEL: @test_exp(
1008// FINITEONLY-NEXT:  entry:
1009// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_exp_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
1010// FINITEONLY-NEXT:    ret double [[CALL_I]]
1011//
1012// APPROX-LABEL: @test_exp(
1013// APPROX-NEXT:  entry:
1014// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_exp_f64(double noundef [[X:%.*]]) #[[ATTR13]]
1015// APPROX-NEXT:    ret double [[CALL_I]]
1016//
1017extern "C" __device__ double test_exp(double x) {
1018  return exp(x);
1019}
1020
1021// DEFAULT-LABEL: @test_expm1f(
1022// DEFAULT-NEXT:  entry:
1023// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_expm1_f32(float noundef [[X:%.*]]) #[[ATTR13]]
1024// DEFAULT-NEXT:    ret float [[CALL_I]]
1025//
1026// FINITEONLY-LABEL: @test_expm1f(
1027// FINITEONLY-NEXT:  entry:
1028// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_expm1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
1029// FINITEONLY-NEXT:    ret float [[CALL_I]]
1030//
1031// APPROX-LABEL: @test_expm1f(
1032// APPROX-NEXT:  entry:
1033// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_expm1_f32(float noundef [[X:%.*]]) #[[ATTR13]]
1034// APPROX-NEXT:    ret float [[CALL_I]]
1035//
1036extern "C" __device__ float test_expm1f(float x) {
1037  return expm1f(x);
1038}
1039
1040// DEFAULT-LABEL: @test_expm1(
1041// DEFAULT-NEXT:  entry:
1042// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_expm1_f64(double noundef [[X:%.*]]) #[[ATTR13]]
1043// DEFAULT-NEXT:    ret double [[CALL_I]]
1044//
1045// FINITEONLY-LABEL: @test_expm1(
1046// FINITEONLY-NEXT:  entry:
1047// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_expm1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
1048// FINITEONLY-NEXT:    ret double [[CALL_I]]
1049//
1050// APPROX-LABEL: @test_expm1(
1051// APPROX-NEXT:  entry:
1052// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_expm1_f64(double noundef [[X:%.*]]) #[[ATTR13]]
1053// APPROX-NEXT:    ret double [[CALL_I]]
1054//
1055extern "C" __device__ double test_expm1(double x) {
1056  return expm1(x);
1057}
1058
1059// DEFAULT-LABEL: @test_fabsf(
1060// DEFAULT-NEXT:  entry:
1061// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.fabs.f32(float [[X:%.*]])
1062// DEFAULT-NEXT:    ret float [[TMP0]]
1063//
1064// FINITEONLY-LABEL: @test_fabsf(
1065// FINITEONLY-NEXT:  entry:
1066// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.fabs.f32(float [[X:%.*]])
1067// FINITEONLY-NEXT:    ret float [[TMP0]]
1068//
1069// APPROX-LABEL: @test_fabsf(
1070// APPROX-NEXT:  entry:
1071// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.fabs.f32(float [[X:%.*]])
1072// APPROX-NEXT:    ret float [[TMP0]]
1073//
1074extern "C" __device__ float test_fabsf(float x) {
1075  return fabsf(x);
1076}
1077
1078// DEFAULT-LABEL: @test_fabs(
1079// DEFAULT-NEXT:  entry:
1080// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.fabs.f64(double [[X:%.*]])
1081// DEFAULT-NEXT:    ret double [[TMP0]]
1082//
1083// FINITEONLY-LABEL: @test_fabs(
1084// FINITEONLY-NEXT:  entry:
1085// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.fabs.f64(double [[X:%.*]])
1086// FINITEONLY-NEXT:    ret double [[TMP0]]
1087//
1088// APPROX-LABEL: @test_fabs(
1089// APPROX-NEXT:  entry:
1090// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.fabs.f64(double [[X:%.*]])
1091// APPROX-NEXT:    ret double [[TMP0]]
1092//
1093extern "C" __device__ double test_fabs(double x) {
1094  return fabs(x);
1095}
1096
1097// DEFAULT-LABEL: @test_fdimf(
1098// DEFAULT-NEXT:  entry:
1099// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fdim_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
1100// DEFAULT-NEXT:    ret float [[CALL_I]]
1101//
1102// FINITEONLY-LABEL: @test_fdimf(
1103// FINITEONLY-NEXT:  entry:
1104// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_fdim_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
1105// FINITEONLY-NEXT:    ret float [[CALL_I]]
1106//
1107// APPROX-LABEL: @test_fdimf(
1108// APPROX-NEXT:  entry:
1109// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fdim_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
1110// APPROX-NEXT:    ret float [[CALL_I]]
1111//
1112extern "C" __device__ float test_fdimf(float x, float y) {
1113  return fdimf(x, y);
1114}
1115
1116// DEFAULT-LABEL: @test_fdim(
1117// DEFAULT-NEXT:  entry:
1118// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fdim_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
1119// DEFAULT-NEXT:    ret double [[CALL_I]]
1120//
1121// FINITEONLY-LABEL: @test_fdim(
1122// FINITEONLY-NEXT:  entry:
1123// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_fdim_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
1124// FINITEONLY-NEXT:    ret double [[CALL_I]]
1125//
1126// APPROX-LABEL: @test_fdim(
1127// APPROX-NEXT:  entry:
1128// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fdim_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
1129// APPROX-NEXT:    ret double [[CALL_I]]
1130//
1131extern "C" __device__ double test_fdim(double x, double y) {
1132  return fdim(x, y);
1133}
1134
1135// DEFAULT-LABEL: @test_fdividef(
1136// DEFAULT-NEXT:  entry:
1137// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract float [[X:%.*]], [[Y:%.*]]
1138// DEFAULT-NEXT:    ret float [[DIV_I]]
1139//
1140// FINITEONLY-LABEL: @test_fdividef(
1141// FINITEONLY-NEXT:  entry:
1142// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract float [[X:%.*]], [[Y:%.*]]
1143// FINITEONLY-NEXT:    ret float [[DIV_I]]
1144//
1145// APPROX-LABEL: @test_fdividef(
1146// APPROX-NEXT:  entry:
1147// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract float [[X:%.*]], [[Y:%.*]]
1148// APPROX-NEXT:    ret float [[DIV_I]]
1149//
1150extern "C" __device__ float test_fdividef(float x, float y) {
1151  return fdividef(x, y);
1152}
1153
1154// DEFAULT-LABEL: @test_floorf(
1155// DEFAULT-NEXT:  entry:
1156// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.floor.f32(float [[X:%.*]])
1157// DEFAULT-NEXT:    ret float [[TMP0]]
1158//
1159// FINITEONLY-LABEL: @test_floorf(
1160// FINITEONLY-NEXT:  entry:
1161// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.floor.f32(float [[X:%.*]])
1162// FINITEONLY-NEXT:    ret float [[TMP0]]
1163//
1164// APPROX-LABEL: @test_floorf(
1165// APPROX-NEXT:  entry:
1166// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.floor.f32(float [[X:%.*]])
1167// APPROX-NEXT:    ret float [[TMP0]]
1168//
1169extern "C" __device__ float test_floorf(float x) {
1170  return floorf(x);
1171}
1172
1173// DEFAULT-LABEL: @test_floor(
1174// DEFAULT-NEXT:  entry:
1175// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.floor.f64(double [[X:%.*]])
1176// DEFAULT-NEXT:    ret double [[TMP0]]
1177//
1178// FINITEONLY-LABEL: @test_floor(
1179// FINITEONLY-NEXT:  entry:
1180// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.floor.f64(double [[X:%.*]])
1181// FINITEONLY-NEXT:    ret double [[TMP0]]
1182//
1183// APPROX-LABEL: @test_floor(
1184// APPROX-NEXT:  entry:
1185// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.floor.f64(double [[X:%.*]])
1186// APPROX-NEXT:    ret double [[TMP0]]
1187//
1188extern "C" __device__ double test_floor(double x) {
1189  return floor(x);
1190}
1191
1192// DEFAULT-LABEL: @test_fmaf(
1193// DEFAULT-NEXT:  entry:
1194// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
1195// DEFAULT-NEXT:    ret float [[TMP0]]
1196//
1197// FINITEONLY-LABEL: @test_fmaf(
1198// FINITEONLY-NEXT:  entry:
1199// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
1200// FINITEONLY-NEXT:    ret float [[TMP0]]
1201//
1202// APPROX-LABEL: @test_fmaf(
1203// APPROX-NEXT:  entry:
1204// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
1205// APPROX-NEXT:    ret float [[TMP0]]
1206//
1207extern "C" __device__ float test_fmaf(float x, float y, float z) {
1208  return fmaf(x, y, z);
1209}
1210
1211// DEFAULT-LABEL: @test_fma(
1212// DEFAULT-NEXT:  entry:
1213// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
1214// DEFAULT-NEXT:    ret double [[TMP0]]
1215//
1216// FINITEONLY-LABEL: @test_fma(
1217// FINITEONLY-NEXT:  entry:
1218// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
1219// FINITEONLY-NEXT:    ret double [[TMP0]]
1220//
1221// APPROX-LABEL: @test_fma(
1222// APPROX-NEXT:  entry:
1223// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
1224// APPROX-NEXT:    ret double [[TMP0]]
1225//
1226extern "C" __device__ double test_fma(double x, double y, double z) {
1227  return fma(x, y, z);
1228}
1229
1230// DEFAULT-LABEL: @test_fma_rn(
1231// DEFAULT-NEXT:  entry:
1232// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
1233// DEFAULT-NEXT:    ret double [[TMP0]]
1234//
1235// FINITEONLY-LABEL: @test_fma_rn(
1236// FINITEONLY-NEXT:  entry:
1237// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
1238// FINITEONLY-NEXT:    ret double [[TMP0]]
1239//
1240// APPROX-LABEL: @test_fma_rn(
1241// APPROX-NEXT:  entry:
1242// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
1243// APPROX-NEXT:    ret double [[TMP0]]
1244//
1245extern "C" __device__ double test_fma_rn(double x, double y, double z) {
1246  return __fma_rn(x, y, z);
1247}
1248
1249// DEFAULT-LABEL: @test_fmaxf(
1250// DEFAULT-NEXT:  entry:
1251// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
1252// DEFAULT-NEXT:    ret float [[TMP0]]
1253//
1254// FINITEONLY-LABEL: @test_fmaxf(
1255// FINITEONLY-NEXT:  entry:
1256// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
1257// FINITEONLY-NEXT:    ret float [[TMP0]]
1258//
1259// APPROX-LABEL: @test_fmaxf(
1260// APPROX-NEXT:  entry:
1261// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
1262// APPROX-NEXT:    ret float [[TMP0]]
1263//
1264extern "C" __device__ float test_fmaxf(float x, float y) {
1265  return fmaxf(x, y);
1266}
1267
1268// DEFAULT-LABEL: @test_fmax(
1269// DEFAULT-NEXT:  entry:
1270// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
1271// DEFAULT-NEXT:    ret double [[TMP0]]
1272//
1273// FINITEONLY-LABEL: @test_fmax(
1274// FINITEONLY-NEXT:  entry:
1275// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
1276// FINITEONLY-NEXT:    ret double [[TMP0]]
1277//
1278// APPROX-LABEL: @test_fmax(
1279// APPROX-NEXT:  entry:
1280// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
1281// APPROX-NEXT:    ret double [[TMP0]]
1282//
1283extern "C" __device__ double test_fmax(double x, double y) {
1284  return fmax(x, y);
1285}
1286
1287// DEFAULT-LABEL: @test_fminf(
1288// DEFAULT-NEXT:  entry:
1289// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
1290// DEFAULT-NEXT:    ret float [[TMP0]]
1291//
1292// FINITEONLY-LABEL: @test_fminf(
1293// FINITEONLY-NEXT:  entry:
1294// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
1295// FINITEONLY-NEXT:    ret float [[TMP0]]
1296//
1297// APPROX-LABEL: @test_fminf(
1298// APPROX-NEXT:  entry:
1299// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
1300// APPROX-NEXT:    ret float [[TMP0]]
1301//
1302extern "C" __device__ float test_fminf(float x, float y) {
1303  return fminf(x, y);
1304}
1305
1306// DEFAULT-LABEL: @test_fmin(
1307// DEFAULT-NEXT:  entry:
1308// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
1309// DEFAULT-NEXT:    ret double [[TMP0]]
1310//
1311// FINITEONLY-LABEL: @test_fmin(
1312// FINITEONLY-NEXT:  entry:
1313// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
1314// FINITEONLY-NEXT:    ret double [[TMP0]]
1315//
1316// APPROX-LABEL: @test_fmin(
1317// APPROX-NEXT:  entry:
1318// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
1319// APPROX-NEXT:    ret double [[TMP0]]
1320//
1321extern "C" __device__ double test_fmin(double x, double y) {
1322  return fmin(x, y);
1323}
1324
1325// DEFAULT-LABEL: @test_fmodf(
1326// DEFAULT-NEXT:  entry:
1327// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fmod_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
1328// DEFAULT-NEXT:    ret float [[CALL_I]]
1329//
1330// FINITEONLY-LABEL: @test_fmodf(
1331// FINITEONLY-NEXT:  entry:
1332// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_fmod_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
1333// FINITEONLY-NEXT:    ret float [[CALL_I]]
1334//
1335// APPROX-LABEL: @test_fmodf(
1336// APPROX-NEXT:  entry:
1337// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_fmod_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
1338// APPROX-NEXT:    ret float [[CALL_I]]
1339//
1340extern "C" __device__ float test_fmodf(float x, float y) {
1341  return fmodf(x, y);
1342}
1343
1344// DEFAULT-LABEL: @test_fmod(
1345// DEFAULT-NEXT:  entry:
1346// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fmod_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
1347// DEFAULT-NEXT:    ret double [[CALL_I]]
1348//
1349// FINITEONLY-LABEL: @test_fmod(
1350// FINITEONLY-NEXT:  entry:
1351// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_fmod_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
1352// FINITEONLY-NEXT:    ret double [[CALL_I]]
1353//
1354// APPROX-LABEL: @test_fmod(
1355// APPROX-NEXT:  entry:
1356// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_fmod_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
1357// APPROX-NEXT:    ret double [[CALL_I]]
1358//
1359extern "C" __device__ double test_fmod(double x, double y) {
1360  return fmod(x, y);
1361}
1362
1363// CHECK-LABEL: @test_frexpf(
1364// CHECK-NEXT:  entry:
1365// CHECK-NEXT:    [[TMP0:%.*]] = tail call { float, i32 } @llvm.frexp.f32.i32(float [[X:%.*]])
1366// CHECK-NEXT:    [[TMP1:%.*]] = extractvalue { float, i32 } [[TMP0]], 1
1367// CHECK-NEXT:    store i32 [[TMP1]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA12:![0-9]+]]
1368// CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { float, i32 } [[TMP0]], 0
1369// CHECK-NEXT:    ret float [[TMP2]]
1370//
1371extern "C" __device__ float test_frexpf(float x, int* y) {
1372  return frexpf(x, y);
1373}
1374
1375// CHECK-LABEL: @test_frexp(
1376// CHECK-NEXT:  entry:
1377// CHECK-NEXT:    [[TMP0:%.*]] = tail call { double, i32 } @llvm.frexp.f64.i32(double [[X:%.*]])
1378// CHECK-NEXT:    [[TMP1:%.*]] = extractvalue { double, i32 } [[TMP0]], 1
1379// CHECK-NEXT:    store i32 [[TMP1]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA12]]
1380// CHECK-NEXT:    [[TMP2:%.*]] = extractvalue { double, i32 } [[TMP0]], 0
1381// CHECK-NEXT:    ret double [[TMP2]]
1382//
1383extern "C" __device__ double test_frexp(double x, int* y) {
1384  return frexp(x, y);
1385}
1386
1387// DEFAULT-LABEL: @test_hypotf(
1388// DEFAULT-NEXT:  entry:
1389// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_hypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
1390// DEFAULT-NEXT:    ret float [[CALL_I]]
1391//
1392// FINITEONLY-LABEL: @test_hypotf(
1393// FINITEONLY-NEXT:  entry:
1394// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_hypot_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
1395// FINITEONLY-NEXT:    ret float [[CALL_I]]
1396//
1397// APPROX-LABEL: @test_hypotf(
1398// APPROX-NEXT:  entry:
1399// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_hypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
1400// APPROX-NEXT:    ret float [[CALL_I]]
1401//
1402extern "C" __device__ float test_hypotf(float x, float y) {
1403  return hypotf(x, y);
1404}
1405
1406// DEFAULT-LABEL: @test_hypot(
1407// DEFAULT-NEXT:  entry:
1408// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_hypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
1409// DEFAULT-NEXT:    ret double [[CALL_I]]
1410//
1411// FINITEONLY-LABEL: @test_hypot(
1412// FINITEONLY-NEXT:  entry:
1413// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_hypot_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
1414// FINITEONLY-NEXT:    ret double [[CALL_I]]
1415//
1416// APPROX-LABEL: @test_hypot(
1417// APPROX-NEXT:  entry:
1418// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_hypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
1419// APPROX-NEXT:    ret double [[CALL_I]]
1420//
1421extern "C" __device__ double test_hypot(double x, double y) {
1422  return hypot(x, y);
1423}
1424
1425// DEFAULT-LABEL: @test_ilogbf(
1426// DEFAULT-NEXT:  entry:
1427// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef [[X:%.*]]) #[[ATTR12]]
1428// DEFAULT-NEXT:    ret i32 [[CALL_I]]
1429//
1430// FINITEONLY-LABEL: @test_ilogbf(
1431// FINITEONLY-NEXT:  entry:
1432// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
1433// FINITEONLY-NEXT:    ret i32 [[CALL_I]]
1434//
1435// APPROX-LABEL: @test_ilogbf(
1436// APPROX-NEXT:  entry:
1437// APPROX-NEXT:    [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f32(float noundef [[X:%.*]]) #[[ATTR12]]
1438// APPROX-NEXT:    ret i32 [[CALL_I]]
1439//
1440extern "C" __device__ int test_ilogbf(float x) {
1441  return ilogbf(x);
1442}
1443
1444// DEFAULT-LABEL: @test_ilogb(
1445// DEFAULT-NEXT:  entry:
1446// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef [[X:%.*]]) #[[ATTR12]]
1447// DEFAULT-NEXT:    ret i32 [[CALL_I]]
1448//
1449// FINITEONLY-LABEL: @test_ilogb(
1450// FINITEONLY-NEXT:  entry:
1451// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
1452// FINITEONLY-NEXT:    ret i32 [[CALL_I]]
1453//
1454// APPROX-LABEL: @test_ilogb(
1455// APPROX-NEXT:  entry:
1456// APPROX-NEXT:    [[CALL_I:%.*]] = tail call noundef i32 @__ocml_ilogb_f64(double noundef [[X:%.*]]) #[[ATTR12]]
1457// APPROX-NEXT:    ret i32 [[CALL_I]]
1458//
1459extern "C" __device__ int test_ilogb(double x) {
1460  return ilogb(x);
1461}
1462
1463// DEFAULT-LABEL: @test___finitef(
1464// DEFAULT-NEXT:  entry:
1465// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call float @llvm.fabs.f32(float [[X:%.*]])
1466// DEFAULT-NEXT:    [[TMP1:%.*]] = fcmp one float [[TMP0]], 0x7FF0000000000000
1467// DEFAULT-NEXT:    [[CONV:%.*]] = zext i1 [[TMP1]] to i32
1468// DEFAULT-NEXT:    ret i32 [[CONV]]
1469//
1470// FINITEONLY-LABEL: @test___finitef(
1471// FINITEONLY-NEXT:  entry:
1472// FINITEONLY-NEXT:    ret i32 1
1473//
1474// APPROX-LABEL: @test___finitef(
1475// APPROX-NEXT:  entry:
1476// APPROX-NEXT:    [[TMP0:%.*]] = tail call float @llvm.fabs.f32(float [[X:%.*]])
1477// APPROX-NEXT:    [[TMP1:%.*]] = fcmp one float [[TMP0]], 0x7FF0000000000000
1478// APPROX-NEXT:    [[CONV:%.*]] = zext i1 [[TMP1]] to i32
1479// APPROX-NEXT:    ret i32 [[CONV]]
1480//
1481extern "C" __device__ BOOL_TYPE test___finitef(float x) {
1482  return __finitef(x);
1483}
1484
1485// DEFAULT-LABEL: @test___finite(
1486// DEFAULT-NEXT:  entry:
1487// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
1488// DEFAULT-NEXT:    [[TMP1:%.*]] = fcmp one double [[TMP0]], 0x7FF0000000000000
1489// DEFAULT-NEXT:    [[CONV:%.*]] = zext i1 [[TMP1]] to i32
1490// DEFAULT-NEXT:    ret i32 [[CONV]]
1491//
1492// FINITEONLY-LABEL: @test___finite(
1493// FINITEONLY-NEXT:  entry:
1494// FINITEONLY-NEXT:    ret i32 1
1495//
1496// APPROX-LABEL: @test___finite(
1497// APPROX-NEXT:  entry:
1498// APPROX-NEXT:    [[TMP0:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
1499// APPROX-NEXT:    [[TMP1:%.*]] = fcmp one double [[TMP0]], 0x7FF0000000000000
1500// APPROX-NEXT:    [[CONV:%.*]] = zext i1 [[TMP1]] to i32
1501// APPROX-NEXT:    ret i32 [[CONV]]
1502//
1503extern "C" __device__ BOOL_TYPE test___finite(double x) {
1504  return __finite(x);
1505}
1506
1507// DEFAULT-LABEL: @test___isinff(
1508// DEFAULT-NEXT:  entry:
1509// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call float @llvm.fabs.f32(float [[X:%.*]])
1510// DEFAULT-NEXT:    [[TMP1:%.*]] = fcmp oeq float [[TMP0]], 0x7FF0000000000000
1511// DEFAULT-NEXT:    [[CONV:%.*]] = zext i1 [[TMP1]] to i32
1512// DEFAULT-NEXT:    ret i32 [[CONV]]
1513//
1514// FINITEONLY-LABEL: @test___isinff(
1515// FINITEONLY-NEXT:  entry:
1516// FINITEONLY-NEXT:    ret i32 0
1517//
1518// APPROX-LABEL: @test___isinff(
1519// APPROX-NEXT:  entry:
1520// APPROX-NEXT:    [[TMP0:%.*]] = tail call float @llvm.fabs.f32(float [[X:%.*]])
1521// APPROX-NEXT:    [[TMP1:%.*]] = fcmp oeq float [[TMP0]], 0x7FF0000000000000
1522// APPROX-NEXT:    [[CONV:%.*]] = zext i1 [[TMP1]] to i32
1523// APPROX-NEXT:    ret i32 [[CONV]]
1524//
1525extern "C" __device__ BOOL_TYPE test___isinff(float x) {
1526  return __isinff(x);
1527}
1528
1529// DEFAULT-LABEL: @test___isinf(
1530// DEFAULT-NEXT:  entry:
1531// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
1532// DEFAULT-NEXT:    [[TMP1:%.*]] = fcmp oeq double [[TMP0]], 0x7FF0000000000000
1533// DEFAULT-NEXT:    [[CONV:%.*]] = zext i1 [[TMP1]] to i32
1534// DEFAULT-NEXT:    ret i32 [[CONV]]
1535//
1536// FINITEONLY-LABEL: @test___isinf(
1537// FINITEONLY-NEXT:  entry:
1538// FINITEONLY-NEXT:    ret i32 0
1539//
1540// APPROX-LABEL: @test___isinf(
1541// APPROX-NEXT:  entry:
1542// APPROX-NEXT:    [[TMP0:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
1543// APPROX-NEXT:    [[TMP1:%.*]] = fcmp oeq double [[TMP0]], 0x7FF0000000000000
1544// APPROX-NEXT:    [[CONV:%.*]] = zext i1 [[TMP1]] to i32
1545// APPROX-NEXT:    ret i32 [[CONV]]
1546//
1547extern "C" __device__ BOOL_TYPE test___isinf(double x) {
1548  return __isinf(x);
1549}
1550
1551// DEFAULT-LABEL: @test___isnanf(
1552// DEFAULT-NEXT:  entry:
1553// DEFAULT-NEXT:    [[TMP0:%.*]] = fcmp uno float [[X:%.*]], 0.000000e+00
1554// DEFAULT-NEXT:    [[CONV:%.*]] = zext i1 [[TMP0]] to i32
1555// DEFAULT-NEXT:    ret i32 [[CONV]]
1556//
1557// FINITEONLY-LABEL: @test___isnanf(
1558// FINITEONLY-NEXT:  entry:
1559// FINITEONLY-NEXT:    ret i32 0
1560//
1561// APPROX-LABEL: @test___isnanf(
1562// APPROX-NEXT:  entry:
1563// APPROX-NEXT:    [[TMP0:%.*]] = fcmp uno float [[X:%.*]], 0.000000e+00
1564// APPROX-NEXT:    [[CONV:%.*]] = zext i1 [[TMP0]] to i32
1565// APPROX-NEXT:    ret i32 [[CONV]]
1566//
1567extern "C" __device__ BOOL_TYPE test___isnanf(float x) {
1568  return __isnanf(x);
1569}
1570
1571// DEFAULT-LABEL: @test___isnan(
1572// DEFAULT-NEXT:  entry:
1573// DEFAULT-NEXT:    [[TMP0:%.*]] = fcmp uno double [[X:%.*]], 0.000000e+00
1574// DEFAULT-NEXT:    [[CONV:%.*]] = zext i1 [[TMP0]] to i32
1575// DEFAULT-NEXT:    ret i32 [[CONV]]
1576//
1577// FINITEONLY-LABEL: @test___isnan(
1578// FINITEONLY-NEXT:  entry:
1579// FINITEONLY-NEXT:    ret i32 0
1580//
1581// APPROX-LABEL: @test___isnan(
1582// APPROX-NEXT:  entry:
1583// APPROX-NEXT:    [[TMP0:%.*]] = fcmp uno double [[X:%.*]], 0.000000e+00
1584// APPROX-NEXT:    [[CONV:%.*]] = zext i1 [[TMP0]] to i32
1585// APPROX-NEXT:    ret i32 [[CONV]]
1586//
1587extern "C" __device__ BOOL_TYPE test___isnan(double x) {
1588  return __isnan(x);
1589}
1590
1591// DEFAULT-LABEL: @test_j0f(
1592// DEFAULT-NEXT:  entry:
1593// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[X:%.*]]) #[[ATTR14]]
1594// DEFAULT-NEXT:    ret float [[CALL_I]]
1595//
1596// FINITEONLY-LABEL: @test_j0f(
1597// FINITEONLY-NEXT:  entry:
1598// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
1599// FINITEONLY-NEXT:    ret float [[CALL_I]]
1600//
1601// APPROX-LABEL: @test_j0f(
1602// APPROX-NEXT:  entry:
1603// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[X:%.*]]) #[[ATTR14]]
1604// APPROX-NEXT:    ret float [[CALL_I]]
1605//
1606extern "C" __device__ float test_j0f(float x) {
1607  return j0f(x);
1608}
1609
1610// DEFAULT-LABEL: @test_j0(
1611// DEFAULT-NEXT:  entry:
1612// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[X:%.*]]) #[[ATTR14]]
1613// DEFAULT-NEXT:    ret double [[CALL_I]]
1614//
1615// FINITEONLY-LABEL: @test_j0(
1616// FINITEONLY-NEXT:  entry:
1617// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
1618// FINITEONLY-NEXT:    ret double [[CALL_I]]
1619//
1620// APPROX-LABEL: @test_j0(
1621// APPROX-NEXT:  entry:
1622// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[X:%.*]]) #[[ATTR14]]
1623// APPROX-NEXT:    ret double [[CALL_I]]
1624//
1625extern "C" __device__ double test_j0(double x) {
1626  return j0(x);
1627}
1628
1629// DEFAULT-LABEL: @test_j1f(
1630// DEFAULT-NEXT:  entry:
1631// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[X:%.*]]) #[[ATTR14]]
1632// DEFAULT-NEXT:    ret float [[CALL_I]]
1633//
1634// FINITEONLY-LABEL: @test_j1f(
1635// FINITEONLY-NEXT:  entry:
1636// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
1637// FINITEONLY-NEXT:    ret float [[CALL_I]]
1638//
1639// APPROX-LABEL: @test_j1f(
1640// APPROX-NEXT:  entry:
1641// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[X:%.*]]) #[[ATTR14]]
1642// APPROX-NEXT:    ret float [[CALL_I]]
1643//
1644extern "C" __device__ float test_j1f(float x) {
1645  return j1f(x);
1646}
1647
1648// DEFAULT-LABEL: @test_j1(
1649// DEFAULT-NEXT:  entry:
1650// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[X:%.*]]) #[[ATTR14]]
1651// DEFAULT-NEXT:    ret double [[CALL_I]]
1652//
1653// FINITEONLY-LABEL: @test_j1(
1654// FINITEONLY-NEXT:  entry:
1655// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
1656// FINITEONLY-NEXT:    ret double [[CALL_I]]
1657//
1658// APPROX-LABEL: @test_j1(
1659// APPROX-NEXT:  entry:
1660// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[X:%.*]]) #[[ATTR14]]
1661// APPROX-NEXT:    ret double [[CALL_I]]
1662//
1663extern "C" __device__ double test_j1(double x) {
1664  return j1(x);
1665}
1666
1667// DEFAULT-LABEL: @test_jnf(
1668// DEFAULT-NEXT:  entry:
1669// DEFAULT-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
1670// DEFAULT-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
1671// DEFAULT-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
1672// DEFAULT-NEXT:    ]
1673// DEFAULT:       if.then.i:
1674// DEFAULT-NEXT:    [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y:%.*]]) #[[ATTR14]]
1675// DEFAULT-NEXT:    br label [[_ZL3JNFIF_EXIT:%.*]]
1676// DEFAULT:       if.then2.i:
1677// DEFAULT-NEXT:    [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR14]]
1678// DEFAULT-NEXT:    br label [[_ZL3JNFIF_EXIT]]
1679// DEFAULT:       if.end4.i:
1680// DEFAULT-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y]]) #[[ATTR14]]
1681// DEFAULT-NEXT:    [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR14]]
1682// DEFAULT-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
1683// DEFAULT-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3JNFIF_EXIT]]
1684// DEFAULT:       for.body.i:
1685// DEFAULT-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
1686// DEFAULT-NEXT:    [[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
1687// DEFAULT-NEXT:    [[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
1688// DEFAULT-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
1689// DEFAULT-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to float
1690// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract float [[CONV_I]], [[Y]]
1691// DEFAULT-NEXT:    [[MUL8_I:%.*]] = fmul contract float [[__X1_0_I3]], [[DIV_I]]
1692// DEFAULT-NEXT:    [[SUB_I]] = fsub contract float [[MUL8_I]], [[__X0_0_I2]]
1693// DEFAULT-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
1694// DEFAULT-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
1695// DEFAULT-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL3JNFIF_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP14:![0-9]+]]
1696// DEFAULT:       _ZL3jnfif.exit:
1697// DEFAULT-NEXT:    [[RETVAL_0_I:%.*]] = phi float [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
1698// DEFAULT-NEXT:    ret float [[RETVAL_0_I]]
1699//
1700// FINITEONLY-LABEL: @test_jnf(
1701// FINITEONLY-NEXT:  entry:
1702// FINITEONLY-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
1703// FINITEONLY-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
1704// FINITEONLY-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
1705// FINITEONLY-NEXT:    ]
1706// FINITEONLY:       if.then.i:
1707// FINITEONLY-NEXT:    [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]]
1708// FINITEONLY-NEXT:    br label [[_ZL3JNFIF_EXIT:%.*]]
1709// FINITEONLY:       if.then2.i:
1710// FINITEONLY-NEXT:    [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
1711// FINITEONLY-NEXT:    br label [[_ZL3JNFIF_EXIT]]
1712// FINITEONLY:       if.end4.i:
1713// FINITEONLY-NEXT:    [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j0_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
1714// FINITEONLY-NEXT:    [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_j1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
1715// FINITEONLY-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
1716// FINITEONLY-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3JNFIF_EXIT]]
1717// FINITEONLY:       for.body.i:
1718// FINITEONLY-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
1719// FINITEONLY-NEXT:    [[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
1720// FINITEONLY-NEXT:    [[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
1721// FINITEONLY-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
1722// FINITEONLY-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to float
1723// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract float [[CONV_I]], [[Y]]
1724// FINITEONLY-NEXT:    [[MUL8_I:%.*]] = fmul nnan ninf contract float [[__X1_0_I3]], [[DIV_I]]
1725// FINITEONLY-NEXT:    [[SUB_I]] = fsub nnan ninf contract float [[MUL8_I]], [[__X0_0_I2]]
1726// FINITEONLY-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
1727// FINITEONLY-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
1728// FINITEONLY-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL3JNFIF_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP14:![0-9]+]]
1729// FINITEONLY:       _ZL3jnfif.exit:
1730// FINITEONLY-NEXT:    [[RETVAL_0_I:%.*]] = phi float [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
1731// FINITEONLY-NEXT:    ret float [[RETVAL_0_I]]
1732//
1733// APPROX-LABEL: @test_jnf(
1734// APPROX-NEXT:  entry:
1735// APPROX-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
1736// APPROX-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
1737// APPROX-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
1738// APPROX-NEXT:    ]
1739// APPROX:       if.then.i:
1740// APPROX-NEXT:    [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y:%.*]]) #[[ATTR14]]
1741// APPROX-NEXT:    br label [[_ZL3JNFIF_EXIT:%.*]]
1742// APPROX:       if.then2.i:
1743// APPROX-NEXT:    [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR14]]
1744// APPROX-NEXT:    br label [[_ZL3JNFIF_EXIT]]
1745// APPROX:       if.end4.i:
1746// APPROX-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_j0_f32(float noundef [[Y]]) #[[ATTR14]]
1747// APPROX-NEXT:    [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_j1_f32(float noundef [[Y]]) #[[ATTR14]]
1748// APPROX-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
1749// APPROX-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3JNFIF_EXIT]]
1750// APPROX:       for.body.i:
1751// APPROX-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
1752// APPROX-NEXT:    [[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
1753// APPROX-NEXT:    [[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
1754// APPROX-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
1755// APPROX-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to float
1756// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract float [[CONV_I]], [[Y]]
1757// APPROX-NEXT:    [[MUL8_I:%.*]] = fmul contract float [[__X1_0_I3]], [[DIV_I]]
1758// APPROX-NEXT:    [[SUB_I]] = fsub contract float [[MUL8_I]], [[__X0_0_I2]]
1759// APPROX-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
1760// APPROX-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
1761// APPROX-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL3JNFIF_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP14:![0-9]+]]
1762// APPROX:       _ZL3jnfif.exit:
1763// APPROX-NEXT:    [[RETVAL_0_I:%.*]] = phi float [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
1764// APPROX-NEXT:    ret float [[RETVAL_0_I]]
1765//
1766extern "C" __device__ float test_jnf(int x, float y) {
1767  return jnf(x, y);
1768}
1769
1770// DEFAULT-LABEL: @test_jn(
1771// DEFAULT-NEXT:  entry:
1772// DEFAULT-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
1773// DEFAULT-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
1774// DEFAULT-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
1775// DEFAULT-NEXT:    ]
1776// DEFAULT:       if.then.i:
1777// DEFAULT-NEXT:    [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y:%.*]]) #[[ATTR14]]
1778// DEFAULT-NEXT:    br label [[_ZL2JNID_EXIT:%.*]]
1779// DEFAULT:       if.then2.i:
1780// DEFAULT-NEXT:    [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR14]]
1781// DEFAULT-NEXT:    br label [[_ZL2JNID_EXIT]]
1782// DEFAULT:       if.end4.i:
1783// DEFAULT-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y]]) #[[ATTR14]]
1784// DEFAULT-NEXT:    [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR14]]
1785// DEFAULT-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
1786// DEFAULT-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2JNID_EXIT]]
1787// DEFAULT:       for.body.i:
1788// DEFAULT-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
1789// DEFAULT-NEXT:    [[__X1_0_I3:%.*]] = phi double [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
1790// DEFAULT-NEXT:    [[__X0_0_I2:%.*]] = phi double [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
1791// DEFAULT-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
1792// DEFAULT-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to double
1793// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract double [[CONV_I]], [[Y]]
1794// DEFAULT-NEXT:    [[MUL8_I:%.*]] = fmul contract double [[__X1_0_I3]], [[DIV_I]]
1795// DEFAULT-NEXT:    [[SUB_I]] = fsub contract double [[MUL8_I]], [[__X0_0_I2]]
1796// DEFAULT-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
1797// DEFAULT-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
1798// DEFAULT-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL2JNID_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP15:![0-9]+]]
1799// DEFAULT:       _ZL2jnid.exit:
1800// DEFAULT-NEXT:    [[RETVAL_0_I:%.*]] = phi double [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
1801// DEFAULT-NEXT:    ret double [[RETVAL_0_I]]
1802//
1803// FINITEONLY-LABEL: @test_jn(
1804// FINITEONLY-NEXT:  entry:
1805// FINITEONLY-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
1806// FINITEONLY-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
1807// FINITEONLY-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
1808// FINITEONLY-NEXT:    ]
1809// FINITEONLY:       if.then.i:
1810// FINITEONLY-NEXT:    [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]]
1811// FINITEONLY-NEXT:    br label [[_ZL2JNID_EXIT:%.*]]
1812// FINITEONLY:       if.then2.i:
1813// FINITEONLY-NEXT:    [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
1814// FINITEONLY-NEXT:    br label [[_ZL2JNID_EXIT]]
1815// FINITEONLY:       if.end4.i:
1816// FINITEONLY-NEXT:    [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j0_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
1817// FINITEONLY-NEXT:    [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_j1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
1818// FINITEONLY-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
1819// FINITEONLY-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2JNID_EXIT]]
1820// FINITEONLY:       for.body.i:
1821// FINITEONLY-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
1822// FINITEONLY-NEXT:    [[__X1_0_I3:%.*]] = phi double [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
1823// FINITEONLY-NEXT:    [[__X0_0_I2:%.*]] = phi double [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
1824// FINITEONLY-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
1825// FINITEONLY-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to double
1826// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract double [[CONV_I]], [[Y]]
1827// FINITEONLY-NEXT:    [[MUL8_I:%.*]] = fmul nnan ninf contract double [[__X1_0_I3]], [[DIV_I]]
1828// FINITEONLY-NEXT:    [[SUB_I]] = fsub nnan ninf contract double [[MUL8_I]], [[__X0_0_I2]]
1829// FINITEONLY-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
1830// FINITEONLY-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
1831// FINITEONLY-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL2JNID_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP15:![0-9]+]]
1832// FINITEONLY:       _ZL2jnid.exit:
1833// FINITEONLY-NEXT:    [[RETVAL_0_I:%.*]] = phi double [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
1834// FINITEONLY-NEXT:    ret double [[RETVAL_0_I]]
1835//
1836// APPROX-LABEL: @test_jn(
1837// APPROX-NEXT:  entry:
1838// APPROX-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
1839// APPROX-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
1840// APPROX-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
1841// APPROX-NEXT:    ]
1842// APPROX:       if.then.i:
1843// APPROX-NEXT:    [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y:%.*]]) #[[ATTR14]]
1844// APPROX-NEXT:    br label [[_ZL2JNID_EXIT:%.*]]
1845// APPROX:       if.then2.i:
1846// APPROX-NEXT:    [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR14]]
1847// APPROX-NEXT:    br label [[_ZL2JNID_EXIT]]
1848// APPROX:       if.end4.i:
1849// APPROX-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_j0_f64(double noundef [[Y]]) #[[ATTR14]]
1850// APPROX-NEXT:    [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_j1_f64(double noundef [[Y]]) #[[ATTR14]]
1851// APPROX-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
1852// APPROX-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2JNID_EXIT]]
1853// APPROX:       for.body.i:
1854// APPROX-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
1855// APPROX-NEXT:    [[__X1_0_I3:%.*]] = phi double [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
1856// APPROX-NEXT:    [[__X0_0_I2:%.*]] = phi double [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
1857// APPROX-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
1858// APPROX-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to double
1859// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract double [[CONV_I]], [[Y]]
1860// APPROX-NEXT:    [[MUL8_I:%.*]] = fmul contract double [[__X1_0_I3]], [[DIV_I]]
1861// APPROX-NEXT:    [[SUB_I]] = fsub contract double [[MUL8_I]], [[__X0_0_I2]]
1862// APPROX-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
1863// APPROX-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
1864// APPROX-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL2JNID_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP15:![0-9]+]]
1865// APPROX:       _ZL2jnid.exit:
1866// APPROX-NEXT:    [[RETVAL_0_I:%.*]] = phi double [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
1867// APPROX-NEXT:    ret double [[RETVAL_0_I]]
1868//
1869extern "C" __device__ double test_jn(int x, double y) {
1870  return jn(x, y);
1871}
1872
1873// DEFAULT-LABEL: @test_ldexpf(
1874// DEFAULT-NEXT:  entry:
1875// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[Y:%.*]])
1876// DEFAULT-NEXT:    ret float [[TMP0]]
1877//
1878// FINITEONLY-LABEL: @test_ldexpf(
1879// FINITEONLY-NEXT:  entry:
1880// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[Y:%.*]])
1881// FINITEONLY-NEXT:    ret float [[TMP0]]
1882//
1883// APPROX-LABEL: @test_ldexpf(
1884// APPROX-NEXT:  entry:
1885// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[Y:%.*]])
1886// APPROX-NEXT:    ret float [[TMP0]]
1887//
1888extern "C" __device__ float test_ldexpf(float x, int y) {
1889  return ldexpf(x, y);
1890}
1891
1892// DEFAULT-LABEL: @test_ldexp(
1893// DEFAULT-NEXT:  entry:
1894// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[Y:%.*]])
1895// DEFAULT-NEXT:    ret double [[TMP0]]
1896//
1897// FINITEONLY-LABEL: @test_ldexp(
1898// FINITEONLY-NEXT:  entry:
1899// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[Y:%.*]])
1900// FINITEONLY-NEXT:    ret double [[TMP0]]
1901//
1902// APPROX-LABEL: @test_ldexp(
1903// APPROX-NEXT:  entry:
1904// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[Y:%.*]])
1905// APPROX-NEXT:    ret double [[TMP0]]
1906//
1907extern "C" __device__ double test_ldexp(double x, int y) {
1908  return ldexp(x, y);
1909}
1910
1911// DEFAULT-LABEL: @test_lgammaf(
1912// DEFAULT-NEXT:  entry:
1913// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_lgamma_f32(float noundef [[X:%.*]]) #[[ATTR14]]
1914// DEFAULT-NEXT:    ret float [[CALL_I]]
1915//
1916// FINITEONLY-LABEL: @test_lgammaf(
1917// FINITEONLY-NEXT:  entry:
1918// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_lgamma_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
1919// FINITEONLY-NEXT:    ret float [[CALL_I]]
1920//
1921// APPROX-LABEL: @test_lgammaf(
1922// APPROX-NEXT:  entry:
1923// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_lgamma_f32(float noundef [[X:%.*]]) #[[ATTR14]]
1924// APPROX-NEXT:    ret float [[CALL_I]]
1925//
1926extern "C" __device__ float test_lgammaf(float x) {
1927  return lgammaf(x);
1928}
1929
1930// DEFAULT-LABEL: @test_lgamma(
1931// DEFAULT-NEXT:  entry:
1932// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_lgamma_f64(double noundef [[X:%.*]]) #[[ATTR14]]
1933// DEFAULT-NEXT:    ret double [[CALL_I]]
1934//
1935// FINITEONLY-LABEL: @test_lgamma(
1936// FINITEONLY-NEXT:  entry:
1937// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_lgamma_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
1938// FINITEONLY-NEXT:    ret double [[CALL_I]]
1939//
1940// APPROX-LABEL: @test_lgamma(
1941// APPROX-NEXT:  entry:
1942// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_lgamma_f64(double noundef [[X:%.*]]) #[[ATTR14]]
1943// APPROX-NEXT:    ret double [[CALL_I]]
1944//
1945extern "C" __device__ double test_lgamma(double x) {
1946  return lgamma(x);
1947}
1948
1949// DEFAULT-LABEL: @test_llrintf(
1950// DEFAULT-NEXT:  entry:
1951// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.rint.f32(float [[X:%.*]])
1952// DEFAULT-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
1953// DEFAULT-NEXT:    ret i64 [[CONV_I]]
1954//
1955// FINITEONLY-LABEL: @test_llrintf(
1956// FINITEONLY-NEXT:  entry:
1957// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract float @llvm.rint.f32(float [[X:%.*]])
1958// FINITEONLY-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
1959// FINITEONLY-NEXT:    ret i64 [[CONV_I]]
1960//
1961// APPROX-LABEL: @test_llrintf(
1962// APPROX-NEXT:  entry:
1963// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.rint.f32(float [[X:%.*]])
1964// APPROX-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
1965// APPROX-NEXT:    ret i64 [[CONV_I]]
1966//
1967extern "C" __device__ long long int test_llrintf(float x) {
1968  return llrintf(x);
1969}
1970
1971// DEFAULT-LABEL: @test_llrint(
1972// DEFAULT-NEXT:  entry:
1973// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.rint.f64(double [[X:%.*]])
1974// DEFAULT-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
1975// DEFAULT-NEXT:    ret i64 [[CONV_I]]
1976//
1977// FINITEONLY-LABEL: @test_llrint(
1978// FINITEONLY-NEXT:  entry:
1979// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract double @llvm.rint.f64(double [[X:%.*]])
1980// FINITEONLY-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
1981// FINITEONLY-NEXT:    ret i64 [[CONV_I]]
1982//
1983// APPROX-LABEL: @test_llrint(
1984// APPROX-NEXT:  entry:
1985// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.rint.f64(double [[X:%.*]])
1986// APPROX-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
1987// APPROX-NEXT:    ret i64 [[CONV_I]]
1988//
1989extern "C" __device__ long long int test_llrint(double x) {
1990  return llrint(x);
1991}
1992
1993// DEFAULT-LABEL: @test_llroundf(
1994// DEFAULT-NEXT:  entry:
1995// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.round.f32(float [[X:%.*]])
1996// DEFAULT-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
1997// DEFAULT-NEXT:    ret i64 [[CONV_I]]
1998//
1999// FINITEONLY-LABEL: @test_llroundf(
2000// FINITEONLY-NEXT:  entry:
2001// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract float @llvm.round.f32(float [[X:%.*]])
2002// FINITEONLY-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
2003// FINITEONLY-NEXT:    ret i64 [[CONV_I]]
2004//
2005// APPROX-LABEL: @test_llroundf(
2006// APPROX-NEXT:  entry:
2007// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.round.f32(float [[X:%.*]])
2008// APPROX-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
2009// APPROX-NEXT:    ret i64 [[CONV_I]]
2010//
2011extern "C" __device__ long long int test_llroundf(float x) {
2012  return llroundf(x);
2013}
2014
2015// DEFAULT-LABEL: @test_llround(
2016// DEFAULT-NEXT:  entry:
2017// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.round.f64(double [[X:%.*]])
2018// DEFAULT-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2019// DEFAULT-NEXT:    ret i64 [[CONV_I]]
2020//
2021// FINITEONLY-LABEL: @test_llround(
2022// FINITEONLY-NEXT:  entry:
2023// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract double @llvm.round.f64(double [[X:%.*]])
2024// FINITEONLY-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2025// FINITEONLY-NEXT:    ret i64 [[CONV_I]]
2026//
2027// APPROX-LABEL: @test_llround(
2028// APPROX-NEXT:  entry:
2029// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.round.f64(double [[X:%.*]])
2030// APPROX-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2031// APPROX-NEXT:    ret i64 [[CONV_I]]
2032//
2033extern "C" __device__ long long int test_llround(double x) {
2034  return llround(x);
2035}
2036
2037// DEFAULT-LABEL: @test_log10f(
2038// DEFAULT-NEXT:  entry:
2039// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.log10.f32(float [[X:%.*]])
2040// DEFAULT-NEXT:    ret float [[TMP0]]
2041//
2042// FINITEONLY-LABEL: @test_log10f(
2043// FINITEONLY-NEXT:  entry:
2044// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.log10.f32(float [[X:%.*]])
2045// FINITEONLY-NEXT:    ret float [[TMP0]]
2046//
2047// APPROX-LABEL: @test_log10f(
2048// APPROX-NEXT:  entry:
2049// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.log10.f32(float [[X:%.*]])
2050// APPROX-NEXT:    ret float [[TMP0]]
2051//
2052extern "C" __device__ float test_log10f(float x) {
2053  return log10f(x);
2054}
2055
2056// DEFAULT-LABEL: @test_log10(
2057// DEFAULT-NEXT:  entry:
2058// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log10_f64(double noundef [[X:%.*]]) #[[ATTR13]]
2059// DEFAULT-NEXT:    ret double [[CALL_I]]
2060//
2061// FINITEONLY-LABEL: @test_log10(
2062// FINITEONLY-NEXT:  entry:
2063// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log10_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
2064// FINITEONLY-NEXT:    ret double [[CALL_I]]
2065//
2066// APPROX-LABEL: @test_log10(
2067// APPROX-NEXT:  entry:
2068// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log10_f64(double noundef [[X:%.*]]) #[[ATTR13]]
2069// APPROX-NEXT:    ret double [[CALL_I]]
2070//
2071extern "C" __device__ double test_log10(double x) {
2072  return log10(x);
2073}
2074
2075// DEFAULT-LABEL: @test_log1pf(
2076// DEFAULT-NEXT:  entry:
2077// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log1p_f32(float noundef [[X:%.*]]) #[[ATTR13]]
2078// DEFAULT-NEXT:    ret float [[CALL_I]]
2079//
2080// FINITEONLY-LABEL: @test_log1pf(
2081// FINITEONLY-NEXT:  entry:
2082// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log1p_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
2083// FINITEONLY-NEXT:    ret float [[CALL_I]]
2084//
2085// APPROX-LABEL: @test_log1pf(
2086// APPROX-NEXT:  entry:
2087// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log1p_f32(float noundef [[X:%.*]]) #[[ATTR13]]
2088// APPROX-NEXT:    ret float [[CALL_I]]
2089//
2090extern "C" __device__ float test_log1pf(float x) {
2091  return log1pf(x);
2092}
2093
2094// DEFAULT-LABEL: @test_log1p(
2095// DEFAULT-NEXT:  entry:
2096// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log1p_f64(double noundef [[X:%.*]]) #[[ATTR13]]
2097// DEFAULT-NEXT:    ret double [[CALL_I]]
2098//
2099// FINITEONLY-LABEL: @test_log1p(
2100// FINITEONLY-NEXT:  entry:
2101// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log1p_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
2102// FINITEONLY-NEXT:    ret double [[CALL_I]]
2103//
2104// APPROX-LABEL: @test_log1p(
2105// APPROX-NEXT:  entry:
2106// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log1p_f64(double noundef [[X:%.*]]) #[[ATTR13]]
2107// APPROX-NEXT:    ret double [[CALL_I]]
2108//
2109extern "C" __device__ double test_log1p(double x) {
2110  return log1p(x);
2111}
2112
2113// DEFAULT-LABEL: @test_log2f(
2114// DEFAULT-NEXT:  entry:
2115// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log2_f32(float noundef [[X:%.*]]) #[[ATTR13]]
2116// DEFAULT-NEXT:    ret float [[CALL_I]]
2117//
2118// FINITEONLY-LABEL: @test_log2f(
2119// FINITEONLY-NEXT:  entry:
2120// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log2_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
2121// FINITEONLY-NEXT:    ret float [[CALL_I]]
2122//
2123// APPROX-LABEL: @test_log2f(
2124// APPROX-NEXT:  entry:
2125// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.log.f32(float [[X:%.*]])
2126// APPROX-NEXT:    ret float [[TMP0]]
2127//
2128extern "C" __device__ float test_log2f(float x) {
2129  return log2f(x);
2130}
2131
2132// DEFAULT-LABEL: @test_log2(
2133// DEFAULT-NEXT:  entry:
2134// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log2_f64(double noundef [[X:%.*]]) #[[ATTR13]]
2135// DEFAULT-NEXT:    ret double [[CALL_I]]
2136//
2137// FINITEONLY-LABEL: @test_log2(
2138// FINITEONLY-NEXT:  entry:
2139// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_log2_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
2140// FINITEONLY-NEXT:    ret double [[CALL_I]]
2141//
2142// APPROX-LABEL: @test_log2(
2143// APPROX-NEXT:  entry:
2144// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_log2_f64(double noundef [[X:%.*]]) #[[ATTR13]]
2145// APPROX-NEXT:    ret double [[CALL_I]]
2146//
2147extern "C" __device__ double test_log2(double x) {
2148  return log2(x);
2149}
2150
2151// DEFAULT-LABEL: @test_logbf(
2152// DEFAULT-NEXT:  entry:
2153// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_logb_f32(float noundef [[X:%.*]]) #[[ATTR12]]
2154// DEFAULT-NEXT:    ret float [[CALL_I]]
2155//
2156// FINITEONLY-LABEL: @test_logbf(
2157// FINITEONLY-NEXT:  entry:
2158// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_logb_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
2159// FINITEONLY-NEXT:    ret float [[CALL_I]]
2160//
2161// APPROX-LABEL: @test_logbf(
2162// APPROX-NEXT:  entry:
2163// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_logb_f32(float noundef [[X:%.*]]) #[[ATTR12]]
2164// APPROX-NEXT:    ret float [[CALL_I]]
2165//
2166extern "C" __device__ float test_logbf(float x) {
2167  return logbf(x);
2168}
2169
2170// DEFAULT-LABEL: @test_logb(
2171// DEFAULT-NEXT:  entry:
2172// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_logb_f64(double noundef [[X:%.*]]) #[[ATTR12]]
2173// DEFAULT-NEXT:    ret double [[CALL_I]]
2174//
2175// FINITEONLY-LABEL: @test_logb(
2176// FINITEONLY-NEXT:  entry:
2177// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_logb_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
2178// FINITEONLY-NEXT:    ret double [[CALL_I]]
2179//
2180// APPROX-LABEL: @test_logb(
2181// APPROX-NEXT:  entry:
2182// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_logb_f64(double noundef [[X:%.*]]) #[[ATTR12]]
2183// APPROX-NEXT:    ret double [[CALL_I]]
2184//
2185extern "C" __device__ double test_logb(double x) {
2186  return logb(x);
2187}
2188
2189// DEFAULT-LABEL: @test_logf(
2190// DEFAULT-NEXT:  entry:
2191// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_log_f32(float noundef [[X:%.*]]) #[[ATTR13]]
2192// DEFAULT-NEXT:    ret float [[CALL_I]]
2193//
2194// FINITEONLY-LABEL: @test_logf(
2195// FINITEONLY-NEXT:  entry:
2196// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_log_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
2197// FINITEONLY-NEXT:    ret float [[CALL_I]]
2198//
2199// APPROX-LABEL: @test_logf(
2200// APPROX-NEXT:  entry:
2201// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.log.f32(float [[X:%.*]])
2202// APPROX-NEXT:    ret float [[TMP0]]
2203//
2204extern "C" __device__ float test_logf(float x) {
2205  return logf(x);
2206}
2207
2208// DEFAULT-LABEL: @test_lrintf(
2209// DEFAULT-NEXT:  entry:
2210// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.rint.f32(float [[X:%.*]])
2211// DEFAULT-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
2212// DEFAULT-NEXT:    ret i64 [[CONV_I]]
2213//
2214// FINITEONLY-LABEL: @test_lrintf(
2215// FINITEONLY-NEXT:  entry:
2216// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract float @llvm.rint.f32(float [[X:%.*]])
2217// FINITEONLY-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
2218// FINITEONLY-NEXT:    ret i64 [[CONV_I]]
2219//
2220// APPROX-LABEL: @test_lrintf(
2221// APPROX-NEXT:  entry:
2222// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.rint.f32(float [[X:%.*]])
2223// APPROX-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
2224// APPROX-NEXT:    ret i64 [[CONV_I]]
2225//
2226extern "C" __device__ long int test_lrintf(float x) {
2227  return lrintf(x);
2228}
2229
2230// DEFAULT-LABEL: @test_lrint(
2231// DEFAULT-NEXT:  entry:
2232// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.rint.f64(double [[X:%.*]])
2233// DEFAULT-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2234// DEFAULT-NEXT:    ret i64 [[CONV_I]]
2235//
2236// FINITEONLY-LABEL: @test_lrint(
2237// FINITEONLY-NEXT:  entry:
2238// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract double @llvm.rint.f64(double [[X:%.*]])
2239// FINITEONLY-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2240// FINITEONLY-NEXT:    ret i64 [[CONV_I]]
2241//
2242// APPROX-LABEL: @test_lrint(
2243// APPROX-NEXT:  entry:
2244// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.rint.f64(double [[X:%.*]])
2245// APPROX-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2246// APPROX-NEXT:    ret i64 [[CONV_I]]
2247//
2248extern "C" __device__ long int test_lrint(double x) {
2249  return lrint(x);
2250}
2251
2252// DEFAULT-LABEL: @test_lroundf(
2253// DEFAULT-NEXT:  entry:
2254// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.round.f32(float [[X:%.*]])
2255// DEFAULT-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
2256// DEFAULT-NEXT:    ret i64 [[CONV_I]]
2257//
2258// FINITEONLY-LABEL: @test_lroundf(
2259// FINITEONLY-NEXT:  entry:
2260// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract float @llvm.round.f32(float [[X:%.*]])
2261// FINITEONLY-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
2262// FINITEONLY-NEXT:    ret i64 [[CONV_I]]
2263//
2264// APPROX-LABEL: @test_lroundf(
2265// APPROX-NEXT:  entry:
2266// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.round.f32(float [[X:%.*]])
2267// APPROX-NEXT:    [[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
2268// APPROX-NEXT:    ret i64 [[CONV_I]]
2269//
2270extern "C" __device__ long int test_lroundf(float x) {
2271  return lroundf(x);
2272}
2273
2274// DEFAULT-LABEL: @test_lround(
2275// DEFAULT-NEXT:  entry:
2276// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.round.f64(double [[X:%.*]])
2277// DEFAULT-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2278// DEFAULT-NEXT:    ret i64 [[CONV_I]]
2279//
2280// FINITEONLY-LABEL: @test_lround(
2281// FINITEONLY-NEXT:  entry:
2282// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract double @llvm.round.f64(double [[X:%.*]])
2283// FINITEONLY-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2284// FINITEONLY-NEXT:    ret i64 [[CONV_I]]
2285//
2286// APPROX-LABEL: @test_lround(
2287// APPROX-NEXT:  entry:
2288// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.round.f64(double [[X:%.*]])
2289// APPROX-NEXT:    [[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
2290// APPROX-NEXT:    ret i64 [[CONV_I]]
2291//
2292extern "C" __device__ long int test_lround(double x) {
2293  return lround(x);
2294}
2295
2296// DEFAULT-LABEL: @test_modff(
2297// DEFAULT-NEXT:  entry:
2298// DEFAULT-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
2299// DEFAULT-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15:[0-9]+]]
2300// DEFAULT-NEXT:    [[CALL_I:%.*]] = call contract noundef float @__ocml_modf_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
2301// DEFAULT-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16:![0-9]+]]
2302// DEFAULT-NEXT:    store float [[TMP0]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
2303// DEFAULT-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2304// DEFAULT-NEXT:    ret float [[CALL_I]]
2305//
2306// FINITEONLY-LABEL: @test_modff(
2307// FINITEONLY-NEXT:  entry:
2308// FINITEONLY-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
2309// FINITEONLY-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15:[0-9]+]]
2310// FINITEONLY-NEXT:    [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_modf_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
2311// FINITEONLY-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16:![0-9]+]]
2312// FINITEONLY-NEXT:    store float [[TMP0]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
2313// FINITEONLY-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2314// FINITEONLY-NEXT:    ret float [[CALL_I]]
2315//
2316// APPROX-LABEL: @test_modff(
2317// APPROX-NEXT:  entry:
2318// APPROX-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
2319// APPROX-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15:[0-9]+]]
2320// APPROX-NEXT:    [[CALL_I:%.*]] = call contract noundef float @__ocml_modf_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
2321// APPROX-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16:![0-9]+]]
2322// APPROX-NEXT:    store float [[TMP0]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
2323// APPROX-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2324// APPROX-NEXT:    ret float [[CALL_I]]
2325//
2326extern "C" __device__ float test_modff(float x, float* y) {
2327  return modff(x, y);
2328}
2329
2330// DEFAULT-LABEL: @test_modf(
2331// DEFAULT-NEXT:  entry:
2332// DEFAULT-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
2333// DEFAULT-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2334// DEFAULT-NEXT:    [[CALL_I:%.*]] = call contract noundef double @__ocml_modf_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
2335// DEFAULT-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18:![0-9]+]]
2336// DEFAULT-NEXT:    store double [[TMP0]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
2337// DEFAULT-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2338// DEFAULT-NEXT:    ret double [[CALL_I]]
2339//
2340// FINITEONLY-LABEL: @test_modf(
2341// FINITEONLY-NEXT:  entry:
2342// FINITEONLY-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
2343// FINITEONLY-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2344// FINITEONLY-NEXT:    [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_modf_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
2345// FINITEONLY-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18:![0-9]+]]
2346// FINITEONLY-NEXT:    store double [[TMP0]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
2347// FINITEONLY-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2348// FINITEONLY-NEXT:    ret double [[CALL_I]]
2349//
2350// APPROX-LABEL: @test_modf(
2351// APPROX-NEXT:  entry:
2352// APPROX-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
2353// APPROX-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2354// APPROX-NEXT:    [[CALL_I:%.*]] = call contract noundef double @__ocml_modf_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
2355// APPROX-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18:![0-9]+]]
2356// APPROX-NEXT:    store double [[TMP0]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
2357// APPROX-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
2358// APPROX-NEXT:    ret double [[CALL_I]]
2359//
2360extern "C" __device__ double test_modf(double x, double* y) {
2361  return modf(x, y);
2362}
2363
2364// DEFAULT-LABEL: @test_nanf(
2365// DEFAULT-NEXT:  entry:
2366// DEFAULT-NEXT:    [[TMP0:%.*]] = load i8, ptr [[TAG:%.*]], align 1, !tbaa [[TBAA4]]
2367// DEFAULT-NEXT:    [[CMP_I_I:%.*]] = icmp eq i8 [[TMP0]], 48
2368// DEFAULT-NEXT:    br i1 [[CMP_I_I]], label [[IF_THEN_I_I:%.*]], label [[WHILE_COND_I14_I_I:%.*]]
2369// DEFAULT:       if.then.i.i:
2370// DEFAULT-NEXT:    [[INCDEC_PTR_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[TAG]], i64 1
2371// DEFAULT-NEXT:    [[TMP1:%.*]] = load i8, ptr [[INCDEC_PTR_I_I]], align 1, !tbaa [[TBAA4]]
2372// DEFAULT-NEXT:    switch i8 [[TMP1]], label [[WHILE_COND_I_I_I:%.*]] [
2373// DEFAULT-NEXT:      i8 120, label [[WHILE_COND_I30_I_I_PREHEADER:%.*]]
2374// DEFAULT-NEXT:      i8 88, label [[WHILE_COND_I30_I_I_PREHEADER]]
2375// DEFAULT-NEXT:    ]
2376// DEFAULT:       while.cond.i30.i.i.preheader:
2377// DEFAULT-NEXT:    br label [[WHILE_COND_I30_I_I:%.*]]
2378// DEFAULT:       while.cond.i30.i.i:
2379// DEFAULT-NEXT:    [[__TAGP_ADDR_0_I31_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I37_I_I:%.*]], [[CLEANUP_I36_I_I:%.*]] ], [ [[INCDEC_PTR_I_I]], [[WHILE_COND_I30_I_I_PREHEADER]] ]
2380// DEFAULT-NEXT:    [[__R_0_I32_I_I:%.*]] = phi i64 [ [[__R_2_I_I_I:%.*]], [[CLEANUP_I36_I_I]] ], [ 0, [[WHILE_COND_I30_I_I_PREHEADER]] ]
2381// DEFAULT-NEXT:    [[TMP2:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I31_I_I]], align 1, !tbaa [[TBAA4]]
2382// DEFAULT-NEXT:    [[CMP_NOT_I33_I_I:%.*]] = icmp eq i8 [[TMP2]], 0
2383// DEFAULT-NEXT:    br i1 [[CMP_NOT_I33_I_I]], label [[_ZL4NANFPKC_EXIT:%.*]], label [[WHILE_BODY_I34_I_I:%.*]]
2384// DEFAULT:       while.body.i34.i.i:
2385// DEFAULT-NEXT:    [[TMP3:%.*]] = add i8 [[TMP2]], -48
2386// DEFAULT-NEXT:    [[OR_COND_I35_I_I:%.*]] = icmp ult i8 [[TMP3]], 10
2387// DEFAULT-NEXT:    br i1 [[OR_COND_I35_I_I]], label [[IF_END31_I_I_I:%.*]], label [[IF_ELSE_I_I_I:%.*]]
2388// DEFAULT:       if.else.i.i.i:
2389// DEFAULT-NEXT:    [[TMP4:%.*]] = add i8 [[TMP2]], -97
2390// DEFAULT-NEXT:    [[OR_COND33_I_I_I:%.*]] = icmp ult i8 [[TMP4]], 6
2391// DEFAULT-NEXT:    br i1 [[OR_COND33_I_I_I]], label [[IF_END31_I_I_I]], label [[IF_ELSE17_I_I_I:%.*]]
2392// DEFAULT:       if.else17.i.i.i:
2393// DEFAULT-NEXT:    [[TMP5:%.*]] = add i8 [[TMP2]], -65
2394// DEFAULT-NEXT:    [[OR_COND34_I_I_I:%.*]] = icmp ult i8 [[TMP5]], 6
2395// DEFAULT-NEXT:    br i1 [[OR_COND34_I_I_I]], label [[IF_END31_I_I_I]], label [[CLEANUP_I36_I_I]]
2396// DEFAULT:       if.end31.i.i.i:
2397// DEFAULT-NEXT:    [[DOTSINK:%.*]] = phi i64 [ -48, [[WHILE_BODY_I34_I_I]] ], [ -87, [[IF_ELSE_I_I_I]] ], [ -55, [[IF_ELSE17_I_I_I]] ]
2398// DEFAULT-NEXT:    [[MUL24_I_I_I:%.*]] = shl i64 [[__R_0_I32_I_I]], 4
2399// DEFAULT-NEXT:    [[CONV25_I_I_I:%.*]] = zext nneg i8 [[TMP2]] to i64
2400// DEFAULT-NEXT:    [[ADD26_I_I_I:%.*]] = add i64 [[MUL24_I_I_I]], [[DOTSINK]]
2401// DEFAULT-NEXT:    [[ADD28_I_I_I:%.*]] = add i64 [[ADD26_I_I_I]], [[CONV25_I_I_I]]
2402// DEFAULT-NEXT:    [[INCDEC_PTR_I40_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I31_I_I]], i64 1
2403// DEFAULT-NEXT:    br label [[CLEANUP_I36_I_I]]
2404// DEFAULT:       cleanup.i36.i.i:
2405// DEFAULT-NEXT:    [[__TAGP_ADDR_1_I37_I_I]] = phi ptr [ [[INCDEC_PTR_I40_I_I]], [[IF_END31_I_I_I]] ], [ [[__TAGP_ADDR_0_I31_I_I]], [[IF_ELSE17_I_I_I]] ]
2406// DEFAULT-NEXT:    [[__R_2_I_I_I]] = phi i64 [ [[ADD28_I_I_I]], [[IF_END31_I_I_I]] ], [ [[__R_0_I32_I_I]], [[IF_ELSE17_I_I_I]] ]
2407// DEFAULT-NEXT:    [[COND_I_I_I:%.*]] = phi i1 [ true, [[IF_END31_I_I_I]] ], [ false, [[IF_ELSE17_I_I_I]] ]
2408// DEFAULT-NEXT:    br i1 [[COND_I_I_I]], label [[WHILE_COND_I30_I_I]], label [[_ZL4NANFPKC_EXIT]], !llvm.loop [[LOOP11]]
2409// DEFAULT:       while.cond.i.i.i:
2410// DEFAULT-NEXT:    [[__TAGP_ADDR_0_I_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I_I_I:%.*]], [[CLEANUP_I_I_I:%.*]] ], [ [[INCDEC_PTR_I_I]], [[IF_THEN_I_I]] ]
2411// DEFAULT-NEXT:    [[__R_0_I_I_I:%.*]] = phi i64 [ [[__R_1_I_I_I:%.*]], [[CLEANUP_I_I_I]] ], [ 0, [[IF_THEN_I_I]] ]
2412// DEFAULT-NEXT:    [[TMP6:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I_I_I]], align 1, !tbaa [[TBAA4]]
2413// DEFAULT-NEXT:    [[CMP_NOT_I_I_I:%.*]] = icmp eq i8 [[TMP6]], 0
2414// DEFAULT-NEXT:    br i1 [[CMP_NOT_I_I_I]], label [[_ZL4NANFPKC_EXIT]], label [[WHILE_BODY_I_I_I:%.*]]
2415// DEFAULT:       while.body.i.i.i:
2416// DEFAULT-NEXT:    [[TMP7:%.*]] = and i8 [[TMP6]], -8
2417// DEFAULT-NEXT:    [[OR_COND_I_I_I:%.*]] = icmp eq i8 [[TMP7]], 48
2418// DEFAULT-NEXT:    br i1 [[OR_COND_I_I_I]], label [[IF_THEN_I_I_I:%.*]], label [[CLEANUP_I_I_I]]
2419// DEFAULT:       if.then.i.i.i:
2420// DEFAULT-NEXT:    [[MUL_I_I_I:%.*]] = shl i64 [[__R_0_I_I_I]], 3
2421// DEFAULT-NEXT:    [[CONV5_I_I_I:%.*]] = zext nneg i8 [[TMP6]] to i64
2422// DEFAULT-NEXT:    [[ADD_I_I_I:%.*]] = add i64 [[MUL_I_I_I]], -48
2423// DEFAULT-NEXT:    [[SUB_I_I_I:%.*]] = add i64 [[ADD_I_I_I]], [[CONV5_I_I_I]]
2424// DEFAULT-NEXT:    [[INCDEC_PTR_I_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I_I_I]], i64 1
2425// DEFAULT-NEXT:    br label [[CLEANUP_I_I_I]]
2426// DEFAULT:       cleanup.i.i.i:
2427// DEFAULT-NEXT:    [[__TAGP_ADDR_1_I_I_I]] = phi ptr [ [[INCDEC_PTR_I_I_I]], [[IF_THEN_I_I_I]] ], [ [[__TAGP_ADDR_0_I_I_I]], [[WHILE_BODY_I_I_I]] ]
2428// DEFAULT-NEXT:    [[__R_1_I_I_I]] = phi i64 [ [[SUB_I_I_I]], [[IF_THEN_I_I_I]] ], [ [[__R_0_I_I_I]], [[WHILE_BODY_I_I_I]] ]
2429// DEFAULT-NEXT:    br i1 [[OR_COND_I_I_I]], label [[WHILE_COND_I_I_I]], label [[_ZL4NANFPKC_EXIT]], !llvm.loop [[LOOP7]]
2430// DEFAULT:       while.cond.i14.i.i:
2431// DEFAULT-NEXT:    [[__TAGP_ADDR_0_I15_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I21_I_I:%.*]], [[CLEANUP_I20_I_I:%.*]] ], [ [[TAG]], [[ENTRY:%.*]] ]
2432// DEFAULT-NEXT:    [[__R_0_I16_I_I:%.*]] = phi i64 [ [[__R_1_I22_I_I:%.*]], [[CLEANUP_I20_I_I]] ], [ 0, [[ENTRY]] ]
2433// DEFAULT-NEXT:    [[TMP8:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I15_I_I]], align 1, !tbaa [[TBAA4]]
2434// DEFAULT-NEXT:    [[CMP_NOT_I17_I_I:%.*]] = icmp eq i8 [[TMP8]], 0
2435// DEFAULT-NEXT:    br i1 [[CMP_NOT_I17_I_I]], label [[_ZL4NANFPKC_EXIT]], label [[WHILE_BODY_I18_I_I:%.*]]
2436// DEFAULT:       while.body.i18.i.i:
2437// DEFAULT-NEXT:    [[TMP9:%.*]] = add i8 [[TMP8]], -48
2438// DEFAULT-NEXT:    [[OR_COND_I19_I_I:%.*]] = icmp ult i8 [[TMP9]], 10
2439// DEFAULT-NEXT:    br i1 [[OR_COND_I19_I_I]], label [[IF_THEN_I24_I_I:%.*]], label [[CLEANUP_I20_I_I]]
2440// DEFAULT:       if.then.i24.i.i:
2441// DEFAULT-NEXT:    [[MUL_I25_I_I:%.*]] = mul i64 [[__R_0_I16_I_I]], 10
2442// DEFAULT-NEXT:    [[CONV5_I26_I_I:%.*]] = zext nneg i8 [[TMP8]] to i64
2443// DEFAULT-NEXT:    [[ADD_I27_I_I:%.*]] = add i64 [[MUL_I25_I_I]], -48
2444// DEFAULT-NEXT:    [[SUB_I28_I_I:%.*]] = add i64 [[ADD_I27_I_I]], [[CONV5_I26_I_I]]
2445// DEFAULT-NEXT:    [[INCDEC_PTR_I29_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I15_I_I]], i64 1
2446// DEFAULT-NEXT:    br label [[CLEANUP_I20_I_I]]
2447// DEFAULT:       cleanup.i20.i.i:
2448// DEFAULT-NEXT:    [[__TAGP_ADDR_1_I21_I_I]] = phi ptr [ [[INCDEC_PTR_I29_I_I]], [[IF_THEN_I24_I_I]] ], [ [[__TAGP_ADDR_0_I15_I_I]], [[WHILE_BODY_I18_I_I]] ]
2449// DEFAULT-NEXT:    [[__R_1_I22_I_I]] = phi i64 [ [[SUB_I28_I_I]], [[IF_THEN_I24_I_I]] ], [ [[__R_0_I16_I_I]], [[WHILE_BODY_I18_I_I]] ]
2450// DEFAULT-NEXT:    br i1 [[OR_COND_I19_I_I]], label [[WHILE_COND_I14_I_I]], label [[_ZL4NANFPKC_EXIT]], !llvm.loop [[LOOP10]]
2451// DEFAULT:       _ZL4nanfPKc.exit:
2452// DEFAULT-NEXT:    [[RETVAL_0_I_I:%.*]] = phi i64 [ 0, [[CLEANUP_I_I_I]] ], [ [[__R_0_I_I_I]], [[WHILE_COND_I_I_I]] ], [ 0, [[CLEANUP_I36_I_I]] ], [ [[__R_0_I32_I_I]], [[WHILE_COND_I30_I_I]] ], [ 0, [[CLEANUP_I20_I_I]] ], [ [[__R_0_I16_I_I]], [[WHILE_COND_I14_I_I]] ]
2453// DEFAULT-NEXT:    [[CONV_I:%.*]] = trunc i64 [[RETVAL_0_I_I]] to i32
2454// DEFAULT-NEXT:    [[BF_VALUE_I:%.*]] = and i32 [[CONV_I]], 4194303
2455// DEFAULT-NEXT:    [[BF_SET9_I:%.*]] = or disjoint i32 [[BF_VALUE_I]], 2143289344
2456// DEFAULT-NEXT:    [[TMP10:%.*]] = bitcast i32 [[BF_SET9_I]] to float
2457// DEFAULT-NEXT:    ret float [[TMP10]]
2458//
2459// FINITEONLY-LABEL: @test_nanf(
2460// FINITEONLY-NEXT:  entry:
2461// FINITEONLY-NEXT:    ret float poison
2462//
2463// APPROX-LABEL: @test_nanf(
2464// APPROX-NEXT:  entry:
2465// APPROX-NEXT:    [[TMP0:%.*]] = load i8, ptr [[TAG:%.*]], align 1, !tbaa [[TBAA4]]
2466// APPROX-NEXT:    [[CMP_I_I:%.*]] = icmp eq i8 [[TMP0]], 48
2467// APPROX-NEXT:    br i1 [[CMP_I_I]], label [[IF_THEN_I_I:%.*]], label [[WHILE_COND_I14_I_I:%.*]]
2468// APPROX:       if.then.i.i:
2469// APPROX-NEXT:    [[INCDEC_PTR_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[TAG]], i64 1
2470// APPROX-NEXT:    [[TMP1:%.*]] = load i8, ptr [[INCDEC_PTR_I_I]], align 1, !tbaa [[TBAA4]]
2471// APPROX-NEXT:    switch i8 [[TMP1]], label [[WHILE_COND_I_I_I:%.*]] [
2472// APPROX-NEXT:      i8 120, label [[WHILE_COND_I30_I_I_PREHEADER:%.*]]
2473// APPROX-NEXT:      i8 88, label [[WHILE_COND_I30_I_I_PREHEADER]]
2474// APPROX-NEXT:    ]
2475// APPROX:       while.cond.i30.i.i.preheader:
2476// APPROX-NEXT:    br label [[WHILE_COND_I30_I_I:%.*]]
2477// APPROX:       while.cond.i30.i.i:
2478// APPROX-NEXT:    [[__TAGP_ADDR_0_I31_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I37_I_I:%.*]], [[CLEANUP_I36_I_I:%.*]] ], [ [[INCDEC_PTR_I_I]], [[WHILE_COND_I30_I_I_PREHEADER]] ]
2479// APPROX-NEXT:    [[__R_0_I32_I_I:%.*]] = phi i64 [ [[__R_2_I_I_I:%.*]], [[CLEANUP_I36_I_I]] ], [ 0, [[WHILE_COND_I30_I_I_PREHEADER]] ]
2480// APPROX-NEXT:    [[TMP2:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I31_I_I]], align 1, !tbaa [[TBAA4]]
2481// APPROX-NEXT:    [[CMP_NOT_I33_I_I:%.*]] = icmp eq i8 [[TMP2]], 0
2482// APPROX-NEXT:    br i1 [[CMP_NOT_I33_I_I]], label [[_ZL4NANFPKC_EXIT:%.*]], label [[WHILE_BODY_I34_I_I:%.*]]
2483// APPROX:       while.body.i34.i.i:
2484// APPROX-NEXT:    [[TMP3:%.*]] = add i8 [[TMP2]], -48
2485// APPROX-NEXT:    [[OR_COND_I35_I_I:%.*]] = icmp ult i8 [[TMP3]], 10
2486// APPROX-NEXT:    br i1 [[OR_COND_I35_I_I]], label [[IF_END31_I_I_I:%.*]], label [[IF_ELSE_I_I_I:%.*]]
2487// APPROX:       if.else.i.i.i:
2488// APPROX-NEXT:    [[TMP4:%.*]] = add i8 [[TMP2]], -97
2489// APPROX-NEXT:    [[OR_COND33_I_I_I:%.*]] = icmp ult i8 [[TMP4]], 6
2490// APPROX-NEXT:    br i1 [[OR_COND33_I_I_I]], label [[IF_END31_I_I_I]], label [[IF_ELSE17_I_I_I:%.*]]
2491// APPROX:       if.else17.i.i.i:
2492// APPROX-NEXT:    [[TMP5:%.*]] = add i8 [[TMP2]], -65
2493// APPROX-NEXT:    [[OR_COND34_I_I_I:%.*]] = icmp ult i8 [[TMP5]], 6
2494// APPROX-NEXT:    br i1 [[OR_COND34_I_I_I]], label [[IF_END31_I_I_I]], label [[CLEANUP_I36_I_I]]
2495// APPROX:       if.end31.i.i.i:
2496// APPROX-NEXT:    [[DOTSINK:%.*]] = phi i64 [ -48, [[WHILE_BODY_I34_I_I]] ], [ -87, [[IF_ELSE_I_I_I]] ], [ -55, [[IF_ELSE17_I_I_I]] ]
2497// APPROX-NEXT:    [[MUL24_I_I_I:%.*]] = shl i64 [[__R_0_I32_I_I]], 4
2498// APPROX-NEXT:    [[CONV25_I_I_I:%.*]] = zext nneg i8 [[TMP2]] to i64
2499// APPROX-NEXT:    [[ADD26_I_I_I:%.*]] = add i64 [[MUL24_I_I_I]], [[DOTSINK]]
2500// APPROX-NEXT:    [[ADD28_I_I_I:%.*]] = add i64 [[ADD26_I_I_I]], [[CONV25_I_I_I]]
2501// APPROX-NEXT:    [[INCDEC_PTR_I40_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I31_I_I]], i64 1
2502// APPROX-NEXT:    br label [[CLEANUP_I36_I_I]]
2503// APPROX:       cleanup.i36.i.i:
2504// APPROX-NEXT:    [[__TAGP_ADDR_1_I37_I_I]] = phi ptr [ [[INCDEC_PTR_I40_I_I]], [[IF_END31_I_I_I]] ], [ [[__TAGP_ADDR_0_I31_I_I]], [[IF_ELSE17_I_I_I]] ]
2505// APPROX-NEXT:    [[__R_2_I_I_I]] = phi i64 [ [[ADD28_I_I_I]], [[IF_END31_I_I_I]] ], [ [[__R_0_I32_I_I]], [[IF_ELSE17_I_I_I]] ]
2506// APPROX-NEXT:    [[COND_I_I_I:%.*]] = phi i1 [ true, [[IF_END31_I_I_I]] ], [ false, [[IF_ELSE17_I_I_I]] ]
2507// APPROX-NEXT:    br i1 [[COND_I_I_I]], label [[WHILE_COND_I30_I_I]], label [[_ZL4NANFPKC_EXIT]], !llvm.loop [[LOOP11]]
2508// APPROX:       while.cond.i.i.i:
2509// APPROX-NEXT:    [[__TAGP_ADDR_0_I_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I_I_I:%.*]], [[CLEANUP_I_I_I:%.*]] ], [ [[INCDEC_PTR_I_I]], [[IF_THEN_I_I]] ]
2510// APPROX-NEXT:    [[__R_0_I_I_I:%.*]] = phi i64 [ [[__R_1_I_I_I:%.*]], [[CLEANUP_I_I_I]] ], [ 0, [[IF_THEN_I_I]] ]
2511// APPROX-NEXT:    [[TMP6:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I_I_I]], align 1, !tbaa [[TBAA4]]
2512// APPROX-NEXT:    [[CMP_NOT_I_I_I:%.*]] = icmp eq i8 [[TMP6]], 0
2513// APPROX-NEXT:    br i1 [[CMP_NOT_I_I_I]], label [[_ZL4NANFPKC_EXIT]], label [[WHILE_BODY_I_I_I:%.*]]
2514// APPROX:       while.body.i.i.i:
2515// APPROX-NEXT:    [[TMP7:%.*]] = and i8 [[TMP6]], -8
2516// APPROX-NEXT:    [[OR_COND_I_I_I:%.*]] = icmp eq i8 [[TMP7]], 48
2517// APPROX-NEXT:    br i1 [[OR_COND_I_I_I]], label [[IF_THEN_I_I_I:%.*]], label [[CLEANUP_I_I_I]]
2518// APPROX:       if.then.i.i.i:
2519// APPROX-NEXT:    [[MUL_I_I_I:%.*]] = shl i64 [[__R_0_I_I_I]], 3
2520// APPROX-NEXT:    [[CONV5_I_I_I:%.*]] = zext nneg i8 [[TMP6]] to i64
2521// APPROX-NEXT:    [[ADD_I_I_I:%.*]] = add i64 [[MUL_I_I_I]], -48
2522// APPROX-NEXT:    [[SUB_I_I_I:%.*]] = add i64 [[ADD_I_I_I]], [[CONV5_I_I_I]]
2523// APPROX-NEXT:    [[INCDEC_PTR_I_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I_I_I]], i64 1
2524// APPROX-NEXT:    br label [[CLEANUP_I_I_I]]
2525// APPROX:       cleanup.i.i.i:
2526// APPROX-NEXT:    [[__TAGP_ADDR_1_I_I_I]] = phi ptr [ [[INCDEC_PTR_I_I_I]], [[IF_THEN_I_I_I]] ], [ [[__TAGP_ADDR_0_I_I_I]], [[WHILE_BODY_I_I_I]] ]
2527// APPROX-NEXT:    [[__R_1_I_I_I]] = phi i64 [ [[SUB_I_I_I]], [[IF_THEN_I_I_I]] ], [ [[__R_0_I_I_I]], [[WHILE_BODY_I_I_I]] ]
2528// APPROX-NEXT:    br i1 [[OR_COND_I_I_I]], label [[WHILE_COND_I_I_I]], label [[_ZL4NANFPKC_EXIT]], !llvm.loop [[LOOP7]]
2529// APPROX:       while.cond.i14.i.i:
2530// APPROX-NEXT:    [[__TAGP_ADDR_0_I15_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I21_I_I:%.*]], [[CLEANUP_I20_I_I:%.*]] ], [ [[TAG]], [[ENTRY:%.*]] ]
2531// APPROX-NEXT:    [[__R_0_I16_I_I:%.*]] = phi i64 [ [[__R_1_I22_I_I:%.*]], [[CLEANUP_I20_I_I]] ], [ 0, [[ENTRY]] ]
2532// APPROX-NEXT:    [[TMP8:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I15_I_I]], align 1, !tbaa [[TBAA4]]
2533// APPROX-NEXT:    [[CMP_NOT_I17_I_I:%.*]] = icmp eq i8 [[TMP8]], 0
2534// APPROX-NEXT:    br i1 [[CMP_NOT_I17_I_I]], label [[_ZL4NANFPKC_EXIT]], label [[WHILE_BODY_I18_I_I:%.*]]
2535// APPROX:       while.body.i18.i.i:
2536// APPROX-NEXT:    [[TMP9:%.*]] = add i8 [[TMP8]], -48
2537// APPROX-NEXT:    [[OR_COND_I19_I_I:%.*]] = icmp ult i8 [[TMP9]], 10
2538// APPROX-NEXT:    br i1 [[OR_COND_I19_I_I]], label [[IF_THEN_I24_I_I:%.*]], label [[CLEANUP_I20_I_I]]
2539// APPROX:       if.then.i24.i.i:
2540// APPROX-NEXT:    [[MUL_I25_I_I:%.*]] = mul i64 [[__R_0_I16_I_I]], 10
2541// APPROX-NEXT:    [[CONV5_I26_I_I:%.*]] = zext nneg i8 [[TMP8]] to i64
2542// APPROX-NEXT:    [[ADD_I27_I_I:%.*]] = add i64 [[MUL_I25_I_I]], -48
2543// APPROX-NEXT:    [[SUB_I28_I_I:%.*]] = add i64 [[ADD_I27_I_I]], [[CONV5_I26_I_I]]
2544// APPROX-NEXT:    [[INCDEC_PTR_I29_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I15_I_I]], i64 1
2545// APPROX-NEXT:    br label [[CLEANUP_I20_I_I]]
2546// APPROX:       cleanup.i20.i.i:
2547// APPROX-NEXT:    [[__TAGP_ADDR_1_I21_I_I]] = phi ptr [ [[INCDEC_PTR_I29_I_I]], [[IF_THEN_I24_I_I]] ], [ [[__TAGP_ADDR_0_I15_I_I]], [[WHILE_BODY_I18_I_I]] ]
2548// APPROX-NEXT:    [[__R_1_I22_I_I]] = phi i64 [ [[SUB_I28_I_I]], [[IF_THEN_I24_I_I]] ], [ [[__R_0_I16_I_I]], [[WHILE_BODY_I18_I_I]] ]
2549// APPROX-NEXT:    br i1 [[OR_COND_I19_I_I]], label [[WHILE_COND_I14_I_I]], label [[_ZL4NANFPKC_EXIT]], !llvm.loop [[LOOP10]]
2550// APPROX:       _ZL4nanfPKc.exit:
2551// APPROX-NEXT:    [[RETVAL_0_I_I:%.*]] = phi i64 [ 0, [[CLEANUP_I_I_I]] ], [ [[__R_0_I_I_I]], [[WHILE_COND_I_I_I]] ], [ 0, [[CLEANUP_I36_I_I]] ], [ [[__R_0_I32_I_I]], [[WHILE_COND_I30_I_I]] ], [ 0, [[CLEANUP_I20_I_I]] ], [ [[__R_0_I16_I_I]], [[WHILE_COND_I14_I_I]] ]
2552// APPROX-NEXT:    [[CONV_I:%.*]] = trunc i64 [[RETVAL_0_I_I]] to i32
2553// APPROX-NEXT:    [[BF_VALUE_I:%.*]] = and i32 [[CONV_I]], 4194303
2554// APPROX-NEXT:    [[BF_SET9_I:%.*]] = or disjoint i32 [[BF_VALUE_I]], 2143289344
2555// APPROX-NEXT:    [[TMP10:%.*]] = bitcast i32 [[BF_SET9_I]] to float
2556// APPROX-NEXT:    ret float [[TMP10]]
2557//
2558extern "C" __device__ float test_nanf(const char *tag) {
2559  return nanf(tag);
2560}
2561
2562// DEFAULT-LABEL: @test_nan(
2563// DEFAULT-NEXT:  entry:
2564// DEFAULT-NEXT:    [[TMP0:%.*]] = load i8, ptr [[TAG:%.*]], align 1, !tbaa [[TBAA4]]
2565// DEFAULT-NEXT:    [[CMP_I_I:%.*]] = icmp eq i8 [[TMP0]], 48
2566// DEFAULT-NEXT:    br i1 [[CMP_I_I]], label [[IF_THEN_I_I:%.*]], label [[WHILE_COND_I14_I_I:%.*]]
2567// DEFAULT:       if.then.i.i:
2568// DEFAULT-NEXT:    [[INCDEC_PTR_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[TAG]], i64 1
2569// DEFAULT-NEXT:    [[TMP1:%.*]] = load i8, ptr [[INCDEC_PTR_I_I]], align 1, !tbaa [[TBAA4]]
2570// DEFAULT-NEXT:    switch i8 [[TMP1]], label [[WHILE_COND_I_I_I:%.*]] [
2571// DEFAULT-NEXT:      i8 120, label [[WHILE_COND_I30_I_I_PREHEADER:%.*]]
2572// DEFAULT-NEXT:      i8 88, label [[WHILE_COND_I30_I_I_PREHEADER]]
2573// DEFAULT-NEXT:    ]
2574// DEFAULT:       while.cond.i30.i.i.preheader:
2575// DEFAULT-NEXT:    br label [[WHILE_COND_I30_I_I:%.*]]
2576// DEFAULT:       while.cond.i30.i.i:
2577// DEFAULT-NEXT:    [[__TAGP_ADDR_0_I31_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I37_I_I:%.*]], [[CLEANUP_I36_I_I:%.*]] ], [ [[INCDEC_PTR_I_I]], [[WHILE_COND_I30_I_I_PREHEADER]] ]
2578// DEFAULT-NEXT:    [[__R_0_I32_I_I:%.*]] = phi i64 [ [[__R_2_I_I_I:%.*]], [[CLEANUP_I36_I_I]] ], [ 0, [[WHILE_COND_I30_I_I_PREHEADER]] ]
2579// DEFAULT-NEXT:    [[TMP2:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I31_I_I]], align 1, !tbaa [[TBAA4]]
2580// DEFAULT-NEXT:    [[CMP_NOT_I33_I_I:%.*]] = icmp eq i8 [[TMP2]], 0
2581// DEFAULT-NEXT:    br i1 [[CMP_NOT_I33_I_I]], label [[_ZL3NANPKC_EXIT:%.*]], label [[WHILE_BODY_I34_I_I:%.*]]
2582// DEFAULT:       while.body.i34.i.i:
2583// DEFAULT-NEXT:    [[TMP3:%.*]] = add i8 [[TMP2]], -48
2584// DEFAULT-NEXT:    [[OR_COND_I35_I_I:%.*]] = icmp ult i8 [[TMP3]], 10
2585// DEFAULT-NEXT:    br i1 [[OR_COND_I35_I_I]], label [[IF_END31_I_I_I:%.*]], label [[IF_ELSE_I_I_I:%.*]]
2586// DEFAULT:       if.else.i.i.i:
2587// DEFAULT-NEXT:    [[TMP4:%.*]] = add i8 [[TMP2]], -97
2588// DEFAULT-NEXT:    [[OR_COND33_I_I_I:%.*]] = icmp ult i8 [[TMP4]], 6
2589// DEFAULT-NEXT:    br i1 [[OR_COND33_I_I_I]], label [[IF_END31_I_I_I]], label [[IF_ELSE17_I_I_I:%.*]]
2590// DEFAULT:       if.else17.i.i.i:
2591// DEFAULT-NEXT:    [[TMP5:%.*]] = add i8 [[TMP2]], -65
2592// DEFAULT-NEXT:    [[OR_COND34_I_I_I:%.*]] = icmp ult i8 [[TMP5]], 6
2593// DEFAULT-NEXT:    br i1 [[OR_COND34_I_I_I]], label [[IF_END31_I_I_I]], label [[CLEANUP_I36_I_I]]
2594// DEFAULT:       if.end31.i.i.i:
2595// DEFAULT-NEXT:    [[DOTSINK:%.*]] = phi i64 [ -48, [[WHILE_BODY_I34_I_I]] ], [ -87, [[IF_ELSE_I_I_I]] ], [ -55, [[IF_ELSE17_I_I_I]] ]
2596// DEFAULT-NEXT:    [[MUL24_I_I_I:%.*]] = shl i64 [[__R_0_I32_I_I]], 4
2597// DEFAULT-NEXT:    [[CONV25_I_I_I:%.*]] = zext nneg i8 [[TMP2]] to i64
2598// DEFAULT-NEXT:    [[ADD26_I_I_I:%.*]] = add i64 [[MUL24_I_I_I]], [[DOTSINK]]
2599// DEFAULT-NEXT:    [[ADD28_I_I_I:%.*]] = add i64 [[ADD26_I_I_I]], [[CONV25_I_I_I]]
2600// DEFAULT-NEXT:    [[INCDEC_PTR_I40_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I31_I_I]], i64 1
2601// DEFAULT-NEXT:    br label [[CLEANUP_I36_I_I]]
2602// DEFAULT:       cleanup.i36.i.i:
2603// DEFAULT-NEXT:    [[__TAGP_ADDR_1_I37_I_I]] = phi ptr [ [[INCDEC_PTR_I40_I_I]], [[IF_END31_I_I_I]] ], [ [[__TAGP_ADDR_0_I31_I_I]], [[IF_ELSE17_I_I_I]] ]
2604// DEFAULT-NEXT:    [[__R_2_I_I_I]] = phi i64 [ [[ADD28_I_I_I]], [[IF_END31_I_I_I]] ], [ [[__R_0_I32_I_I]], [[IF_ELSE17_I_I_I]] ]
2605// DEFAULT-NEXT:    [[COND_I_I_I:%.*]] = phi i1 [ true, [[IF_END31_I_I_I]] ], [ false, [[IF_ELSE17_I_I_I]] ]
2606// DEFAULT-NEXT:    br i1 [[COND_I_I_I]], label [[WHILE_COND_I30_I_I]], label [[_ZL3NANPKC_EXIT]], !llvm.loop [[LOOP11]]
2607// DEFAULT:       while.cond.i.i.i:
2608// DEFAULT-NEXT:    [[__TAGP_ADDR_0_I_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I_I_I:%.*]], [[CLEANUP_I_I_I:%.*]] ], [ [[INCDEC_PTR_I_I]], [[IF_THEN_I_I]] ]
2609// DEFAULT-NEXT:    [[__R_0_I_I_I:%.*]] = phi i64 [ [[__R_1_I_I_I:%.*]], [[CLEANUP_I_I_I]] ], [ 0, [[IF_THEN_I_I]] ]
2610// DEFAULT-NEXT:    [[TMP6:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I_I_I]], align 1, !tbaa [[TBAA4]]
2611// DEFAULT-NEXT:    [[CMP_NOT_I_I_I:%.*]] = icmp eq i8 [[TMP6]], 0
2612// DEFAULT-NEXT:    br i1 [[CMP_NOT_I_I_I]], label [[_ZL3NANPKC_EXIT]], label [[WHILE_BODY_I_I_I:%.*]]
2613// DEFAULT:       while.body.i.i.i:
2614// DEFAULT-NEXT:    [[TMP7:%.*]] = and i8 [[TMP6]], -8
2615// DEFAULT-NEXT:    [[OR_COND_I_I_I:%.*]] = icmp eq i8 [[TMP7]], 48
2616// DEFAULT-NEXT:    br i1 [[OR_COND_I_I_I]], label [[IF_THEN_I_I_I:%.*]], label [[CLEANUP_I_I_I]]
2617// DEFAULT:       if.then.i.i.i:
2618// DEFAULT-NEXT:    [[MUL_I_I_I:%.*]] = shl i64 [[__R_0_I_I_I]], 3
2619// DEFAULT-NEXT:    [[CONV5_I_I_I:%.*]] = zext nneg i8 [[TMP6]] to i64
2620// DEFAULT-NEXT:    [[ADD_I_I_I:%.*]] = add i64 [[MUL_I_I_I]], -48
2621// DEFAULT-NEXT:    [[SUB_I_I_I:%.*]] = add i64 [[ADD_I_I_I]], [[CONV5_I_I_I]]
2622// DEFAULT-NEXT:    [[INCDEC_PTR_I_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I_I_I]], i64 1
2623// DEFAULT-NEXT:    br label [[CLEANUP_I_I_I]]
2624// DEFAULT:       cleanup.i.i.i:
2625// DEFAULT-NEXT:    [[__TAGP_ADDR_1_I_I_I]] = phi ptr [ [[INCDEC_PTR_I_I_I]], [[IF_THEN_I_I_I]] ], [ [[__TAGP_ADDR_0_I_I_I]], [[WHILE_BODY_I_I_I]] ]
2626// DEFAULT-NEXT:    [[__R_1_I_I_I]] = phi i64 [ [[SUB_I_I_I]], [[IF_THEN_I_I_I]] ], [ [[__R_0_I_I_I]], [[WHILE_BODY_I_I_I]] ]
2627// DEFAULT-NEXT:    br i1 [[OR_COND_I_I_I]], label [[WHILE_COND_I_I_I]], label [[_ZL3NANPKC_EXIT]], !llvm.loop [[LOOP7]]
2628// DEFAULT:       while.cond.i14.i.i:
2629// DEFAULT-NEXT:    [[__TAGP_ADDR_0_I15_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I21_I_I:%.*]], [[CLEANUP_I20_I_I:%.*]] ], [ [[TAG]], [[ENTRY:%.*]] ]
2630// DEFAULT-NEXT:    [[__R_0_I16_I_I:%.*]] = phi i64 [ [[__R_1_I22_I_I:%.*]], [[CLEANUP_I20_I_I]] ], [ 0, [[ENTRY]] ]
2631// DEFAULT-NEXT:    [[TMP8:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I15_I_I]], align 1, !tbaa [[TBAA4]]
2632// DEFAULT-NEXT:    [[CMP_NOT_I17_I_I:%.*]] = icmp eq i8 [[TMP8]], 0
2633// DEFAULT-NEXT:    br i1 [[CMP_NOT_I17_I_I]], label [[_ZL3NANPKC_EXIT]], label [[WHILE_BODY_I18_I_I:%.*]]
2634// DEFAULT:       while.body.i18.i.i:
2635// DEFAULT-NEXT:    [[TMP9:%.*]] = add i8 [[TMP8]], -48
2636// DEFAULT-NEXT:    [[OR_COND_I19_I_I:%.*]] = icmp ult i8 [[TMP9]], 10
2637// DEFAULT-NEXT:    br i1 [[OR_COND_I19_I_I]], label [[IF_THEN_I24_I_I:%.*]], label [[CLEANUP_I20_I_I]]
2638// DEFAULT:       if.then.i24.i.i:
2639// DEFAULT-NEXT:    [[MUL_I25_I_I:%.*]] = mul i64 [[__R_0_I16_I_I]], 10
2640// DEFAULT-NEXT:    [[CONV5_I26_I_I:%.*]] = zext nneg i8 [[TMP8]] to i64
2641// DEFAULT-NEXT:    [[ADD_I27_I_I:%.*]] = add i64 [[MUL_I25_I_I]], -48
2642// DEFAULT-NEXT:    [[SUB_I28_I_I:%.*]] = add i64 [[ADD_I27_I_I]], [[CONV5_I26_I_I]]
2643// DEFAULT-NEXT:    [[INCDEC_PTR_I29_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I15_I_I]], i64 1
2644// DEFAULT-NEXT:    br label [[CLEANUP_I20_I_I]]
2645// DEFAULT:       cleanup.i20.i.i:
2646// DEFAULT-NEXT:    [[__TAGP_ADDR_1_I21_I_I]] = phi ptr [ [[INCDEC_PTR_I29_I_I]], [[IF_THEN_I24_I_I]] ], [ [[__TAGP_ADDR_0_I15_I_I]], [[WHILE_BODY_I18_I_I]] ]
2647// DEFAULT-NEXT:    [[__R_1_I22_I_I]] = phi i64 [ [[SUB_I28_I_I]], [[IF_THEN_I24_I_I]] ], [ [[__R_0_I16_I_I]], [[WHILE_BODY_I18_I_I]] ]
2648// DEFAULT-NEXT:    br i1 [[OR_COND_I19_I_I]], label [[WHILE_COND_I14_I_I]], label [[_ZL3NANPKC_EXIT]], !llvm.loop [[LOOP10]]
2649// DEFAULT:       _ZL3nanPKc.exit:
2650// DEFAULT-NEXT:    [[RETVAL_0_I_I:%.*]] = phi i64 [ 0, [[CLEANUP_I_I_I]] ], [ [[__R_0_I_I_I]], [[WHILE_COND_I_I_I]] ], [ 0, [[CLEANUP_I36_I_I]] ], [ [[__R_0_I32_I_I]], [[WHILE_COND_I30_I_I]] ], [ 0, [[CLEANUP_I20_I_I]] ], [ [[__R_0_I16_I_I]], [[WHILE_COND_I14_I_I]] ]
2651// DEFAULT-NEXT:    [[BF_VALUE_I:%.*]] = and i64 [[RETVAL_0_I_I]], 2251799813685247
2652// DEFAULT-NEXT:    [[BF_SET9_I:%.*]] = or disjoint i64 [[BF_VALUE_I]], 9221120237041090560
2653// DEFAULT-NEXT:    [[TMP10:%.*]] = bitcast i64 [[BF_SET9_I]] to double
2654// DEFAULT-NEXT:    ret double [[TMP10]]
2655//
2656// FINITEONLY-LABEL: @test_nan(
2657// FINITEONLY-NEXT:  entry:
2658// FINITEONLY-NEXT:    ret double poison
2659//
2660// APPROX-LABEL: @test_nan(
2661// APPROX-NEXT:  entry:
2662// APPROX-NEXT:    [[TMP0:%.*]] = load i8, ptr [[TAG:%.*]], align 1, !tbaa [[TBAA4]]
2663// APPROX-NEXT:    [[CMP_I_I:%.*]] = icmp eq i8 [[TMP0]], 48
2664// APPROX-NEXT:    br i1 [[CMP_I_I]], label [[IF_THEN_I_I:%.*]], label [[WHILE_COND_I14_I_I:%.*]]
2665// APPROX:       if.then.i.i:
2666// APPROX-NEXT:    [[INCDEC_PTR_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[TAG]], i64 1
2667// APPROX-NEXT:    [[TMP1:%.*]] = load i8, ptr [[INCDEC_PTR_I_I]], align 1, !tbaa [[TBAA4]]
2668// APPROX-NEXT:    switch i8 [[TMP1]], label [[WHILE_COND_I_I_I:%.*]] [
2669// APPROX-NEXT:      i8 120, label [[WHILE_COND_I30_I_I_PREHEADER:%.*]]
2670// APPROX-NEXT:      i8 88, label [[WHILE_COND_I30_I_I_PREHEADER]]
2671// APPROX-NEXT:    ]
2672// APPROX:       while.cond.i30.i.i.preheader:
2673// APPROX-NEXT:    br label [[WHILE_COND_I30_I_I:%.*]]
2674// APPROX:       while.cond.i30.i.i:
2675// APPROX-NEXT:    [[__TAGP_ADDR_0_I31_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I37_I_I:%.*]], [[CLEANUP_I36_I_I:%.*]] ], [ [[INCDEC_PTR_I_I]], [[WHILE_COND_I30_I_I_PREHEADER]] ]
2676// APPROX-NEXT:    [[__R_0_I32_I_I:%.*]] = phi i64 [ [[__R_2_I_I_I:%.*]], [[CLEANUP_I36_I_I]] ], [ 0, [[WHILE_COND_I30_I_I_PREHEADER]] ]
2677// APPROX-NEXT:    [[TMP2:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I31_I_I]], align 1, !tbaa [[TBAA4]]
2678// APPROX-NEXT:    [[CMP_NOT_I33_I_I:%.*]] = icmp eq i8 [[TMP2]], 0
2679// APPROX-NEXT:    br i1 [[CMP_NOT_I33_I_I]], label [[_ZL3NANPKC_EXIT:%.*]], label [[WHILE_BODY_I34_I_I:%.*]]
2680// APPROX:       while.body.i34.i.i:
2681// APPROX-NEXT:    [[TMP3:%.*]] = add i8 [[TMP2]], -48
2682// APPROX-NEXT:    [[OR_COND_I35_I_I:%.*]] = icmp ult i8 [[TMP3]], 10
2683// APPROX-NEXT:    br i1 [[OR_COND_I35_I_I]], label [[IF_END31_I_I_I:%.*]], label [[IF_ELSE_I_I_I:%.*]]
2684// APPROX:       if.else.i.i.i:
2685// APPROX-NEXT:    [[TMP4:%.*]] = add i8 [[TMP2]], -97
2686// APPROX-NEXT:    [[OR_COND33_I_I_I:%.*]] = icmp ult i8 [[TMP4]], 6
2687// APPROX-NEXT:    br i1 [[OR_COND33_I_I_I]], label [[IF_END31_I_I_I]], label [[IF_ELSE17_I_I_I:%.*]]
2688// APPROX:       if.else17.i.i.i:
2689// APPROX-NEXT:    [[TMP5:%.*]] = add i8 [[TMP2]], -65
2690// APPROX-NEXT:    [[OR_COND34_I_I_I:%.*]] = icmp ult i8 [[TMP5]], 6
2691// APPROX-NEXT:    br i1 [[OR_COND34_I_I_I]], label [[IF_END31_I_I_I]], label [[CLEANUP_I36_I_I]]
2692// APPROX:       if.end31.i.i.i:
2693// APPROX-NEXT:    [[DOTSINK:%.*]] = phi i64 [ -48, [[WHILE_BODY_I34_I_I]] ], [ -87, [[IF_ELSE_I_I_I]] ], [ -55, [[IF_ELSE17_I_I_I]] ]
2694// APPROX-NEXT:    [[MUL24_I_I_I:%.*]] = shl i64 [[__R_0_I32_I_I]], 4
2695// APPROX-NEXT:    [[CONV25_I_I_I:%.*]] = zext nneg i8 [[TMP2]] to i64
2696// APPROX-NEXT:    [[ADD26_I_I_I:%.*]] = add i64 [[MUL24_I_I_I]], [[DOTSINK]]
2697// APPROX-NEXT:    [[ADD28_I_I_I:%.*]] = add i64 [[ADD26_I_I_I]], [[CONV25_I_I_I]]
2698// APPROX-NEXT:    [[INCDEC_PTR_I40_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I31_I_I]], i64 1
2699// APPROX-NEXT:    br label [[CLEANUP_I36_I_I]]
2700// APPROX:       cleanup.i36.i.i:
2701// APPROX-NEXT:    [[__TAGP_ADDR_1_I37_I_I]] = phi ptr [ [[INCDEC_PTR_I40_I_I]], [[IF_END31_I_I_I]] ], [ [[__TAGP_ADDR_0_I31_I_I]], [[IF_ELSE17_I_I_I]] ]
2702// APPROX-NEXT:    [[__R_2_I_I_I]] = phi i64 [ [[ADD28_I_I_I]], [[IF_END31_I_I_I]] ], [ [[__R_0_I32_I_I]], [[IF_ELSE17_I_I_I]] ]
2703// APPROX-NEXT:    [[COND_I_I_I:%.*]] = phi i1 [ true, [[IF_END31_I_I_I]] ], [ false, [[IF_ELSE17_I_I_I]] ]
2704// APPROX-NEXT:    br i1 [[COND_I_I_I]], label [[WHILE_COND_I30_I_I]], label [[_ZL3NANPKC_EXIT]], !llvm.loop [[LOOP11]]
2705// APPROX:       while.cond.i.i.i:
2706// APPROX-NEXT:    [[__TAGP_ADDR_0_I_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I_I_I:%.*]], [[CLEANUP_I_I_I:%.*]] ], [ [[INCDEC_PTR_I_I]], [[IF_THEN_I_I]] ]
2707// APPROX-NEXT:    [[__R_0_I_I_I:%.*]] = phi i64 [ [[__R_1_I_I_I:%.*]], [[CLEANUP_I_I_I]] ], [ 0, [[IF_THEN_I_I]] ]
2708// APPROX-NEXT:    [[TMP6:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I_I_I]], align 1, !tbaa [[TBAA4]]
2709// APPROX-NEXT:    [[CMP_NOT_I_I_I:%.*]] = icmp eq i8 [[TMP6]], 0
2710// APPROX-NEXT:    br i1 [[CMP_NOT_I_I_I]], label [[_ZL3NANPKC_EXIT]], label [[WHILE_BODY_I_I_I:%.*]]
2711// APPROX:       while.body.i.i.i:
2712// APPROX-NEXT:    [[TMP7:%.*]] = and i8 [[TMP6]], -8
2713// APPROX-NEXT:    [[OR_COND_I_I_I:%.*]] = icmp eq i8 [[TMP7]], 48
2714// APPROX-NEXT:    br i1 [[OR_COND_I_I_I]], label [[IF_THEN_I_I_I:%.*]], label [[CLEANUP_I_I_I]]
2715// APPROX:       if.then.i.i.i:
2716// APPROX-NEXT:    [[MUL_I_I_I:%.*]] = shl i64 [[__R_0_I_I_I]], 3
2717// APPROX-NEXT:    [[CONV5_I_I_I:%.*]] = zext nneg i8 [[TMP6]] to i64
2718// APPROX-NEXT:    [[ADD_I_I_I:%.*]] = add i64 [[MUL_I_I_I]], -48
2719// APPROX-NEXT:    [[SUB_I_I_I:%.*]] = add i64 [[ADD_I_I_I]], [[CONV5_I_I_I]]
2720// APPROX-NEXT:    [[INCDEC_PTR_I_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I_I_I]], i64 1
2721// APPROX-NEXT:    br label [[CLEANUP_I_I_I]]
2722// APPROX:       cleanup.i.i.i:
2723// APPROX-NEXT:    [[__TAGP_ADDR_1_I_I_I]] = phi ptr [ [[INCDEC_PTR_I_I_I]], [[IF_THEN_I_I_I]] ], [ [[__TAGP_ADDR_0_I_I_I]], [[WHILE_BODY_I_I_I]] ]
2724// APPROX-NEXT:    [[__R_1_I_I_I]] = phi i64 [ [[SUB_I_I_I]], [[IF_THEN_I_I_I]] ], [ [[__R_0_I_I_I]], [[WHILE_BODY_I_I_I]] ]
2725// APPROX-NEXT:    br i1 [[OR_COND_I_I_I]], label [[WHILE_COND_I_I_I]], label [[_ZL3NANPKC_EXIT]], !llvm.loop [[LOOP7]]
2726// APPROX:       while.cond.i14.i.i:
2727// APPROX-NEXT:    [[__TAGP_ADDR_0_I15_I_I:%.*]] = phi ptr [ [[__TAGP_ADDR_1_I21_I_I:%.*]], [[CLEANUP_I20_I_I:%.*]] ], [ [[TAG]], [[ENTRY:%.*]] ]
2728// APPROX-NEXT:    [[__R_0_I16_I_I:%.*]] = phi i64 [ [[__R_1_I22_I_I:%.*]], [[CLEANUP_I20_I_I]] ], [ 0, [[ENTRY]] ]
2729// APPROX-NEXT:    [[TMP8:%.*]] = load i8, ptr [[__TAGP_ADDR_0_I15_I_I]], align 1, !tbaa [[TBAA4]]
2730// APPROX-NEXT:    [[CMP_NOT_I17_I_I:%.*]] = icmp eq i8 [[TMP8]], 0
2731// APPROX-NEXT:    br i1 [[CMP_NOT_I17_I_I]], label [[_ZL3NANPKC_EXIT]], label [[WHILE_BODY_I18_I_I:%.*]]
2732// APPROX:       while.body.i18.i.i:
2733// APPROX-NEXT:    [[TMP9:%.*]] = add i8 [[TMP8]], -48
2734// APPROX-NEXT:    [[OR_COND_I19_I_I:%.*]] = icmp ult i8 [[TMP9]], 10
2735// APPROX-NEXT:    br i1 [[OR_COND_I19_I_I]], label [[IF_THEN_I24_I_I:%.*]], label [[CLEANUP_I20_I_I]]
2736// APPROX:       if.then.i24.i.i:
2737// APPROX-NEXT:    [[MUL_I25_I_I:%.*]] = mul i64 [[__R_0_I16_I_I]], 10
2738// APPROX-NEXT:    [[CONV5_I26_I_I:%.*]] = zext nneg i8 [[TMP8]] to i64
2739// APPROX-NEXT:    [[ADD_I27_I_I:%.*]] = add i64 [[MUL_I25_I_I]], -48
2740// APPROX-NEXT:    [[SUB_I28_I_I:%.*]] = add i64 [[ADD_I27_I_I]], [[CONV5_I26_I_I]]
2741// APPROX-NEXT:    [[INCDEC_PTR_I29_I_I:%.*]] = getelementptr inbounds nuw i8, ptr [[__TAGP_ADDR_0_I15_I_I]], i64 1
2742// APPROX-NEXT:    br label [[CLEANUP_I20_I_I]]
2743// APPROX:       cleanup.i20.i.i:
2744// APPROX-NEXT:    [[__TAGP_ADDR_1_I21_I_I]] = phi ptr [ [[INCDEC_PTR_I29_I_I]], [[IF_THEN_I24_I_I]] ], [ [[__TAGP_ADDR_0_I15_I_I]], [[WHILE_BODY_I18_I_I]] ]
2745// APPROX-NEXT:    [[__R_1_I22_I_I]] = phi i64 [ [[SUB_I28_I_I]], [[IF_THEN_I24_I_I]] ], [ [[__R_0_I16_I_I]], [[WHILE_BODY_I18_I_I]] ]
2746// APPROX-NEXT:    br i1 [[OR_COND_I19_I_I]], label [[WHILE_COND_I14_I_I]], label [[_ZL3NANPKC_EXIT]], !llvm.loop [[LOOP10]]
2747// APPROX:       _ZL3nanPKc.exit:
2748// APPROX-NEXT:    [[RETVAL_0_I_I:%.*]] = phi i64 [ 0, [[CLEANUP_I_I_I]] ], [ [[__R_0_I_I_I]], [[WHILE_COND_I_I_I]] ], [ 0, [[CLEANUP_I36_I_I]] ], [ [[__R_0_I32_I_I]], [[WHILE_COND_I30_I_I]] ], [ 0, [[CLEANUP_I20_I_I]] ], [ [[__R_0_I16_I_I]], [[WHILE_COND_I14_I_I]] ]
2749// APPROX-NEXT:    [[BF_VALUE_I:%.*]] = and i64 [[RETVAL_0_I_I]], 2251799813685247
2750// APPROX-NEXT:    [[BF_SET9_I:%.*]] = or disjoint i64 [[BF_VALUE_I]], 9221120237041090560
2751// APPROX-NEXT:    [[TMP10:%.*]] = bitcast i64 [[BF_SET9_I]] to double
2752// APPROX-NEXT:    ret double [[TMP10]]
2753//
2754extern "C" __device__ double test_nan(const char *tag) {
2755  return nan(tag);
2756}
2757
2758// DEFAULT-LABEL: @test_nanf_emptystr(
2759// DEFAULT-NEXT:  entry:
2760// DEFAULT-NEXT:    ret float 0x7FF8000000000000
2761//
2762// FINITEONLY-LABEL: @test_nanf_emptystr(
2763// FINITEONLY-NEXT:  entry:
2764// FINITEONLY-NEXT:    ret float poison
2765//
2766// APPROX-LABEL: @test_nanf_emptystr(
2767// APPROX-NEXT:  entry:
2768// APPROX-NEXT:    ret float 0x7FF8000000000000
2769//
2770extern "C" __device__ float test_nanf_emptystr() {
2771  return nanf("");
2772}
2773
2774// DEFAULT-LABEL: @test_nan_emptystr(
2775// DEFAULT-NEXT:  entry:
2776// DEFAULT-NEXT:    ret double 0x7FF8000000000000
2777//
2778// FINITEONLY-LABEL: @test_nan_emptystr(
2779// FINITEONLY-NEXT:  entry:
2780// FINITEONLY-NEXT:    ret double poison
2781//
2782// APPROX-LABEL: @test_nan_emptystr(
2783// APPROX-NEXT:  entry:
2784// APPROX-NEXT:    ret double 0x7FF8000000000000
2785//
2786extern "C" __device__ double test_nan_emptystr() {
2787  return nan("");
2788}
2789
2790// DEFAULT-LABEL: @test_nanf_fill(
2791// DEFAULT-NEXT:  entry:
2792// DEFAULT-NEXT:    ret float 0x7FF8000000000000
2793//
2794// FINITEONLY-LABEL: @test_nanf_fill(
2795// FINITEONLY-NEXT:  entry:
2796// FINITEONLY-NEXT:    ret float poison
2797//
2798// APPROX-LABEL: @test_nanf_fill(
2799// APPROX-NEXT:  entry:
2800// APPROX-NEXT:    ret float 0x7FF8000000000000
2801//
2802extern "C" __device__ float test_nanf_fill() {
2803  return nanf("0x456");
2804}
2805
2806// DEFAULT-LABEL: @test_nan_fill(
2807// DEFAULT-NEXT:  entry:
2808// DEFAULT-NEXT:    ret double 0x7FF8000000000000
2809//
2810// FINITEONLY-LABEL: @test_nan_fill(
2811// FINITEONLY-NEXT:  entry:
2812// FINITEONLY-NEXT:    ret double poison
2813//
2814// APPROX-LABEL: @test_nan_fill(
2815// APPROX-NEXT:  entry:
2816// APPROX-NEXT:    ret double 0x7FF8000000000000
2817//
2818extern "C" __device__ double test_nan_fill() {
2819  return nan("0x123");
2820}
2821
2822// DEFAULT-LABEL: @test_nearbyintf(
2823// DEFAULT-NEXT:  entry:
2824// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.nearbyint.f32(float [[X:%.*]])
2825// DEFAULT-NEXT:    ret float [[TMP0]]
2826//
2827// FINITEONLY-LABEL: @test_nearbyintf(
2828// FINITEONLY-NEXT:  entry:
2829// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.nearbyint.f32(float [[X:%.*]])
2830// FINITEONLY-NEXT:    ret float [[TMP0]]
2831//
2832// APPROX-LABEL: @test_nearbyintf(
2833// APPROX-NEXT:  entry:
2834// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.nearbyint.f32(float [[X:%.*]])
2835// APPROX-NEXT:    ret float [[TMP0]]
2836//
2837extern "C" __device__ float test_nearbyintf(float x) {
2838  return nearbyintf(x);
2839}
2840
2841// DEFAULT-LABEL: @test_nearbyint(
2842// DEFAULT-NEXT:  entry:
2843// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.nearbyint.f64(double [[X:%.*]])
2844// DEFAULT-NEXT:    ret double [[TMP0]]
2845//
2846// FINITEONLY-LABEL: @test_nearbyint(
2847// FINITEONLY-NEXT:  entry:
2848// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.nearbyint.f64(double [[X:%.*]])
2849// FINITEONLY-NEXT:    ret double [[TMP0]]
2850//
2851// APPROX-LABEL: @test_nearbyint(
2852// APPROX-NEXT:  entry:
2853// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.nearbyint.f64(double [[X:%.*]])
2854// APPROX-NEXT:    ret double [[TMP0]]
2855//
2856extern "C" __device__ double test_nearbyint(double x) {
2857  return nearbyint(x);
2858}
2859
2860// DEFAULT-LABEL: @test_nextafterf(
2861// DEFAULT-NEXT:  entry:
2862// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_nextafter_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
2863// DEFAULT-NEXT:    ret float [[CALL_I]]
2864//
2865// FINITEONLY-LABEL: @test_nextafterf(
2866// FINITEONLY-NEXT:  entry:
2867// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_nextafter_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
2868// FINITEONLY-NEXT:    ret float [[CALL_I]]
2869//
2870// APPROX-LABEL: @test_nextafterf(
2871// APPROX-NEXT:  entry:
2872// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_nextafter_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
2873// APPROX-NEXT:    ret float [[CALL_I]]
2874//
2875extern "C" __device__ float test_nextafterf(float x, float y) {
2876  return nextafterf(x, y);
2877}
2878
2879// DEFAULT-LABEL: @test_nextafter(
2880// DEFAULT-NEXT:  entry:
2881// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_nextafter_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
2882// DEFAULT-NEXT:    ret double [[CALL_I]]
2883//
2884// FINITEONLY-LABEL: @test_nextafter(
2885// FINITEONLY-NEXT:  entry:
2886// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_nextafter_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
2887// FINITEONLY-NEXT:    ret double [[CALL_I]]
2888//
2889// APPROX-LABEL: @test_nextafter(
2890// APPROX-NEXT:  entry:
2891// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_nextafter_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
2892// APPROX-NEXT:    ret double [[CALL_I]]
2893//
2894extern "C" __device__ double test_nextafter(double x, double y) {
2895  return nextafter(x, y);
2896}
2897
2898// DEFAULT-LABEL: @test_norm3df(
2899// DEFAULT-NEXT:  entry:
2900// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR12]]
2901// DEFAULT-NEXT:    ret float [[CALL_I]]
2902//
2903// FINITEONLY-LABEL: @test_norm3df(
2904// FINITEONLY-NEXT:  entry:
2905// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_len3_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR12]]
2906// FINITEONLY-NEXT:    ret float [[CALL_I]]
2907//
2908// APPROX-LABEL: @test_norm3df(
2909// APPROX-NEXT:  entry:
2910// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR12]]
2911// APPROX-NEXT:    ret float [[CALL_I]]
2912//
2913extern "C" __device__ float test_norm3df(float x, float y, float z) {
2914  return norm3df(x, y, z);
2915}
2916
2917// DEFAULT-LABEL: @test_norm3d(
2918// DEFAULT-NEXT:  entry:
2919// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR12]]
2920// DEFAULT-NEXT:    ret double [[CALL_I]]
2921//
2922// FINITEONLY-LABEL: @test_norm3d(
2923// FINITEONLY-NEXT:  entry:
2924// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_len3_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR12]]
2925// FINITEONLY-NEXT:    ret double [[CALL_I]]
2926//
2927// APPROX-LABEL: @test_norm3d(
2928// APPROX-NEXT:  entry:
2929// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR12]]
2930// APPROX-NEXT:    ret double [[CALL_I]]
2931//
2932extern "C" __device__ double test_norm3d(double x, double y, double z) {
2933  return norm3d(x, y, z);
2934}
2935
2936// DEFAULT-LABEL: @test_norm4df(
2937// DEFAULT-NEXT:  entry:
2938// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR12]]
2939// DEFAULT-NEXT:    ret float [[CALL_I]]
2940//
2941// FINITEONLY-LABEL: @test_norm4df(
2942// FINITEONLY-NEXT:  entry:
2943// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_len4_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]], float noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR12]]
2944// FINITEONLY-NEXT:    ret float [[CALL_I]]
2945//
2946// APPROX-LABEL: @test_norm4df(
2947// APPROX-NEXT:  entry:
2948// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_len4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR12]]
2949// APPROX-NEXT:    ret float [[CALL_I]]
2950//
2951extern "C" __device__ float test_norm4df(float x, float y, float z, float w) {
2952  return norm4df(x, y, z, w);
2953}
2954
2955// DEFAULT-LABEL: @test_norm4d(
2956// DEFAULT-NEXT:  entry:
2957// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR12]]
2958// DEFAULT-NEXT:    ret double [[CALL_I]]
2959//
2960// FINITEONLY-LABEL: @test_norm4d(
2961// FINITEONLY-NEXT:  entry:
2962// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_len4_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]], double noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR12]]
2963// FINITEONLY-NEXT:    ret double [[CALL_I]]
2964//
2965// APPROX-LABEL: @test_norm4d(
2966// APPROX-NEXT:  entry:
2967// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_len4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR12]]
2968// APPROX-NEXT:    ret double [[CALL_I]]
2969//
2970extern "C" __device__ double test_norm4d(double x, double y, double z, double w) {
2971  return norm4d(x, y, z, w);
2972}
2973
2974// DEFAULT-LABEL: @test_normcdff(
2975// DEFAULT-NEXT:  entry:
2976// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdf_f32(float noundef [[X:%.*]]) #[[ATTR13]]
2977// DEFAULT-NEXT:    ret float [[CALL_I]]
2978//
2979// FINITEONLY-LABEL: @test_normcdff(
2980// FINITEONLY-NEXT:  entry:
2981// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_ncdf_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
2982// FINITEONLY-NEXT:    ret float [[CALL_I]]
2983//
2984// APPROX-LABEL: @test_normcdff(
2985// APPROX-NEXT:  entry:
2986// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdf_f32(float noundef [[X:%.*]]) #[[ATTR13]]
2987// APPROX-NEXT:    ret float [[CALL_I]]
2988//
2989extern "C" __device__ float test_normcdff(float x) {
2990  return normcdff(x);
2991}
2992
2993// DEFAULT-LABEL: @test_normcdf(
2994// DEFAULT-NEXT:  entry:
2995// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdf_f64(double noundef [[X:%.*]]) #[[ATTR13]]
2996// DEFAULT-NEXT:    ret double [[CALL_I]]
2997//
2998// FINITEONLY-LABEL: @test_normcdf(
2999// FINITEONLY-NEXT:  entry:
3000// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_ncdf_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
3001// FINITEONLY-NEXT:    ret double [[CALL_I]]
3002//
3003// APPROX-LABEL: @test_normcdf(
3004// APPROX-NEXT:  entry:
3005// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdf_f64(double noundef [[X:%.*]]) #[[ATTR13]]
3006// APPROX-NEXT:    ret double [[CALL_I]]
3007//
3008extern "C" __device__ double test_normcdf(double x) {
3009  return normcdf(x);
3010}
3011
3012// DEFAULT-LABEL: @test_normcdfinvf(
3013// DEFAULT-NEXT:  entry:
3014// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdfinv_f32(float noundef [[X:%.*]]) #[[ATTR13]]
3015// DEFAULT-NEXT:    ret float [[CALL_I]]
3016//
3017// FINITEONLY-LABEL: @test_normcdfinvf(
3018// FINITEONLY-NEXT:  entry:
3019// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_ncdfinv_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
3020// FINITEONLY-NEXT:    ret float [[CALL_I]]
3021//
3022// APPROX-LABEL: @test_normcdfinvf(
3023// APPROX-NEXT:  entry:
3024// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_ncdfinv_f32(float noundef [[X:%.*]]) #[[ATTR13]]
3025// APPROX-NEXT:    ret float [[CALL_I]]
3026//
3027extern "C" __device__ float test_normcdfinvf(float x) {
3028  return normcdfinvf(x);
3029}
3030
3031// DEFAULT-LABEL: @test_normcdfinv(
3032// DEFAULT-NEXT:  entry:
3033// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdfinv_f64(double noundef [[X:%.*]]) #[[ATTR13]]
3034// DEFAULT-NEXT:    ret double [[CALL_I]]
3035//
3036// FINITEONLY-LABEL: @test_normcdfinv(
3037// FINITEONLY-NEXT:  entry:
3038// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_ncdfinv_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
3039// FINITEONLY-NEXT:    ret double [[CALL_I]]
3040//
3041// APPROX-LABEL: @test_normcdfinv(
3042// APPROX-NEXT:  entry:
3043// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_ncdfinv_f64(double noundef [[X:%.*]]) #[[ATTR13]]
3044// APPROX-NEXT:    ret double [[CALL_I]]
3045//
3046extern "C" __device__ double test_normcdfinv(double x) {
3047  return normcdfinv(x);
3048}
3049
3050// DEFAULT-LABEL: @test_normf(
3051// DEFAULT-NEXT:  entry:
3052// DEFAULT-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3053// DEFAULT-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL5NORMFIPKF_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3054// DEFAULT:       while.body.i:
3055// DEFAULT-NEXT:    [[__R_0_I4:%.*]] = phi float [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3056// DEFAULT-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3057// DEFAULT-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3058// DEFAULT-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3059// DEFAULT-NEXT:    [[TMP0:%.*]] = load float, ptr [[__A_ADDR_0_I3]], align 4, !tbaa [[TBAA16]]
3060// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract float [[TMP0]], [[TMP0]]
3061// DEFAULT-NEXT:    [[ADD_I]] = fadd contract float [[__R_0_I4]], [[MUL_I]]
3062// DEFAULT-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 4
3063// DEFAULT-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3064// DEFAULT-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL5NORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP20:![0-9]+]]
3065// DEFAULT:       _ZL5normfiPKf.exit:
3066// DEFAULT-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3067// DEFAULT-NEXT:    [[TMP1:%.*]] = tail call contract noundef float @llvm.sqrt.f32(float [[__R_0_I_LCSSA]])
3068// DEFAULT-NEXT:    ret float [[TMP1]]
3069//
3070// FINITEONLY-LABEL: @test_normf(
3071// FINITEONLY-NEXT:  entry:
3072// FINITEONLY-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3073// FINITEONLY-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL5NORMFIPKF_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3074// FINITEONLY:       while.body.i:
3075// FINITEONLY-NEXT:    [[__R_0_I4:%.*]] = phi float [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3076// FINITEONLY-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3077// FINITEONLY-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3078// FINITEONLY-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3079// FINITEONLY-NEXT:    [[TMP0:%.*]] = load float, ptr [[__A_ADDR_0_I3]], align 4, !tbaa [[TBAA16]]
3080// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract float [[TMP0]], [[TMP0]]
3081// FINITEONLY-NEXT:    [[ADD_I]] = fadd nnan ninf contract float [[__R_0_I4]], [[MUL_I]]
3082// FINITEONLY-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 4
3083// FINITEONLY-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3084// FINITEONLY-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL5NORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP20:![0-9]+]]
3085// FINITEONLY:       _ZL5normfiPKf.exit:
3086// FINITEONLY-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3087// FINITEONLY-NEXT:    [[TMP1:%.*]] = tail call nnan ninf contract noundef float @llvm.sqrt.f32(float [[__R_0_I_LCSSA]])
3088// FINITEONLY-NEXT:    ret float [[TMP1]]
3089//
3090// APPROX-LABEL: @test_normf(
3091// APPROX-NEXT:  entry:
3092// APPROX-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3093// APPROX-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL5NORMFIPKF_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3094// APPROX:       while.body.i:
3095// APPROX-NEXT:    [[__R_0_I4:%.*]] = phi float [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3096// APPROX-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3097// APPROX-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3098// APPROX-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3099// APPROX-NEXT:    [[TMP0:%.*]] = load float, ptr [[__A_ADDR_0_I3]], align 4, !tbaa [[TBAA16]]
3100// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract float [[TMP0]], [[TMP0]]
3101// APPROX-NEXT:    [[ADD_I]] = fadd contract float [[__R_0_I4]], [[MUL_I]]
3102// APPROX-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 4
3103// APPROX-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3104// APPROX-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL5NORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP20:![0-9]+]]
3105// APPROX:       _ZL5normfiPKf.exit:
3106// APPROX-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3107// APPROX-NEXT:    [[TMP1:%.*]] = tail call contract noundef float @llvm.sqrt.f32(float [[__R_0_I_LCSSA]])
3108// APPROX-NEXT:    ret float [[TMP1]]
3109//
3110extern "C" __device__ float test_normf(int x, const float *y) {
3111  return normf(x, y);
3112}
3113
3114// DEFAULT-LABEL: @test_norm(
3115// DEFAULT-NEXT:  entry:
3116// DEFAULT-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3117// DEFAULT-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL4NORMIPKD_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3118// DEFAULT:       while.body.i:
3119// DEFAULT-NEXT:    [[__R_0_I4:%.*]] = phi double [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3120// DEFAULT-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3121// DEFAULT-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3122// DEFAULT-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3123// DEFAULT-NEXT:    [[TMP0:%.*]] = load double, ptr [[__A_ADDR_0_I3]], align 8, !tbaa [[TBAA18]]
3124// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract double [[TMP0]], [[TMP0]]
3125// DEFAULT-NEXT:    [[ADD_I]] = fadd contract double [[__R_0_I4]], [[MUL_I]]
3126// DEFAULT-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 8
3127// DEFAULT-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3128// DEFAULT-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL4NORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP21:![0-9]+]]
3129// DEFAULT:       _ZL4normiPKd.exit:
3130// DEFAULT-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3131// DEFAULT-NEXT:    [[TMP1:%.*]] = tail call contract noundef double @llvm.sqrt.f64(double [[__R_0_I_LCSSA]])
3132// DEFAULT-NEXT:    ret double [[TMP1]]
3133//
3134// FINITEONLY-LABEL: @test_norm(
3135// FINITEONLY-NEXT:  entry:
3136// FINITEONLY-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3137// FINITEONLY-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL4NORMIPKD_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3138// FINITEONLY:       while.body.i:
3139// FINITEONLY-NEXT:    [[__R_0_I4:%.*]] = phi double [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3140// FINITEONLY-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3141// FINITEONLY-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3142// FINITEONLY-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3143// FINITEONLY-NEXT:    [[TMP0:%.*]] = load double, ptr [[__A_ADDR_0_I3]], align 8, !tbaa [[TBAA18]]
3144// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract double [[TMP0]], [[TMP0]]
3145// FINITEONLY-NEXT:    [[ADD_I]] = fadd nnan ninf contract double [[__R_0_I4]], [[MUL_I]]
3146// FINITEONLY-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 8
3147// FINITEONLY-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3148// FINITEONLY-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL4NORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP21:![0-9]+]]
3149// FINITEONLY:       _ZL4normiPKd.exit:
3150// FINITEONLY-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3151// FINITEONLY-NEXT:    [[TMP1:%.*]] = tail call nnan ninf contract noundef double @llvm.sqrt.f64(double [[__R_0_I_LCSSA]])
3152// FINITEONLY-NEXT:    ret double [[TMP1]]
3153//
3154// APPROX-LABEL: @test_norm(
3155// APPROX-NEXT:  entry:
3156// APPROX-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3157// APPROX-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL4NORMIPKD_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3158// APPROX:       while.body.i:
3159// APPROX-NEXT:    [[__R_0_I4:%.*]] = phi double [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3160// APPROX-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3161// APPROX-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3162// APPROX-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3163// APPROX-NEXT:    [[TMP0:%.*]] = load double, ptr [[__A_ADDR_0_I3]], align 8, !tbaa [[TBAA18]]
3164// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract double [[TMP0]], [[TMP0]]
3165// APPROX-NEXT:    [[ADD_I]] = fadd contract double [[__R_0_I4]], [[MUL_I]]
3166// APPROX-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 8
3167// APPROX-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3168// APPROX-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL4NORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP21:![0-9]+]]
3169// APPROX:       _ZL4normiPKd.exit:
3170// APPROX-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3171// APPROX-NEXT:    [[TMP1:%.*]] = tail call contract noundef double @llvm.sqrt.f64(double [[__R_0_I_LCSSA]])
3172// APPROX-NEXT:    ret double [[TMP1]]
3173//
3174extern "C" __device__ double test_norm(int x, const double *y) {
3175  return norm(x, y);
3176}
3177
3178// DEFAULT-LABEL: @test_powf(
3179// DEFAULT-NEXT:  entry:
3180// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR13]]
3181// DEFAULT-NEXT:    ret float [[CALL_I]]
3182//
3183// FINITEONLY-LABEL: @test_powf(
3184// FINITEONLY-NEXT:  entry:
3185// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pow_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR13]]
3186// FINITEONLY-NEXT:    ret float [[CALL_I]]
3187//
3188// APPROX-LABEL: @test_powf(
3189// APPROX-NEXT:  entry:
3190// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR13]]
3191// APPROX-NEXT:    ret float [[CALL_I]]
3192//
3193extern "C" __device__ float test_powf(float x, float y) {
3194  return powf(x, y);
3195}
3196
3197// DEFAULT-LABEL: @test_pow(
3198// DEFAULT-NEXT:  entry:
3199// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pow_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR13]]
3200// DEFAULT-NEXT:    ret double [[CALL_I]]
3201//
3202// FINITEONLY-LABEL: @test_pow(
3203// FINITEONLY-NEXT:  entry:
3204// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_pow_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR13]]
3205// FINITEONLY-NEXT:    ret double [[CALL_I]]
3206//
3207// APPROX-LABEL: @test_pow(
3208// APPROX-NEXT:  entry:
3209// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pow_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR13]]
3210// APPROX-NEXT:    ret double [[CALL_I]]
3211//
3212extern "C" __device__ double test_pow(double x, double y) {
3213  return pow(x, y);
3214}
3215
3216// DEFAULT-LABEL: @test_powif(
3217// DEFAULT-NEXT:  entry:
3218// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pown_f32(float noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]]
3219// DEFAULT-NEXT:    ret float [[CALL_I]]
3220//
3221// FINITEONLY-LABEL: @test_powif(
3222// FINITEONLY-NEXT:  entry:
3223// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pown_f32(float noundef nofpclass(nan inf) [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]]
3224// FINITEONLY-NEXT:    ret float [[CALL_I]]
3225//
3226// APPROX-LABEL: @test_powif(
3227// APPROX-NEXT:  entry:
3228// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pown_f32(float noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]]
3229// APPROX-NEXT:    ret float [[CALL_I]]
3230//
3231extern "C" __device__ float test_powif(float x, int y) {
3232  return powif(x, y);
3233}
3234
3235// DEFAULT-LABEL: @test_powi(
3236// DEFAULT-NEXT:  entry:
3237// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pown_f64(double noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]]
3238// DEFAULT-NEXT:    ret double [[CALL_I]]
3239//
3240// FINITEONLY-LABEL: @test_powi(
3241// FINITEONLY-NEXT:  entry:
3242// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_pown_f64(double noundef nofpclass(nan inf) [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]]
3243// FINITEONLY-NEXT:    ret double [[CALL_I]]
3244//
3245// APPROX-LABEL: @test_powi(
3246// APPROX-NEXT:  entry:
3247// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_pown_f64(double noundef [[X:%.*]], i32 noundef [[Y:%.*]]) #[[ATTR13]]
3248// APPROX-NEXT:    ret double [[CALL_I]]
3249//
3250extern "C" __device__ double test_powi(double x, int y) {
3251  return powi(x, y);
3252}
3253
3254// DEFAULT-LABEL: @test_rcbrtf(
3255// DEFAULT-NEXT:  entry:
3256// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rcbrt_f32(float noundef [[X:%.*]]) #[[ATTR13]]
3257// DEFAULT-NEXT:    ret float [[CALL_I]]
3258//
3259// FINITEONLY-LABEL: @test_rcbrtf(
3260// FINITEONLY-NEXT:  entry:
3261// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rcbrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
3262// FINITEONLY-NEXT:    ret float [[CALL_I]]
3263//
3264// APPROX-LABEL: @test_rcbrtf(
3265// APPROX-NEXT:  entry:
3266// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rcbrt_f32(float noundef [[X:%.*]]) #[[ATTR13]]
3267// APPROX-NEXT:    ret float [[CALL_I]]
3268//
3269extern "C" __device__ float test_rcbrtf(float x) {
3270  return rcbrtf(x);
3271}
3272
3273// DEFAULT-LABEL: @test_rcbrt(
3274// DEFAULT-NEXT:  entry:
3275// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rcbrt_f64(double noundef [[X:%.*]]) #[[ATTR13]]
3276// DEFAULT-NEXT:    ret double [[CALL_I]]
3277//
3278// FINITEONLY-LABEL: @test_rcbrt(
3279// FINITEONLY-NEXT:  entry:
3280// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rcbrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
3281// FINITEONLY-NEXT:    ret double [[CALL_I]]
3282//
3283// APPROX-LABEL: @test_rcbrt(
3284// APPROX-NEXT:  entry:
3285// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rcbrt_f64(double noundef [[X:%.*]]) #[[ATTR13]]
3286// APPROX-NEXT:    ret double [[CALL_I]]
3287//
3288extern "C" __device__ double test_rcbrt(double x) {
3289  return rcbrt(x);
3290}
3291
3292// DEFAULT-LABEL: @test_remainderf(
3293// DEFAULT-NEXT:  entry:
3294// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_remainder_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
3295// DEFAULT-NEXT:    ret float [[CALL_I]]
3296//
3297// FINITEONLY-LABEL: @test_remainderf(
3298// FINITEONLY-NEXT:  entry:
3299// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_remainder_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
3300// FINITEONLY-NEXT:    ret float [[CALL_I]]
3301//
3302// APPROX-LABEL: @test_remainderf(
3303// APPROX-NEXT:  entry:
3304// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_remainder_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
3305// APPROX-NEXT:    ret float [[CALL_I]]
3306//
3307extern "C" __device__ float test_remainderf(float x, float y) {
3308  return remainderf(x, y);
3309}
3310
3311// DEFAULT-LABEL: @test_remainder(
3312// DEFAULT-NEXT:  entry:
3313// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_remainder_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
3314// DEFAULT-NEXT:    ret double [[CALL_I]]
3315//
3316// FINITEONLY-LABEL: @test_remainder(
3317// FINITEONLY-NEXT:  entry:
3318// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_remainder_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
3319// FINITEONLY-NEXT:    ret double [[CALL_I]]
3320//
3321// APPROX-LABEL: @test_remainder(
3322// APPROX-NEXT:  entry:
3323// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_remainder_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
3324// APPROX-NEXT:    ret double [[CALL_I]]
3325//
3326extern "C" __device__ double test_remainder(double x, double y) {
3327  return remainder(x, y);
3328}
3329
3330// DEFAULT-LABEL: @test_remquof(
3331// DEFAULT-NEXT:  entry:
3332// DEFAULT-NEXT:    [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5)
3333// DEFAULT-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3334// DEFAULT-NEXT:    [[CALL_I:%.*]] = call contract noundef float @__ocml_remquo_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3335// DEFAULT-NEXT:    [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]]
3336// DEFAULT-NEXT:    store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]]
3337// DEFAULT-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3338// DEFAULT-NEXT:    ret float [[CALL_I]]
3339//
3340// FINITEONLY-LABEL: @test_remquof(
3341// FINITEONLY-NEXT:  entry:
3342// FINITEONLY-NEXT:    [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5)
3343// FINITEONLY-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3344// FINITEONLY-NEXT:    [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_remquo_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3345// FINITEONLY-NEXT:    [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]]
3346// FINITEONLY-NEXT:    store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]]
3347// FINITEONLY-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3348// FINITEONLY-NEXT:    ret float [[CALL_I]]
3349//
3350// APPROX-LABEL: @test_remquof(
3351// APPROX-NEXT:  entry:
3352// APPROX-NEXT:    [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5)
3353// APPROX-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3354// APPROX-NEXT:    [[CALL_I:%.*]] = call contract noundef float @__ocml_remquo_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3355// APPROX-NEXT:    [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]]
3356// APPROX-NEXT:    store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]]
3357// APPROX-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3358// APPROX-NEXT:    ret float [[CALL_I]]
3359//
3360extern "C" __device__ float test_remquof(float x, float y, int* z) {
3361  return remquof(x, y, z);
3362}
3363
3364// DEFAULT-LABEL: @test_remquo(
3365// DEFAULT-NEXT:  entry:
3366// DEFAULT-NEXT:    [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5)
3367// DEFAULT-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3368// DEFAULT-NEXT:    [[CALL_I:%.*]] = call contract noundef double @__ocml_remquo_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3369// DEFAULT-NEXT:    [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]]
3370// DEFAULT-NEXT:    store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]]
3371// DEFAULT-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3372// DEFAULT-NEXT:    ret double [[CALL_I]]
3373//
3374// FINITEONLY-LABEL: @test_remquo(
3375// FINITEONLY-NEXT:  entry:
3376// FINITEONLY-NEXT:    [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5)
3377// FINITEONLY-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3378// FINITEONLY-NEXT:    [[CALL_I:%.*]] = call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_remquo_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3379// FINITEONLY-NEXT:    [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]]
3380// FINITEONLY-NEXT:    store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]]
3381// FINITEONLY-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3382// FINITEONLY-NEXT:    ret double [[CALL_I]]
3383//
3384// APPROX-LABEL: @test_remquo(
3385// APPROX-NEXT:  entry:
3386// APPROX-NEXT:    [[__TMP_I:%.*]] = alloca i32, align 4, addrspace(5)
3387// APPROX-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3388// APPROX-NEXT:    [[CALL_I:%.*]] = call contract noundef double @__ocml_remquo_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3389// APPROX-NEXT:    [[TMP0:%.*]] = load i32, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA12]]
3390// APPROX-NEXT:    store i32 [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA12]]
3391// APPROX-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3392// APPROX-NEXT:    ret double [[CALL_I]]
3393//
3394extern "C" __device__ double test_remquo(double x, double y, int* z) {
3395  return remquo(x, y, z);
3396}
3397
3398// DEFAULT-LABEL: @test_rhypotf(
3399// DEFAULT-NEXT:  entry:
3400// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rhypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
3401// DEFAULT-NEXT:    ret float [[CALL_I]]
3402//
3403// FINITEONLY-LABEL: @test_rhypotf(
3404// FINITEONLY-NEXT:  entry:
3405// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rhypot_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
3406// FINITEONLY-NEXT:    ret float [[CALL_I]]
3407//
3408// APPROX-LABEL: @test_rhypotf(
3409// APPROX-NEXT:  entry:
3410// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rhypot_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR12]]
3411// APPROX-NEXT:    ret float [[CALL_I]]
3412//
3413extern "C" __device__ float test_rhypotf(float x, float y) {
3414  return rhypotf(x, y);
3415}
3416
3417// DEFAULT-LABEL: @test_rhypot(
3418// DEFAULT-NEXT:  entry:
3419// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rhypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
3420// DEFAULT-NEXT:    ret double [[CALL_I]]
3421//
3422// FINITEONLY-LABEL: @test_rhypot(
3423// FINITEONLY-NEXT:  entry:
3424// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rhypot_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR12]]
3425// FINITEONLY-NEXT:    ret double [[CALL_I]]
3426//
3427// APPROX-LABEL: @test_rhypot(
3428// APPROX-NEXT:  entry:
3429// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rhypot_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]]) #[[ATTR12]]
3430// APPROX-NEXT:    ret double [[CALL_I]]
3431//
3432extern "C" __device__ double test_rhypot(double x, double y) {
3433  return rhypot(x, y);
3434}
3435
3436// DEFAULT-LABEL: @test_rintf(
3437// DEFAULT-NEXT:  entry:
3438// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.rint.f32(float [[X:%.*]])
3439// DEFAULT-NEXT:    ret float [[TMP0]]
3440//
3441// FINITEONLY-LABEL: @test_rintf(
3442// FINITEONLY-NEXT:  entry:
3443// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.rint.f32(float [[X:%.*]])
3444// FINITEONLY-NEXT:    ret float [[TMP0]]
3445//
3446// APPROX-LABEL: @test_rintf(
3447// APPROX-NEXT:  entry:
3448// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.rint.f32(float [[X:%.*]])
3449// APPROX-NEXT:    ret float [[TMP0]]
3450//
3451extern "C" __device__ float test_rintf(float x) {
3452  return rintf(x);
3453}
3454
3455// DEFAULT-LABEL: @test_rint(
3456// DEFAULT-NEXT:  entry:
3457// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.rint.f64(double [[X:%.*]])
3458// DEFAULT-NEXT:    ret double [[TMP0]]
3459//
3460// FINITEONLY-LABEL: @test_rint(
3461// FINITEONLY-NEXT:  entry:
3462// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.rint.f64(double [[X:%.*]])
3463// FINITEONLY-NEXT:    ret double [[TMP0]]
3464//
3465// APPROX-LABEL: @test_rint(
3466// APPROX-NEXT:  entry:
3467// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.rint.f64(double [[X:%.*]])
3468// APPROX-NEXT:    ret double [[TMP0]]
3469//
3470extern "C" __device__ double test_rint(double x) {
3471  return rint(x);
3472}
3473
3474// DEFAULT-LABEL: @test_rnormf(
3475// DEFAULT-NEXT:  entry:
3476// DEFAULT-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3477// DEFAULT-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL6RNORMFIPKF_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3478// DEFAULT:       while.body.i:
3479// DEFAULT-NEXT:    [[__R_0_I4:%.*]] = phi float [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3480// DEFAULT-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3481// DEFAULT-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3482// DEFAULT-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3483// DEFAULT-NEXT:    [[TMP0:%.*]] = load float, ptr [[__A_ADDR_0_I3]], align 4, !tbaa [[TBAA16]]
3484// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract float [[TMP0]], [[TMP0]]
3485// DEFAULT-NEXT:    [[ADD_I]] = fadd contract float [[__R_0_I4]], [[MUL_I]]
3486// DEFAULT-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 4
3487// DEFAULT-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3488// DEFAULT-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL6RNORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP22:![0-9]+]]
3489// DEFAULT:       _ZL6rnormfiPKf.exit:
3490// DEFAULT-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3491// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[__R_0_I_LCSSA]]) #[[ATTR13]]
3492// DEFAULT-NEXT:    ret float [[CALL_I]]
3493//
3494// FINITEONLY-LABEL: @test_rnormf(
3495// FINITEONLY-NEXT:  entry:
3496// FINITEONLY-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3497// FINITEONLY-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL6RNORMFIPKF_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3498// FINITEONLY:       while.body.i:
3499// FINITEONLY-NEXT:    [[__R_0_I4:%.*]] = phi float [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3500// FINITEONLY-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3501// FINITEONLY-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3502// FINITEONLY-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3503// FINITEONLY-NEXT:    [[TMP0:%.*]] = load float, ptr [[__A_ADDR_0_I3]], align 4, !tbaa [[TBAA16]]
3504// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract float [[TMP0]], [[TMP0]]
3505// FINITEONLY-NEXT:    [[ADD_I]] = fadd nnan ninf contract float [[__R_0_I4]], [[MUL_I]]
3506// FINITEONLY-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 4
3507// FINITEONLY-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3508// FINITEONLY-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL6RNORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP22:![0-9]+]]
3509// FINITEONLY:       _ZL6rnormfiPKf.exit:
3510// FINITEONLY-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3511// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rsqrt_f32(float noundef nofpclass(nan inf) [[__R_0_I_LCSSA]]) #[[ATTR13]]
3512// FINITEONLY-NEXT:    ret float [[CALL_I]]
3513//
3514// APPROX-LABEL: @test_rnormf(
3515// APPROX-NEXT:  entry:
3516// APPROX-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3517// APPROX-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL6RNORMFIPKF_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3518// APPROX:       while.body.i:
3519// APPROX-NEXT:    [[__R_0_I4:%.*]] = phi float [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3520// APPROX-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3521// APPROX-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3522// APPROX-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3523// APPROX-NEXT:    [[TMP0:%.*]] = load float, ptr [[__A_ADDR_0_I3]], align 4, !tbaa [[TBAA16]]
3524// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract float [[TMP0]], [[TMP0]]
3525// APPROX-NEXT:    [[ADD_I]] = fadd contract float [[__R_0_I4]], [[MUL_I]]
3526// APPROX-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 4
3527// APPROX-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3528// APPROX-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL6RNORMFIPKF_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP22:![0-9]+]]
3529// APPROX:       _ZL6rnormfiPKf.exit:
3530// APPROX-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3531// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[__R_0_I_LCSSA]]) #[[ATTR13]]
3532// APPROX-NEXT:    ret float [[CALL_I]]
3533//
3534extern "C" __device__ float test_rnormf(int x, const float* y) {
3535  return rnormf(x, y);
3536}
3537
3538// DEFAULT-LABEL: @test_rnorm(
3539// DEFAULT-NEXT:  entry:
3540// DEFAULT-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3541// DEFAULT-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL5RNORMIPKD_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3542// DEFAULT:       while.body.i:
3543// DEFAULT-NEXT:    [[__R_0_I4:%.*]] = phi double [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3544// DEFAULT-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3545// DEFAULT-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3546// DEFAULT-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3547// DEFAULT-NEXT:    [[TMP0:%.*]] = load double, ptr [[__A_ADDR_0_I3]], align 8, !tbaa [[TBAA18]]
3548// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract double [[TMP0]], [[TMP0]]
3549// DEFAULT-NEXT:    [[ADD_I]] = fadd contract double [[__R_0_I4]], [[MUL_I]]
3550// DEFAULT-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 8
3551// DEFAULT-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3552// DEFAULT-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL5RNORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP23:![0-9]+]]
3553// DEFAULT:       _ZL5rnormiPKd.exit:
3554// DEFAULT-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3555// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[__R_0_I_LCSSA]]) #[[ATTR13]]
3556// DEFAULT-NEXT:    ret double [[CALL_I]]
3557//
3558// FINITEONLY-LABEL: @test_rnorm(
3559// FINITEONLY-NEXT:  entry:
3560// FINITEONLY-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3561// FINITEONLY-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL5RNORMIPKD_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3562// FINITEONLY:       while.body.i:
3563// FINITEONLY-NEXT:    [[__R_0_I4:%.*]] = phi double [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3564// FINITEONLY-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3565// FINITEONLY-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3566// FINITEONLY-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3567// FINITEONLY-NEXT:    [[TMP0:%.*]] = load double, ptr [[__A_ADDR_0_I3]], align 8, !tbaa [[TBAA18]]
3568// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract double [[TMP0]], [[TMP0]]
3569// FINITEONLY-NEXT:    [[ADD_I]] = fadd nnan ninf contract double [[__R_0_I4]], [[MUL_I]]
3570// FINITEONLY-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 8
3571// FINITEONLY-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3572// FINITEONLY-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL5RNORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP23:![0-9]+]]
3573// FINITEONLY:       _ZL5rnormiPKd.exit:
3574// FINITEONLY-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3575// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rsqrt_f64(double noundef nofpclass(nan inf) [[__R_0_I_LCSSA]]) #[[ATTR13]]
3576// FINITEONLY-NEXT:    ret double [[CALL_I]]
3577//
3578// APPROX-LABEL: @test_rnorm(
3579// APPROX-NEXT:  entry:
3580// APPROX-NEXT:    [[TOBOOL_NOT_I1:%.*]] = icmp eq i32 [[X:%.*]], 0
3581// APPROX-NEXT:    br i1 [[TOBOOL_NOT_I1]], label [[_ZL5RNORMIPKD_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
3582// APPROX:       while.body.i:
3583// APPROX-NEXT:    [[__R_0_I4:%.*]] = phi double [ [[ADD_I:%.*]], [[WHILE_BODY_I]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
3584// APPROX-NEXT:    [[__A_ADDR_0_I3:%.*]] = phi ptr [ [[INCDEC_PTR_I:%.*]], [[WHILE_BODY_I]] ], [ [[Y:%.*]], [[ENTRY]] ]
3585// APPROX-NEXT:    [[__DIM_ADDR_0_I2:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[X]], [[ENTRY]] ]
3586// APPROX-NEXT:    [[DEC_I]] = add nsw i32 [[__DIM_ADDR_0_I2]], -1
3587// APPROX-NEXT:    [[TMP0:%.*]] = load double, ptr [[__A_ADDR_0_I3]], align 8, !tbaa [[TBAA18]]
3588// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract double [[TMP0]], [[TMP0]]
3589// APPROX-NEXT:    [[ADD_I]] = fadd contract double [[__R_0_I4]], [[MUL_I]]
3590// APPROX-NEXT:    [[INCDEC_PTR_I]] = getelementptr inbounds nuw i8, ptr [[__A_ADDR_0_I3]], i64 8
3591// APPROX-NEXT:    [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
3592// APPROX-NEXT:    br i1 [[TOBOOL_NOT_I]], label [[_ZL5RNORMIPKD_EXIT]], label [[WHILE_BODY_I]], !llvm.loop [[LOOP23:![0-9]+]]
3593// APPROX:       _ZL5rnormiPKd.exit:
3594// APPROX-NEXT:    [[__R_0_I_LCSSA:%.*]] = phi double [ 0.000000e+00, [[ENTRY]] ], [ [[ADD_I]], [[WHILE_BODY_I]] ]
3595// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[__R_0_I_LCSSA]]) #[[ATTR13]]
3596// APPROX-NEXT:    ret double [[CALL_I]]
3597//
3598extern "C" __device__ double test_rnorm(int x, const double* y) {
3599  return rnorm(x, y);
3600}
3601
3602// DEFAULT-LABEL: @test_rnorm3df(
3603// DEFAULT-NEXT:  entry:
3604// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR12]]
3605// DEFAULT-NEXT:    ret float [[CALL_I]]
3606//
3607// FINITEONLY-LABEL: @test_rnorm3df(
3608// FINITEONLY-NEXT:  entry:
3609// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rlen3_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR12]]
3610// FINITEONLY-NEXT:    ret float [[CALL_I]]
3611//
3612// APPROX-LABEL: @test_rnorm3df(
3613// APPROX-NEXT:  entry:
3614// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen3_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]]) #[[ATTR12]]
3615// APPROX-NEXT:    ret float [[CALL_I]]
3616//
3617extern "C" __device__ float test_rnorm3df(float x, float y, float z) {
3618  return rnorm3df(x, y, z);
3619}
3620
3621// DEFAULT-LABEL: @test_rnorm3d(
3622// DEFAULT-NEXT:  entry:
3623// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR12]]
3624// DEFAULT-NEXT:    ret double [[CALL_I]]
3625//
3626// FINITEONLY-LABEL: @test_rnorm3d(
3627// FINITEONLY-NEXT:  entry:
3628// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rlen3_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]]) #[[ATTR12]]
3629// FINITEONLY-NEXT:    ret double [[CALL_I]]
3630//
3631// APPROX-LABEL: @test_rnorm3d(
3632// APPROX-NEXT:  entry:
3633// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen3_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]]) #[[ATTR12]]
3634// APPROX-NEXT:    ret double [[CALL_I]]
3635//
3636extern "C" __device__ double test_rnorm3d(double x, double y, double z) {
3637  return rnorm3d(x, y, z);
3638}
3639
3640// DEFAULT-LABEL: @test_rnorm4df(
3641// DEFAULT-NEXT:  entry:
3642// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR12]]
3643// DEFAULT-NEXT:    ret float [[CALL_I]]
3644//
3645// FINITEONLY-LABEL: @test_rnorm4df(
3646// FINITEONLY-NEXT:  entry:
3647// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rlen4_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]], float noundef nofpclass(nan inf) [[Z:%.*]], float noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR12]]
3648// FINITEONLY-NEXT:    ret float [[CALL_I]]
3649//
3650// APPROX-LABEL: @test_rnorm4df(
3651// APPROX-NEXT:  entry:
3652// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rlen4_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]], float noundef [[Z:%.*]], float noundef [[W:%.*]]) #[[ATTR12]]
3653// APPROX-NEXT:    ret float [[CALL_I]]
3654//
3655extern "C" __device__ float test_rnorm4df(float x, float y, float z, float w) {
3656  return rnorm4df(x, y, z, w);
3657}
3658
3659// DEFAULT-LABEL: @test_rnorm4d(
3660// DEFAULT-NEXT:  entry:
3661// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR12]]
3662// DEFAULT-NEXT:    ret double [[CALL_I]]
3663//
3664// FINITEONLY-LABEL: @test_rnorm4d(
3665// FINITEONLY-NEXT:  entry:
3666// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rlen4_f64(double noundef nofpclass(nan inf) [[X:%.*]], double noundef nofpclass(nan inf) [[Y:%.*]], double noundef nofpclass(nan inf) [[Z:%.*]], double noundef nofpclass(nan inf) [[W:%.*]]) #[[ATTR12]]
3667// FINITEONLY-NEXT:    ret double [[CALL_I]]
3668//
3669// APPROX-LABEL: @test_rnorm4d(
3670// APPROX-NEXT:  entry:
3671// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rlen4_f64(double noundef [[X:%.*]], double noundef [[Y:%.*]], double noundef [[Z:%.*]], double noundef [[W:%.*]]) #[[ATTR12]]
3672// APPROX-NEXT:    ret double [[CALL_I]]
3673//
3674extern "C" __device__ double test_rnorm4d(double x, double y, double z, double w) {
3675  return rnorm4d(x, y, z, w);
3676}
3677
3678// DEFAULT-LABEL: @test_roundf(
3679// DEFAULT-NEXT:  entry:
3680// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.round.f32(float [[X:%.*]])
3681// DEFAULT-NEXT:    ret float [[TMP0]]
3682//
3683// FINITEONLY-LABEL: @test_roundf(
3684// FINITEONLY-NEXT:  entry:
3685// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.round.f32(float [[X:%.*]])
3686// FINITEONLY-NEXT:    ret float [[TMP0]]
3687//
3688// APPROX-LABEL: @test_roundf(
3689// APPROX-NEXT:  entry:
3690// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.round.f32(float [[X:%.*]])
3691// APPROX-NEXT:    ret float [[TMP0]]
3692//
3693extern "C" __device__ float test_roundf(float x) {
3694  return roundf(x);
3695}
3696
3697// DEFAULT-LABEL: @test_round(
3698// DEFAULT-NEXT:  entry:
3699// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.round.f64(double [[X:%.*]])
3700// DEFAULT-NEXT:    ret double [[TMP0]]
3701//
3702// FINITEONLY-LABEL: @test_round(
3703// FINITEONLY-NEXT:  entry:
3704// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.round.f64(double [[X:%.*]])
3705// FINITEONLY-NEXT:    ret double [[TMP0]]
3706//
3707// APPROX-LABEL: @test_round(
3708// APPROX-NEXT:  entry:
3709// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.round.f64(double [[X:%.*]])
3710// APPROX-NEXT:    ret double [[TMP0]]
3711//
3712extern "C" __device__ double test_round(double x) {
3713  return round(x);
3714}
3715
3716// DEFAULT-LABEL: @test_rsqrtf(
3717// DEFAULT-NEXT:  entry:
3718// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[X:%.*]]) #[[ATTR13]]
3719// DEFAULT-NEXT:    ret float [[CALL_I]]
3720//
3721// FINITEONLY-LABEL: @test_rsqrtf(
3722// FINITEONLY-NEXT:  entry:
3723// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_rsqrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
3724// FINITEONLY-NEXT:    ret float [[CALL_I]]
3725//
3726// APPROX-LABEL: @test_rsqrtf(
3727// APPROX-NEXT:  entry:
3728// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_rsqrt_f32(float noundef [[X:%.*]]) #[[ATTR13]]
3729// APPROX-NEXT:    ret float [[CALL_I]]
3730//
3731extern "C" __device__ float test_rsqrtf(float x) {
3732  return rsqrtf(x);
3733}
3734
3735// DEFAULT-LABEL: @test_rsqrt(
3736// DEFAULT-NEXT:  entry:
3737// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[X:%.*]]) #[[ATTR13]]
3738// DEFAULT-NEXT:    ret double [[CALL_I]]
3739//
3740// FINITEONLY-LABEL: @test_rsqrt(
3741// FINITEONLY-NEXT:  entry:
3742// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_rsqrt_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
3743// FINITEONLY-NEXT:    ret double [[CALL_I]]
3744//
3745// APPROX-LABEL: @test_rsqrt(
3746// APPROX-NEXT:  entry:
3747// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_rsqrt_f64(double noundef [[X:%.*]]) #[[ATTR13]]
3748// APPROX-NEXT:    ret double [[CALL_I]]
3749//
3750extern "C" __device__ double test_rsqrt(double x) {
3751  return rsqrt(x);
3752}
3753
3754// DEFAULT-LABEL: @test_scalblnf(
3755// DEFAULT-NEXT:  entry:
3756// DEFAULT-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i64 [[Y:%.*]], 9223372036854775807
3757// DEFAULT-NEXT:    br i1 [[CMP_NOT_I]], label [[COND_FALSE_I:%.*]], label [[COND_TRUE_I:%.*]]
3758// DEFAULT:       cond.true.i:
3759// DEFAULT-NEXT:    [[CONV_I:%.*]] = trunc i64 [[Y]] to i32
3760// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[CONV_I]])
3761// DEFAULT-NEXT:    br label [[_ZL8SCALBLNFFL_EXIT:%.*]]
3762// DEFAULT:       cond.false.i:
3763// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract float @__ocml_scalb_f32(float noundef [[X]], float noundef 0x43E0000000000000) #[[ATTR12]]
3764// DEFAULT-NEXT:    br label [[_ZL8SCALBLNFFL_EXIT]]
3765// DEFAULT:       _ZL8scalblnffl.exit:
3766// DEFAULT-NEXT:    [[COND_I:%.*]] = phi contract float [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ]
3767// DEFAULT-NEXT:    ret float [[COND_I]]
3768//
3769// FINITEONLY-LABEL: @test_scalblnf(
3770// FINITEONLY-NEXT:  entry:
3771// FINITEONLY-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i64 [[Y:%.*]], 9223372036854775807
3772// FINITEONLY-NEXT:    br i1 [[CMP_NOT_I]], label [[COND_FALSE_I:%.*]], label [[COND_TRUE_I:%.*]]
3773// FINITEONLY:       cond.true.i:
3774// FINITEONLY-NEXT:    [[CONV_I:%.*]] = trunc i64 [[Y]] to i32
3775// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[CONV_I]])
3776// FINITEONLY-NEXT:    br label [[_ZL8SCALBLNFFL_EXIT:%.*]]
3777// FINITEONLY:       cond.false.i:
3778// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_scalb_f32(float noundef nofpclass(nan inf) [[X]], float noundef nofpclass(nan inf) 0x43E0000000000000) #[[ATTR12]]
3779// FINITEONLY-NEXT:    br label [[_ZL8SCALBLNFFL_EXIT]]
3780// FINITEONLY:       _ZL8scalblnffl.exit:
3781// FINITEONLY-NEXT:    [[COND_I:%.*]] = phi nnan ninf contract float [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ]
3782// FINITEONLY-NEXT:    ret float [[COND_I]]
3783//
3784// APPROX-LABEL: @test_scalblnf(
3785// APPROX-NEXT:  entry:
3786// APPROX-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i64 [[Y:%.*]], 9223372036854775807
3787// APPROX-NEXT:    br i1 [[CMP_NOT_I]], label [[COND_FALSE_I:%.*]], label [[COND_TRUE_I:%.*]]
3788// APPROX:       cond.true.i:
3789// APPROX-NEXT:    [[CONV_I:%.*]] = trunc i64 [[Y]] to i32
3790// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[CONV_I]])
3791// APPROX-NEXT:    br label [[_ZL8SCALBLNFFL_EXIT:%.*]]
3792// APPROX:       cond.false.i:
3793// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract float @__ocml_scalb_f32(float noundef [[X]], float noundef 0x43E0000000000000) #[[ATTR12]]
3794// APPROX-NEXT:    br label [[_ZL8SCALBLNFFL_EXIT]]
3795// APPROX:       _ZL8scalblnffl.exit:
3796// APPROX-NEXT:    [[COND_I:%.*]] = phi contract float [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ]
3797// APPROX-NEXT:    ret float [[COND_I]]
3798//
3799extern "C" __device__ float test_scalblnf(float x, long int y) {
3800  return scalblnf(x, y);
3801}
3802
3803// DEFAULT-LABEL: @test_scalbln(
3804// DEFAULT-NEXT:  entry:
3805// DEFAULT-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i64 [[Y:%.*]], 9223372036854775807
3806// DEFAULT-NEXT:    br i1 [[CMP_NOT_I]], label [[COND_FALSE_I:%.*]], label [[COND_TRUE_I:%.*]]
3807// DEFAULT:       cond.true.i:
3808// DEFAULT-NEXT:    [[CONV_I:%.*]] = trunc i64 [[Y]] to i32
3809// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[CONV_I]])
3810// DEFAULT-NEXT:    br label [[_ZL7SCALBLNDL_EXIT:%.*]]
3811// DEFAULT:       cond.false.i:
3812// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract double @__ocml_scalb_f64(double noundef [[X]], double noundef 0x43E0000000000000) #[[ATTR12]]
3813// DEFAULT-NEXT:    br label [[_ZL7SCALBLNDL_EXIT]]
3814// DEFAULT:       _ZL7scalblndl.exit:
3815// DEFAULT-NEXT:    [[COND_I:%.*]] = phi contract double [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ]
3816// DEFAULT-NEXT:    ret double [[COND_I]]
3817//
3818// FINITEONLY-LABEL: @test_scalbln(
3819// FINITEONLY-NEXT:  entry:
3820// FINITEONLY-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i64 [[Y:%.*]], 9223372036854775807
3821// FINITEONLY-NEXT:    br i1 [[CMP_NOT_I]], label [[COND_FALSE_I:%.*]], label [[COND_TRUE_I:%.*]]
3822// FINITEONLY:       cond.true.i:
3823// FINITEONLY-NEXT:    [[CONV_I:%.*]] = trunc i64 [[Y]] to i32
3824// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[CONV_I]])
3825// FINITEONLY-NEXT:    br label [[_ZL7SCALBLNDL_EXIT:%.*]]
3826// FINITEONLY:       cond.false.i:
3827// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) double @__ocml_scalb_f64(double noundef nofpclass(nan inf) [[X]], double noundef nofpclass(nan inf) 0x43E0000000000000) #[[ATTR12]]
3828// FINITEONLY-NEXT:    br label [[_ZL7SCALBLNDL_EXIT]]
3829// FINITEONLY:       _ZL7scalblndl.exit:
3830// FINITEONLY-NEXT:    [[COND_I:%.*]] = phi nnan ninf contract double [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ]
3831// FINITEONLY-NEXT:    ret double [[COND_I]]
3832//
3833// APPROX-LABEL: @test_scalbln(
3834// APPROX-NEXT:  entry:
3835// APPROX-NEXT:    [[CMP_NOT_I:%.*]] = icmp eq i64 [[Y:%.*]], 9223372036854775807
3836// APPROX-NEXT:    br i1 [[CMP_NOT_I]], label [[COND_FALSE_I:%.*]], label [[COND_TRUE_I:%.*]]
3837// APPROX:       cond.true.i:
3838// APPROX-NEXT:    [[CONV_I:%.*]] = trunc i64 [[Y]] to i32
3839// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[CONV_I]])
3840// APPROX-NEXT:    br label [[_ZL7SCALBLNDL_EXIT:%.*]]
3841// APPROX:       cond.false.i:
3842// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract double @__ocml_scalb_f64(double noundef [[X]], double noundef 0x43E0000000000000) #[[ATTR12]]
3843// APPROX-NEXT:    br label [[_ZL7SCALBLNDL_EXIT]]
3844// APPROX:       _ZL7scalblndl.exit:
3845// APPROX-NEXT:    [[COND_I:%.*]] = phi contract double [ [[TMP0]], [[COND_TRUE_I]] ], [ [[CALL_I]], [[COND_FALSE_I]] ]
3846// APPROX-NEXT:    ret double [[COND_I]]
3847//
3848extern "C" __device__ double test_scalbln(double x, long int y) {
3849  return scalbln(x, y);
3850}
3851
3852// DEFAULT-LABEL: @test_scalbnf(
3853// DEFAULT-NEXT:  entry:
3854// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[Y:%.*]])
3855// DEFAULT-NEXT:    ret float [[TMP0]]
3856//
3857// FINITEONLY-LABEL: @test_scalbnf(
3858// FINITEONLY-NEXT:  entry:
3859// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[Y:%.*]])
3860// FINITEONLY-NEXT:    ret float [[TMP0]]
3861//
3862// APPROX-LABEL: @test_scalbnf(
3863// APPROX-NEXT:  entry:
3864// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.ldexp.f32.i32(float [[X:%.*]], i32 [[Y:%.*]])
3865// APPROX-NEXT:    ret float [[TMP0]]
3866//
3867extern "C" __device__ float test_scalbnf(float x, int y) {
3868  return scalbnf(x, y);
3869}
3870
3871// DEFAULT-LABEL: @test_scalbn(
3872// DEFAULT-NEXT:  entry:
3873// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[Y:%.*]])
3874// DEFAULT-NEXT:    ret double [[TMP0]]
3875//
3876// FINITEONLY-LABEL: @test_scalbn(
3877// FINITEONLY-NEXT:  entry:
3878// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[Y:%.*]])
3879// FINITEONLY-NEXT:    ret double [[TMP0]]
3880//
3881// APPROX-LABEL: @test_scalbn(
3882// APPROX-NEXT:  entry:
3883// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.ldexp.f64.i32(double [[X:%.*]], i32 [[Y:%.*]])
3884// APPROX-NEXT:    ret double [[TMP0]]
3885//
3886extern "C" __device__ double test_scalbn(double x, int y) {
3887  return scalbn(x, y);
3888}
3889
3890// CHECK-LABEL: @test___signbitf(
3891// CHECK-NEXT:  entry:
3892// CHECK-NEXT:    [[TMP0:%.*]] = bitcast float [[X:%.*]] to i32
3893// CHECK-NEXT:    [[DOTLOBIT:%.*]] = lshr i32 [[TMP0]], 31
3894// CHECK-NEXT:    ret i32 [[DOTLOBIT]]
3895//
3896extern "C" __device__ BOOL_TYPE test___signbitf(float x) {
3897  return __signbitf(x);
3898}
3899
3900// CHECK-LABEL: @test___signbit(
3901// CHECK-NEXT:  entry:
3902// CHECK-NEXT:    [[TMP0:%.*]] = bitcast double [[X:%.*]] to i64
3903// CHECK-NEXT:    [[DOTLOBIT:%.*]] = lshr i64 [[TMP0]], 63
3904// CHECK-NEXT:    [[CONV:%.*]] = trunc nuw nsw i64 [[DOTLOBIT]] to i32
3905// CHECK-NEXT:    ret i32 [[CONV]]
3906//
3907extern "C" __device__ BOOL_TYPE test___signbit(double x) {
3908  return __signbit(x);
3909}
3910
3911// DEFAULT-LABEL: @test_sincosf(
3912// DEFAULT-NEXT:  entry:
3913// DEFAULT-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
3914// DEFAULT-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3915// DEFAULT-NEXT:    [[CALL_I:%.*]] = call contract float @__ocml_sincos_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3916// DEFAULT-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
3917// DEFAULT-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]]
3918// DEFAULT-NEXT:    store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
3919// DEFAULT-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3920// DEFAULT-NEXT:    ret void
3921//
3922// FINITEONLY-LABEL: @test_sincosf(
3923// FINITEONLY-NEXT:  entry:
3924// FINITEONLY-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
3925// FINITEONLY-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3926// FINITEONLY-NEXT:    [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) float @__ocml_sincos_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3927// FINITEONLY-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
3928// FINITEONLY-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]]
3929// FINITEONLY-NEXT:    store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
3930// FINITEONLY-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3931// FINITEONLY-NEXT:    ret void
3932//
3933// APPROX-LABEL: @test_sincosf(
3934// APPROX-NEXT:  entry:
3935// APPROX-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
3936// APPROX-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3937// APPROX-NEXT:    [[CALL_I:%.*]] = call contract float @__ocml_sincos_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3938// APPROX-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
3939// APPROX-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]]
3940// APPROX-NEXT:    store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
3941// APPROX-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3942// APPROX-NEXT:    ret void
3943//
3944extern "C" __device__ void test_sincosf(float x, float *y, float *z) {
3945  sincosf(x, y, z);
3946}
3947
3948// DEFAULT-LABEL: @test_sincos(
3949// DEFAULT-NEXT:  entry:
3950// DEFAULT-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
3951// DEFAULT-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3952// DEFAULT-NEXT:    [[CALL_I:%.*]] = call contract double @__ocml_sincos_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3953// DEFAULT-NEXT:    store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
3954// DEFAULT-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]]
3955// DEFAULT-NEXT:    store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]]
3956// DEFAULT-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3957// DEFAULT-NEXT:    ret void
3958//
3959// FINITEONLY-LABEL: @test_sincos(
3960// FINITEONLY-NEXT:  entry:
3961// FINITEONLY-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
3962// FINITEONLY-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3963// FINITEONLY-NEXT:    [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) double @__ocml_sincos_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3964// FINITEONLY-NEXT:    store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
3965// FINITEONLY-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]]
3966// FINITEONLY-NEXT:    store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]]
3967// FINITEONLY-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3968// FINITEONLY-NEXT:    ret void
3969//
3970// APPROX-LABEL: @test_sincos(
3971// APPROX-NEXT:  entry:
3972// APPROX-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
3973// APPROX-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3974// APPROX-NEXT:    [[CALL_I:%.*]] = call contract double @__ocml_sincos_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3975// APPROX-NEXT:    store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
3976// APPROX-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]]
3977// APPROX-NEXT:    store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]]
3978// APPROX-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3979// APPROX-NEXT:    ret void
3980//
3981extern "C" __device__ void test_sincos(double x, double *y, double *z) {
3982  sincos(x, y, z);
3983}
3984
3985// DEFAULT-LABEL: @test_sincospif(
3986// DEFAULT-NEXT:  entry:
3987// DEFAULT-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
3988// DEFAULT-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3989// DEFAULT-NEXT:    [[CALL_I:%.*]] = call contract float @__ocml_sincospi_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
3990// DEFAULT-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
3991// DEFAULT-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]]
3992// DEFAULT-NEXT:    store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
3993// DEFAULT-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
3994// DEFAULT-NEXT:    ret void
3995//
3996// FINITEONLY-LABEL: @test_sincospif(
3997// FINITEONLY-NEXT:  entry:
3998// FINITEONLY-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
3999// FINITEONLY-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4000// FINITEONLY-NEXT:    [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) float @__ocml_sincospi_f32(float noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
4001// FINITEONLY-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
4002// FINITEONLY-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]]
4003// FINITEONLY-NEXT:    store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
4004// FINITEONLY-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4005// FINITEONLY-NEXT:    ret void
4006//
4007// APPROX-LABEL: @test_sincospif(
4008// APPROX-NEXT:  entry:
4009// APPROX-NEXT:    [[__TMP_I:%.*]] = alloca float, align 4, addrspace(5)
4010// APPROX-NEXT:    call void @llvm.lifetime.start.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4011// APPROX-NEXT:    [[CALL_I:%.*]] = call contract float @__ocml_sincospi_f32(float noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
4012// APPROX-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
4013// APPROX-NEXT:    [[TMP0:%.*]] = load float, ptr addrspace(5) [[__TMP_I]], align 4, !tbaa [[TBAA16]]
4014// APPROX-NEXT:    store float [[TMP0]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
4015// APPROX-NEXT:    call void @llvm.lifetime.end.p5(i64 4, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4016// APPROX-NEXT:    ret void
4017//
4018extern "C" __device__ void test_sincospif(float x, float *y, float *z) {
4019  sincospif(x, y, z);
4020}
4021
4022// DEFAULT-LABEL: @test_sincospi(
4023// DEFAULT-NEXT:  entry:
4024// DEFAULT-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
4025// DEFAULT-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4026// DEFAULT-NEXT:    [[CALL_I:%.*]] = call contract double @__ocml_sincospi_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
4027// DEFAULT-NEXT:    store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
4028// DEFAULT-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]]
4029// DEFAULT-NEXT:    store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]]
4030// DEFAULT-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4031// DEFAULT-NEXT:    ret void
4032//
4033// FINITEONLY-LABEL: @test_sincospi(
4034// FINITEONLY-NEXT:  entry:
4035// FINITEONLY-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
4036// FINITEONLY-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4037// FINITEONLY-NEXT:    [[CALL_I:%.*]] = call nnan ninf contract nofpclass(nan inf) double @__ocml_sincospi_f64(double noundef nofpclass(nan inf) [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
4038// FINITEONLY-NEXT:    store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
4039// FINITEONLY-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]]
4040// FINITEONLY-NEXT:    store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]]
4041// FINITEONLY-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4042// FINITEONLY-NEXT:    ret void
4043//
4044// APPROX-LABEL: @test_sincospi(
4045// APPROX-NEXT:  entry:
4046// APPROX-NEXT:    [[__TMP_I:%.*]] = alloca double, align 8, addrspace(5)
4047// APPROX-NEXT:    call void @llvm.lifetime.start.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4048// APPROX-NEXT:    [[CALL_I:%.*]] = call contract double @__ocml_sincospi_f64(double noundef [[X:%.*]], ptr addrspace(5) noundef [[__TMP_I]]) #[[ATTR14]]
4049// APPROX-NEXT:    store double [[CALL_I]], ptr [[Y:%.*]], align 8, !tbaa [[TBAA18]]
4050// APPROX-NEXT:    [[TMP0:%.*]] = load double, ptr addrspace(5) [[__TMP_I]], align 8, !tbaa [[TBAA18]]
4051// APPROX-NEXT:    store double [[TMP0]], ptr [[Z:%.*]], align 8, !tbaa [[TBAA18]]
4052// APPROX-NEXT:    call void @llvm.lifetime.end.p5(i64 8, ptr addrspace(5) [[__TMP_I]]) #[[ATTR15]]
4053// APPROX-NEXT:    ret void
4054//
4055extern "C" __device__ void test_sincospi(double x, double *y, double *z) {
4056  sincospi(x, y, z);
4057}
4058
4059// DEFAULT-LABEL: @test_sinf(
4060// DEFAULT-NEXT:  entry:
4061// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4062// DEFAULT-NEXT:    ret float [[CALL_I]]
4063//
4064// FINITEONLY-LABEL: @test_sinf(
4065// FINITEONLY-NEXT:  entry:
4066// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4067// FINITEONLY-NEXT:    ret float [[CALL_I]]
4068//
4069// APPROX-LABEL: @test_sinf(
4070// APPROX-NEXT:  entry:
4071// APPROX-NEXT:    [[CALL_I1:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4072// APPROX-NEXT:    ret float [[CALL_I1]]
4073//
4074extern "C" __device__ float test_sinf(float x) {
4075  return sinf(x);
4076}
4077
4078// DEFAULT-LABEL: @test_sin(
4079// DEFAULT-NEXT:  entry:
4080// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sin_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4081// DEFAULT-NEXT:    ret double [[CALL_I]]
4082//
4083// FINITEONLY-LABEL: @test_sin(
4084// FINITEONLY-NEXT:  entry:
4085// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_sin_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4086// FINITEONLY-NEXT:    ret double [[CALL_I]]
4087//
4088// APPROX-LABEL: @test_sin(
4089// APPROX-NEXT:  entry:
4090// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sin_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4091// APPROX-NEXT:    ret double [[CALL_I]]
4092//
4093extern "C" __device__ double test_sin(double x) {
4094  return sin(x);
4095}
4096
4097// DEFAULT-LABEL: @test_sinpif(
4098// DEFAULT-NEXT:  entry:
4099// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sinpi_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4100// DEFAULT-NEXT:    ret float [[CALL_I]]
4101//
4102// FINITEONLY-LABEL: @test_sinpif(
4103// FINITEONLY-NEXT:  entry:
4104// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_sinpi_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4105// FINITEONLY-NEXT:    ret float [[CALL_I]]
4106//
4107// APPROX-LABEL: @test_sinpif(
4108// APPROX-NEXT:  entry:
4109// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_sinpi_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4110// APPROX-NEXT:    ret float [[CALL_I]]
4111//
4112extern "C" __device__ float test_sinpif(float x) {
4113  return sinpif(x);
4114}
4115
4116// DEFAULT-LABEL: @test_sinpi(
4117// DEFAULT-NEXT:  entry:
4118// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sinpi_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4119// DEFAULT-NEXT:    ret double [[CALL_I]]
4120//
4121// FINITEONLY-LABEL: @test_sinpi(
4122// FINITEONLY-NEXT:  entry:
4123// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_sinpi_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4124// FINITEONLY-NEXT:    ret double [[CALL_I]]
4125//
4126// APPROX-LABEL: @test_sinpi(
4127// APPROX-NEXT:  entry:
4128// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_sinpi_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4129// APPROX-NEXT:    ret double [[CALL_I]]
4130//
4131extern "C" __device__ double test_sinpi(double x) {
4132  return sinpi(x);
4133}
4134
4135// DEFAULT-LABEL: @test_sqrtf(
4136// DEFAULT-NEXT:  entry:
4137// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.sqrt.f32(float [[X:%.*]])
4138// DEFAULT-NEXT:    ret float [[TMP0]]
4139//
4140// FINITEONLY-LABEL: @test_sqrtf(
4141// FINITEONLY-NEXT:  entry:
4142// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.sqrt.f32(float [[X:%.*]])
4143// FINITEONLY-NEXT:    ret float [[TMP0]]
4144//
4145// APPROX-LABEL: @test_sqrtf(
4146// APPROX-NEXT:  entry:
4147// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.sqrt.f32(float [[X:%.*]])
4148// APPROX-NEXT:    ret float [[TMP0]]
4149//
4150extern "C" __device__ float test_sqrtf(float x) {
4151  return sqrtf(x);
4152}
4153
4154// DEFAULT-LABEL: @test_sqrt(
4155// DEFAULT-NEXT:  entry:
4156// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.sqrt.f64(double [[X:%.*]])
4157// DEFAULT-NEXT:    ret double [[TMP0]]
4158//
4159// FINITEONLY-LABEL: @test_sqrt(
4160// FINITEONLY-NEXT:  entry:
4161// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.sqrt.f64(double [[X:%.*]])
4162// FINITEONLY-NEXT:    ret double [[TMP0]]
4163//
4164// APPROX-LABEL: @test_sqrt(
4165// APPROX-NEXT:  entry:
4166// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.sqrt.f64(double [[X:%.*]])
4167// APPROX-NEXT:    ret double [[TMP0]]
4168//
4169extern "C" __device__ double test_sqrt(double x) {
4170  return sqrt(x);
4171}
4172
4173// DEFAULT-LABEL: @test_tanf(
4174// DEFAULT-NEXT:  entry:
4175// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tan_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4176// DEFAULT-NEXT:    ret float [[CALL_I]]
4177//
4178// FINITEONLY-LABEL: @test_tanf(
4179// FINITEONLY-NEXT:  entry:
4180// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tan_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4181// FINITEONLY-NEXT:    ret float [[CALL_I]]
4182//
4183// APPROX-LABEL: @test_tanf(
4184// APPROX-NEXT:  entry:
4185// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tan_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4186// APPROX-NEXT:    ret float [[CALL_I]]
4187//
4188extern "C" __device__ float test_tanf(float x) {
4189  return tanf(x);
4190}
4191
4192// DEFAULT-LABEL: @test_tan(
4193// DEFAULT-NEXT:  entry:
4194// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tan_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4195// DEFAULT-NEXT:    ret double [[CALL_I]]
4196//
4197// FINITEONLY-LABEL: @test_tan(
4198// FINITEONLY-NEXT:  entry:
4199// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tan_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4200// FINITEONLY-NEXT:    ret double [[CALL_I]]
4201//
4202// APPROX-LABEL: @test_tan(
4203// APPROX-NEXT:  entry:
4204// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tan_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4205// APPROX-NEXT:    ret double [[CALL_I]]
4206//
4207extern "C" __device__ double test_tan(double x) {
4208  return tan(x);
4209}
4210
4211// DEFAULT-LABEL: @test_tanhf(
4212// DEFAULT-NEXT:  entry:
4213// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tanh_f32(float noundef [[X:%.*]]) #[[ATTR13]]
4214// DEFAULT-NEXT:    ret float [[CALL_I]]
4215//
4216// FINITEONLY-LABEL: @test_tanhf(
4217// FINITEONLY-NEXT:  entry:
4218// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tanh_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
4219// FINITEONLY-NEXT:    ret float [[CALL_I]]
4220//
4221// APPROX-LABEL: @test_tanhf(
4222// APPROX-NEXT:  entry:
4223// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tanh_f32(float noundef [[X:%.*]]) #[[ATTR13]]
4224// APPROX-NEXT:    ret float [[CALL_I]]
4225//
4226extern "C" __device__ float test_tanhf(float x) {
4227  return tanhf(x);
4228}
4229
4230// DEFAULT-LABEL: @test_tanh(
4231// DEFAULT-NEXT:  entry:
4232// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tanh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
4233// DEFAULT-NEXT:    ret double [[CALL_I]]
4234//
4235// FINITEONLY-LABEL: @test_tanh(
4236// FINITEONLY-NEXT:  entry:
4237// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tanh_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR13]]
4238// FINITEONLY-NEXT:    ret double [[CALL_I]]
4239//
4240// APPROX-LABEL: @test_tanh(
4241// APPROX-NEXT:  entry:
4242// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tanh_f64(double noundef [[X:%.*]]) #[[ATTR13]]
4243// APPROX-NEXT:    ret double [[CALL_I]]
4244//
4245extern "C" __device__ double test_tanh(double x) {
4246  return tanh(x);
4247}
4248
4249// DEFAULT-LABEL: @test_tgammaf(
4250// DEFAULT-NEXT:  entry:
4251// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tgamma_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4252// DEFAULT-NEXT:    ret float [[CALL_I]]
4253//
4254// FINITEONLY-LABEL: @test_tgammaf(
4255// FINITEONLY-NEXT:  entry:
4256// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_tgamma_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4257// FINITEONLY-NEXT:    ret float [[CALL_I]]
4258//
4259// APPROX-LABEL: @test_tgammaf(
4260// APPROX-NEXT:  entry:
4261// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_tgamma_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4262// APPROX-NEXT:    ret float [[CALL_I]]
4263//
4264extern "C" __device__ float test_tgammaf(float x) {
4265  return tgammaf(x);
4266}
4267
4268// DEFAULT-LABEL: @test_tgamma(
4269// DEFAULT-NEXT:  entry:
4270// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tgamma_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4271// DEFAULT-NEXT:    ret double [[CALL_I]]
4272//
4273// FINITEONLY-LABEL: @test_tgamma(
4274// FINITEONLY-NEXT:  entry:
4275// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_tgamma_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4276// FINITEONLY-NEXT:    ret double [[CALL_I]]
4277//
4278// APPROX-LABEL: @test_tgamma(
4279// APPROX-NEXT:  entry:
4280// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_tgamma_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4281// APPROX-NEXT:    ret double [[CALL_I]]
4282//
4283extern "C" __device__ double test_tgamma(double x) {
4284  return tgamma(x);
4285}
4286
4287// DEFAULT-LABEL: @test_truncf(
4288// DEFAULT-NEXT:  entry:
4289// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.trunc.f32(float [[X:%.*]])
4290// DEFAULT-NEXT:    ret float [[TMP0]]
4291//
4292// FINITEONLY-LABEL: @test_truncf(
4293// FINITEONLY-NEXT:  entry:
4294// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.trunc.f32(float [[X:%.*]])
4295// FINITEONLY-NEXT:    ret float [[TMP0]]
4296//
4297// APPROX-LABEL: @test_truncf(
4298// APPROX-NEXT:  entry:
4299// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.trunc.f32(float [[X:%.*]])
4300// APPROX-NEXT:    ret float [[TMP0]]
4301//
4302extern "C" __device__ float test_truncf(float x) {
4303  return truncf(x);
4304}
4305
4306// DEFAULT-LABEL: @test_trunc(
4307// DEFAULT-NEXT:  entry:
4308// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.trunc.f64(double [[X:%.*]])
4309// DEFAULT-NEXT:    ret double [[TMP0]]
4310//
4311// FINITEONLY-LABEL: @test_trunc(
4312// FINITEONLY-NEXT:  entry:
4313// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.trunc.f64(double [[X:%.*]])
4314// FINITEONLY-NEXT:    ret double [[TMP0]]
4315//
4316// APPROX-LABEL: @test_trunc(
4317// APPROX-NEXT:  entry:
4318// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.trunc.f64(double [[X:%.*]])
4319// APPROX-NEXT:    ret double [[TMP0]]
4320//
4321extern "C" __device__ double test_trunc(double x) {
4322  return trunc(x);
4323}
4324
4325// DEFAULT-LABEL: @test_y0f(
4326// DEFAULT-NEXT:  entry:
4327// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4328// DEFAULT-NEXT:    ret float [[CALL_I]]
4329//
4330// FINITEONLY-LABEL: @test_y0f(
4331// FINITEONLY-NEXT:  entry:
4332// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4333// FINITEONLY-NEXT:    ret float [[CALL_I]]
4334//
4335// APPROX-LABEL: @test_y0f(
4336// APPROX-NEXT:  entry:
4337// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4338// APPROX-NEXT:    ret float [[CALL_I]]
4339//
4340extern "C" __device__ float test_y0f(float x) {
4341  return y0f(x);
4342}
4343
4344// DEFAULT-LABEL: @test_y0(
4345// DEFAULT-NEXT:  entry:
4346// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4347// DEFAULT-NEXT:    ret double [[CALL_I]]
4348//
4349// FINITEONLY-LABEL: @test_y0(
4350// FINITEONLY-NEXT:  entry:
4351// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4352// FINITEONLY-NEXT:    ret double [[CALL_I]]
4353//
4354// APPROX-LABEL: @test_y0(
4355// APPROX-NEXT:  entry:
4356// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4357// APPROX-NEXT:    ret double [[CALL_I]]
4358//
4359extern "C" __device__ double test_y0(double x) {
4360  return y0(x);
4361}
4362
4363// DEFAULT-LABEL: @test_y1f(
4364// DEFAULT-NEXT:  entry:
4365// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4366// DEFAULT-NEXT:    ret float [[CALL_I]]
4367//
4368// FINITEONLY-LABEL: @test_y1f(
4369// FINITEONLY-NEXT:  entry:
4370// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4371// FINITEONLY-NEXT:    ret float [[CALL_I]]
4372//
4373// APPROX-LABEL: @test_y1f(
4374// APPROX-NEXT:  entry:
4375// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4376// APPROX-NEXT:    ret float [[CALL_I]]
4377//
4378extern "C" __device__ float test_y1f(float x) {
4379  return y1f(x);
4380}
4381
4382// DEFAULT-LABEL: @test_y1(
4383// DEFAULT-NEXT:  entry:
4384// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4385// DEFAULT-NEXT:    ret double [[CALL_I]]
4386//
4387// FINITEONLY-LABEL: @test_y1(
4388// FINITEONLY-NEXT:  entry:
4389// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4390// FINITEONLY-NEXT:    ret double [[CALL_I]]
4391//
4392// APPROX-LABEL: @test_y1(
4393// APPROX-NEXT:  entry:
4394// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[X:%.*]]) #[[ATTR14]]
4395// APPROX-NEXT:    ret double [[CALL_I]]
4396//
4397extern "C" __device__ double test_y1(double x) {
4398  return y1(x);
4399}
4400
4401// DEFAULT-LABEL: @test_ynf(
4402// DEFAULT-NEXT:  entry:
4403// DEFAULT-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
4404// DEFAULT-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
4405// DEFAULT-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
4406// DEFAULT-NEXT:    ]
4407// DEFAULT:       if.then.i:
4408// DEFAULT-NEXT:    [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y:%.*]]) #[[ATTR14]]
4409// DEFAULT-NEXT:    br label [[_ZL3YNFIF_EXIT:%.*]]
4410// DEFAULT:       if.then2.i:
4411// DEFAULT-NEXT:    [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR14]]
4412// DEFAULT-NEXT:    br label [[_ZL3YNFIF_EXIT]]
4413// DEFAULT:       if.end4.i:
4414// DEFAULT-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y]]) #[[ATTR14]]
4415// DEFAULT-NEXT:    [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR14]]
4416// DEFAULT-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
4417// DEFAULT-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3YNFIF_EXIT]]
4418// DEFAULT:       for.body.i:
4419// DEFAULT-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
4420// DEFAULT-NEXT:    [[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
4421// DEFAULT-NEXT:    [[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
4422// DEFAULT-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
4423// DEFAULT-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to float
4424// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract float [[CONV_I]], [[Y]]
4425// DEFAULT-NEXT:    [[MUL8_I:%.*]] = fmul contract float [[__X1_0_I3]], [[DIV_I]]
4426// DEFAULT-NEXT:    [[SUB_I]] = fsub contract float [[MUL8_I]], [[__X0_0_I2]]
4427// DEFAULT-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
4428// DEFAULT-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
4429// DEFAULT-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL3YNFIF_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP24:![0-9]+]]
4430// DEFAULT:       _ZL3ynfif.exit:
4431// DEFAULT-NEXT:    [[RETVAL_0_I:%.*]] = phi float [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
4432// DEFAULT-NEXT:    ret float [[RETVAL_0_I]]
4433//
4434// FINITEONLY-LABEL: @test_ynf(
4435// FINITEONLY-NEXT:  entry:
4436// FINITEONLY-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
4437// FINITEONLY-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
4438// FINITEONLY-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
4439// FINITEONLY-NEXT:    ]
4440// FINITEONLY:       if.then.i:
4441// FINITEONLY-NEXT:    [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]]
4442// FINITEONLY-NEXT:    br label [[_ZL3YNFIF_EXIT:%.*]]
4443// FINITEONLY:       if.then2.i:
4444// FINITEONLY-NEXT:    [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
4445// FINITEONLY-NEXT:    br label [[_ZL3YNFIF_EXIT]]
4446// FINITEONLY:       if.end4.i:
4447// FINITEONLY-NEXT:    [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y0_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
4448// FINITEONLY-NEXT:    [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_y1_f32(float noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
4449// FINITEONLY-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
4450// FINITEONLY-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3YNFIF_EXIT]]
4451// FINITEONLY:       for.body.i:
4452// FINITEONLY-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
4453// FINITEONLY-NEXT:    [[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
4454// FINITEONLY-NEXT:    [[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
4455// FINITEONLY-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
4456// FINITEONLY-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to float
4457// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract float [[CONV_I]], [[Y]]
4458// FINITEONLY-NEXT:    [[MUL8_I:%.*]] = fmul nnan ninf contract float [[__X1_0_I3]], [[DIV_I]]
4459// FINITEONLY-NEXT:    [[SUB_I]] = fsub nnan ninf contract float [[MUL8_I]], [[__X0_0_I2]]
4460// FINITEONLY-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
4461// FINITEONLY-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
4462// FINITEONLY-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL3YNFIF_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP24:![0-9]+]]
4463// FINITEONLY:       _ZL3ynfif.exit:
4464// FINITEONLY-NEXT:    [[RETVAL_0_I:%.*]] = phi float [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
4465// FINITEONLY-NEXT:    ret float [[RETVAL_0_I]]
4466//
4467// APPROX-LABEL: @test_ynf(
4468// APPROX-NEXT:  entry:
4469// APPROX-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
4470// APPROX-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
4471// APPROX-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
4472// APPROX-NEXT:    ]
4473// APPROX:       if.then.i:
4474// APPROX-NEXT:    [[CALL_I20_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y:%.*]]) #[[ATTR14]]
4475// APPROX-NEXT:    br label [[_ZL3YNFIF_EXIT:%.*]]
4476// APPROX:       if.then2.i:
4477// APPROX-NEXT:    [[CALL_I22_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR14]]
4478// APPROX-NEXT:    br label [[_ZL3YNFIF_EXIT]]
4479// APPROX:       if.end4.i:
4480// APPROX-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_y0_f32(float noundef [[Y]]) #[[ATTR14]]
4481// APPROX-NEXT:    [[CALL_I21_I:%.*]] = tail call contract noundef float @__ocml_y1_f32(float noundef [[Y]]) #[[ATTR14]]
4482// APPROX-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
4483// APPROX-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL3YNFIF_EXIT]]
4484// APPROX:       for.body.i:
4485// APPROX-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
4486// APPROX-NEXT:    [[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
4487// APPROX-NEXT:    [[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
4488// APPROX-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
4489// APPROX-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to float
4490// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract float [[CONV_I]], [[Y]]
4491// APPROX-NEXT:    [[MUL8_I:%.*]] = fmul contract float [[__X1_0_I3]], [[DIV_I]]
4492// APPROX-NEXT:    [[SUB_I]] = fsub contract float [[MUL8_I]], [[__X0_0_I2]]
4493// APPROX-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
4494// APPROX-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
4495// APPROX-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL3YNFIF_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP24:![0-9]+]]
4496// APPROX:       _ZL3ynfif.exit:
4497// APPROX-NEXT:    [[RETVAL_0_I:%.*]] = phi float [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
4498// APPROX-NEXT:    ret float [[RETVAL_0_I]]
4499//
4500extern "C" __device__ float test_ynf(int x, float y) {
4501  return ynf(x, y);
4502}
4503
4504// DEFAULT-LABEL: @test_yn(
4505// DEFAULT-NEXT:  entry:
4506// DEFAULT-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
4507// DEFAULT-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
4508// DEFAULT-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
4509// DEFAULT-NEXT:    ]
4510// DEFAULT:       if.then.i:
4511// DEFAULT-NEXT:    [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y:%.*]]) #[[ATTR14]]
4512// DEFAULT-NEXT:    br label [[_ZL2YNID_EXIT:%.*]]
4513// DEFAULT:       if.then2.i:
4514// DEFAULT-NEXT:    [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR14]]
4515// DEFAULT-NEXT:    br label [[_ZL2YNID_EXIT]]
4516// DEFAULT:       if.end4.i:
4517// DEFAULT-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y]]) #[[ATTR14]]
4518// DEFAULT-NEXT:    [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR14]]
4519// DEFAULT-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
4520// DEFAULT-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2YNID_EXIT]]
4521// DEFAULT:       for.body.i:
4522// DEFAULT-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
4523// DEFAULT-NEXT:    [[__X1_0_I3:%.*]] = phi double [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
4524// DEFAULT-NEXT:    [[__X0_0_I2:%.*]] = phi double [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
4525// DEFAULT-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
4526// DEFAULT-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to double
4527// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract double [[CONV_I]], [[Y]]
4528// DEFAULT-NEXT:    [[MUL8_I:%.*]] = fmul contract double [[__X1_0_I3]], [[DIV_I]]
4529// DEFAULT-NEXT:    [[SUB_I]] = fsub contract double [[MUL8_I]], [[__X0_0_I2]]
4530// DEFAULT-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
4531// DEFAULT-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
4532// DEFAULT-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL2YNID_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP25:![0-9]+]]
4533// DEFAULT:       _ZL2ynid.exit:
4534// DEFAULT-NEXT:    [[RETVAL_0_I:%.*]] = phi double [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
4535// DEFAULT-NEXT:    ret double [[RETVAL_0_I]]
4536//
4537// FINITEONLY-LABEL: @test_yn(
4538// FINITEONLY-NEXT:  entry:
4539// FINITEONLY-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
4540// FINITEONLY-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
4541// FINITEONLY-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
4542// FINITEONLY-NEXT:    ]
4543// FINITEONLY:       if.then.i:
4544// FINITEONLY-NEXT:    [[CALL_I20_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR14]]
4545// FINITEONLY-NEXT:    br label [[_ZL2YNID_EXIT:%.*]]
4546// FINITEONLY:       if.then2.i:
4547// FINITEONLY-NEXT:    [[CALL_I22_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
4548// FINITEONLY-NEXT:    br label [[_ZL2YNID_EXIT]]
4549// FINITEONLY:       if.end4.i:
4550// FINITEONLY-NEXT:    [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y0_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
4551// FINITEONLY-NEXT:    [[CALL_I21_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) double @__ocml_y1_f64(double noundef nofpclass(nan inf) [[Y]]) #[[ATTR14]]
4552// FINITEONLY-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
4553// FINITEONLY-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2YNID_EXIT]]
4554// FINITEONLY:       for.body.i:
4555// FINITEONLY-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
4556// FINITEONLY-NEXT:    [[__X1_0_I3:%.*]] = phi double [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
4557// FINITEONLY-NEXT:    [[__X0_0_I2:%.*]] = phi double [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
4558// FINITEONLY-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
4559// FINITEONLY-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to double
4560// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract double [[CONV_I]], [[Y]]
4561// FINITEONLY-NEXT:    [[MUL8_I:%.*]] = fmul nnan ninf contract double [[__X1_0_I3]], [[DIV_I]]
4562// FINITEONLY-NEXT:    [[SUB_I]] = fsub nnan ninf contract double [[MUL8_I]], [[__X0_0_I2]]
4563// FINITEONLY-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
4564// FINITEONLY-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
4565// FINITEONLY-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL2YNID_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP25:![0-9]+]]
4566// FINITEONLY:       _ZL2ynid.exit:
4567// FINITEONLY-NEXT:    [[RETVAL_0_I:%.*]] = phi double [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
4568// FINITEONLY-NEXT:    ret double [[RETVAL_0_I]]
4569//
4570// APPROX-LABEL: @test_yn(
4571// APPROX-NEXT:  entry:
4572// APPROX-NEXT:    switch i32 [[X:%.*]], label [[IF_END4_I:%.*]] [
4573// APPROX-NEXT:      i32 0, label [[IF_THEN_I:%.*]]
4574// APPROX-NEXT:      i32 1, label [[IF_THEN2_I:%.*]]
4575// APPROX-NEXT:    ]
4576// APPROX:       if.then.i:
4577// APPROX-NEXT:    [[CALL_I20_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y:%.*]]) #[[ATTR14]]
4578// APPROX-NEXT:    br label [[_ZL2YNID_EXIT:%.*]]
4579// APPROX:       if.then2.i:
4580// APPROX-NEXT:    [[CALL_I22_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR14]]
4581// APPROX-NEXT:    br label [[_ZL2YNID_EXIT]]
4582// APPROX:       if.end4.i:
4583// APPROX-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef double @__ocml_y0_f64(double noundef [[Y]]) #[[ATTR14]]
4584// APPROX-NEXT:    [[CALL_I21_I:%.*]] = tail call contract noundef double @__ocml_y1_f64(double noundef [[Y]]) #[[ATTR14]]
4585// APPROX-NEXT:    [[CMP7_I1:%.*]] = icmp sgt i32 [[X]], 1
4586// APPROX-NEXT:    br i1 [[CMP7_I1]], label [[FOR_BODY_I:%.*]], label [[_ZL2YNID_EXIT]]
4587// APPROX:       for.body.i:
4588// APPROX-NEXT:    [[__I_0_I4:%.*]] = phi i32 [ [[INC_I:%.*]], [[FOR_BODY_I]] ], [ 1, [[IF_END4_I]] ]
4589// APPROX-NEXT:    [[__X1_0_I3:%.*]] = phi double [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ]
4590// APPROX-NEXT:    [[__X0_0_I2:%.*]] = phi double [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ]
4591// APPROX-NEXT:    [[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1
4592// APPROX-NEXT:    [[CONV_I:%.*]] = uitofp nneg i32 [[MUL_I]] to double
4593// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract double [[CONV_I]], [[Y]]
4594// APPROX-NEXT:    [[MUL8_I:%.*]] = fmul contract double [[__X1_0_I3]], [[DIV_I]]
4595// APPROX-NEXT:    [[SUB_I]] = fsub contract double [[MUL8_I]], [[__X0_0_I2]]
4596// APPROX-NEXT:    [[INC_I]] = add nuw nsw i32 [[__I_0_I4]], 1
4597// APPROX-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC_I]], [[X]]
4598// APPROX-NEXT:    br i1 [[EXITCOND_NOT]], label [[_ZL2YNID_EXIT]], label [[FOR_BODY_I]], !llvm.loop [[LOOP25:![0-9]+]]
4599// APPROX:       _ZL2ynid.exit:
4600// APPROX-NEXT:    [[RETVAL_0_I:%.*]] = phi double [ [[CALL_I20_I]], [[IF_THEN_I]] ], [ [[CALL_I22_I]], [[IF_THEN2_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ], [ [[SUB_I]], [[FOR_BODY_I]] ]
4601// APPROX-NEXT:    ret double [[RETVAL_0_I]]
4602//
4603extern "C" __device__ double test_yn(int x, double y) {
4604  return yn(x, y);
4605}
4606
4607// DEFAULT-LABEL: @test___cosf(
4608// DEFAULT-NEXT:  entry:
4609// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4610// DEFAULT-NEXT:    ret float [[CALL_I]]
4611//
4612// FINITEONLY-LABEL: @test___cosf(
4613// FINITEONLY-NEXT:  entry:
4614// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4615// FINITEONLY-NEXT:    ret float [[CALL_I]]
4616//
4617// APPROX-LABEL: @test___cosf(
4618// APPROX-NEXT:  entry:
4619// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4620// APPROX-NEXT:    ret float [[CALL_I]]
4621//
4622extern "C" __device__ float test___cosf(float x) {
4623  return __cosf(x);
4624}
4625
4626// DEFAULT-LABEL: @test___exp10f(
4627// DEFAULT-NEXT:  entry:
4628// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract float [[X:%.*]], 0x400A934F00000000
4629// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.exp2.f32(float [[MUL_I]])
4630// DEFAULT-NEXT:    ret float [[TMP0]]
4631//
4632// FINITEONLY-LABEL: @test___exp10f(
4633// FINITEONLY-NEXT:  entry:
4634// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract float [[X:%.*]], 0x400A934F00000000
4635// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.amdgcn.exp2.f32(float [[MUL_I]])
4636// FINITEONLY-NEXT:    ret float [[TMP0]]
4637//
4638// APPROX-LABEL: @test___exp10f(
4639// APPROX-NEXT:  entry:
4640// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract float [[X:%.*]], 0x400A934F00000000
4641// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.exp2.f32(float [[MUL_I]])
4642// APPROX-NEXT:    ret float [[TMP0]]
4643//
4644extern "C" __device__ float test___exp10f(float x) {
4645  return __exp10f(x);
4646}
4647
4648// DEFAULT-LABEL: @test___expf(
4649// DEFAULT-NEXT:  entry:
4650// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract float [[X:%.*]], 0x3FF7154760000000
4651// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.exp2.f32(float [[MUL_I]])
4652// DEFAULT-NEXT:    ret float [[TMP0]]
4653//
4654// FINITEONLY-LABEL: @test___expf(
4655// FINITEONLY-NEXT:  entry:
4656// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract float [[X:%.*]], 0x3FF7154760000000
4657// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.amdgcn.exp2.f32(float [[MUL_I]])
4658// FINITEONLY-NEXT:    ret float [[TMP0]]
4659//
4660// APPROX-LABEL: @test___expf(
4661// APPROX-NEXT:  entry:
4662// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract float [[X:%.*]], 0x3FF7154760000000
4663// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.exp2.f32(float [[MUL_I]])
4664// APPROX-NEXT:    ret float [[TMP0]]
4665//
4666extern "C" __device__ float test___expf(float x) {
4667  return __expf(x);
4668}
4669
4670// DEFAULT-LABEL: @test___fadd_rn(
4671// DEFAULT-NEXT:  entry:
4672// DEFAULT-NEXT:    [[ADD_I:%.*]] = fadd contract float [[X:%.*]], [[Y:%.*]]
4673// DEFAULT-NEXT:    ret float [[ADD_I]]
4674//
4675// FINITEONLY-LABEL: @test___fadd_rn(
4676// FINITEONLY-NEXT:  entry:
4677// FINITEONLY-NEXT:    [[ADD_I:%.*]] = fadd nnan ninf contract float [[X:%.*]], [[Y:%.*]]
4678// FINITEONLY-NEXT:    ret float [[ADD_I]]
4679//
4680// APPROX-LABEL: @test___fadd_rn(
4681// APPROX-NEXT:  entry:
4682// APPROX-NEXT:    [[ADD_I:%.*]] = fadd contract float [[X:%.*]], [[Y:%.*]]
4683// APPROX-NEXT:    ret float [[ADD_I]]
4684//
4685extern "C" __device__ float test___fadd_rn(float x, float y) {
4686  return __fadd_rn(x, y);
4687}
4688
4689// DEFAULT-LABEL: @test___fdividef(
4690// DEFAULT-NEXT:  entry:
4691// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract float [[X:%.*]], [[Y:%.*]]
4692// DEFAULT-NEXT:    ret float [[DIV_I]]
4693//
4694// FINITEONLY-LABEL: @test___fdividef(
4695// FINITEONLY-NEXT:  entry:
4696// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract float [[X:%.*]], [[Y:%.*]]
4697// FINITEONLY-NEXT:    ret float [[DIV_I]]
4698//
4699// APPROX-LABEL: @test___fdividef(
4700// APPROX-NEXT:  entry:
4701// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract float [[X:%.*]], [[Y:%.*]]
4702// APPROX-NEXT:    ret float [[DIV_I]]
4703//
4704extern "C" __device__ float test___fdividef(float x, float y) {
4705  return __fdividef(x, y);
4706}
4707
4708// DEFAULT-LABEL: @test__fmaf_rn(
4709// DEFAULT-NEXT:  entry:
4710// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
4711// DEFAULT-NEXT:    ret float [[TMP0]]
4712//
4713// FINITEONLY-LABEL: @test__fmaf_rn(
4714// FINITEONLY-NEXT:  entry:
4715// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
4716// FINITEONLY-NEXT:    ret float [[TMP0]]
4717//
4718// APPROX-LABEL: @test__fmaf_rn(
4719// APPROX-NEXT:  entry:
4720// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.fma.f32(float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]])
4721// APPROX-NEXT:    ret float [[TMP0]]
4722//
4723extern "C" __device__ float test__fmaf_rn(float x, float y, float z) {
4724  return __fmaf_rn(x, y, z);
4725}
4726
4727// DEFAULT-LABEL: @test___fmul_rn(
4728// DEFAULT-NEXT:  entry:
4729// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract float [[X:%.*]], [[Y:%.*]]
4730// DEFAULT-NEXT:    ret float [[MUL_I]]
4731//
4732// FINITEONLY-LABEL: @test___fmul_rn(
4733// FINITEONLY-NEXT:  entry:
4734// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract float [[X:%.*]], [[Y:%.*]]
4735// FINITEONLY-NEXT:    ret float [[MUL_I]]
4736//
4737// APPROX-LABEL: @test___fmul_rn(
4738// APPROX-NEXT:  entry:
4739// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract float [[X:%.*]], [[Y:%.*]]
4740// APPROX-NEXT:    ret float [[MUL_I]]
4741//
4742extern "C" __device__ float test___fmul_rn(float x, float y) {
4743  return __fmul_rn(x, y);
4744}
4745
4746// DEFAULT-LABEL: @test___frcp_rn(
4747// DEFAULT-NEXT:  entry:
4748// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract float 1.000000e+00, [[X:%.*]]
4749// DEFAULT-NEXT:    ret float [[DIV_I]]
4750//
4751// FINITEONLY-LABEL: @test___frcp_rn(
4752// FINITEONLY-NEXT:  entry:
4753// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract float 1.000000e+00, [[X:%.*]]
4754// FINITEONLY-NEXT:    ret float [[DIV_I]]
4755//
4756// APPROX-LABEL: @test___frcp_rn(
4757// APPROX-NEXT:  entry:
4758// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract float 1.000000e+00, [[X:%.*]]
4759// APPROX-NEXT:    ret float [[DIV_I]]
4760//
4761extern "C" __device__ float test___frcp_rn(float x) {
4762  return __frcp_rn(x);
4763}
4764
4765// DEFAULT-LABEL: @test___frsqrt_rn(
4766// DEFAULT-NEXT:  entry:
4767// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.rsq.f32(float [[X:%.*]])
4768// DEFAULT-NEXT:    ret float [[TMP0]]
4769//
4770// FINITEONLY-LABEL: @test___frsqrt_rn(
4771// FINITEONLY-NEXT:  entry:
4772// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.amdgcn.rsq.f32(float [[X:%.*]])
4773// FINITEONLY-NEXT:    ret float [[TMP0]]
4774//
4775// APPROX-LABEL: @test___frsqrt_rn(
4776// APPROX-NEXT:  entry:
4777// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.rsq.f32(float [[X:%.*]])
4778// APPROX-NEXT:    ret float [[TMP0]]
4779//
4780extern "C" __device__ float test___frsqrt_rn(float x) {
4781  return __frsqrt_rn(x);
4782}
4783
4784// DEFAULT-LABEL: @test___fsqrt_rn(
4785// DEFAULT-NEXT:  entry:
4786// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sqrt_f32(float noundef [[X:%.*]]) #[[ATTR12]]
4787// DEFAULT-NEXT:    ret float [[CALL_I]]
4788//
4789// FINITEONLY-LABEL: @test___fsqrt_rn(
4790// FINITEONLY-NEXT:  entry:
4791// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sqrt_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR12]]
4792// FINITEONLY-NEXT:    ret float [[CALL_I]]
4793//
4794// APPROX-LABEL: @test___fsqrt_rn(
4795// APPROX-NEXT:  entry:
4796// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sqrt_f32(float noundef [[X:%.*]]) #[[ATTR12]]
4797// APPROX-NEXT:    ret float [[CALL_I]]
4798//
4799extern "C" __device__ float test___fsqrt_rn(float x) {
4800  return __fsqrt_rn(x);
4801}
4802
4803// DEFAULT-LABEL: @test___fsub_rn(
4804// DEFAULT-NEXT:  entry:
4805// DEFAULT-NEXT:    [[SUB_I:%.*]] = fsub contract float [[X:%.*]], [[Y:%.*]]
4806// DEFAULT-NEXT:    ret float [[SUB_I]]
4807//
4808// FINITEONLY-LABEL: @test___fsub_rn(
4809// FINITEONLY-NEXT:  entry:
4810// FINITEONLY-NEXT:    [[SUB_I:%.*]] = fsub nnan ninf contract float [[X:%.*]], [[Y:%.*]]
4811// FINITEONLY-NEXT:    ret float [[SUB_I]]
4812//
4813// APPROX-LABEL: @test___fsub_rn(
4814// APPROX-NEXT:  entry:
4815// APPROX-NEXT:    [[SUB_I:%.*]] = fsub contract float [[X:%.*]], [[Y:%.*]]
4816// APPROX-NEXT:    ret float [[SUB_I]]
4817//
4818extern "C" __device__ float test___fsub_rn(float x, float y) {
4819  return __fsub_rn(x, y);
4820}
4821
4822// DEFAULT-LABEL: @test___log10f(
4823// DEFAULT-NEXT:  entry:
4824// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.log10.f32(float [[X:%.*]])
4825// DEFAULT-NEXT:    ret float [[TMP0]]
4826//
4827// FINITEONLY-LABEL: @test___log10f(
4828// FINITEONLY-NEXT:  entry:
4829// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.log10.f32(float [[X:%.*]])
4830// FINITEONLY-NEXT:    ret float [[TMP0]]
4831//
4832// APPROX-LABEL: @test___log10f(
4833// APPROX-NEXT:  entry:
4834// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.log10.f32(float [[X:%.*]])
4835// APPROX-NEXT:    ret float [[TMP0]]
4836//
4837extern "C" __device__ float test___log10f(float x) {
4838  return __log10f(x);
4839}
4840
4841// DEFAULT-LABEL: @test___log2f(
4842// DEFAULT-NEXT:  entry:
4843// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.log.f32(float [[X:%.*]])
4844// DEFAULT-NEXT:    ret float [[TMP0]]
4845//
4846// FINITEONLY-LABEL: @test___log2f(
4847// FINITEONLY-NEXT:  entry:
4848// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.amdgcn.log.f32(float [[X:%.*]])
4849// FINITEONLY-NEXT:    ret float [[TMP0]]
4850//
4851// APPROX-LABEL: @test___log2f(
4852// APPROX-NEXT:  entry:
4853// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.log.f32(float [[X:%.*]])
4854// APPROX-NEXT:    ret float [[TMP0]]
4855//
4856extern "C" __device__ float test___log2f(float x) {
4857  return __log2f(x);
4858}
4859
4860// DEFAULT-LABEL: @test___logf(
4861// DEFAULT-NEXT:  entry:
4862// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.log.f32(float [[X:%.*]])
4863// DEFAULT-NEXT:    ret float [[TMP0]]
4864//
4865// FINITEONLY-LABEL: @test___logf(
4866// FINITEONLY-NEXT:  entry:
4867// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.log.f32(float [[X:%.*]])
4868// FINITEONLY-NEXT:    ret float [[TMP0]]
4869//
4870// APPROX-LABEL: @test___logf(
4871// APPROX-NEXT:  entry:
4872// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.log.f32(float [[X:%.*]])
4873// APPROX-NEXT:    ret float [[TMP0]]
4874//
4875extern "C" __device__ float test___logf(float x) {
4876  return __logf(x);
4877}
4878
4879// DEFAULT-LABEL: @test___powf(
4880// DEFAULT-NEXT:  entry:
4881// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR13]]
4882// DEFAULT-NEXT:    ret float [[CALL_I]]
4883//
4884// FINITEONLY-LABEL: @test___powf(
4885// FINITEONLY-NEXT:  entry:
4886// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_pow_f32(float noundef nofpclass(nan inf) [[X:%.*]], float noundef nofpclass(nan inf) [[Y:%.*]]) #[[ATTR13]]
4887// FINITEONLY-NEXT:    ret float [[CALL_I]]
4888//
4889// APPROX-LABEL: @test___powf(
4890// APPROX-NEXT:  entry:
4891// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_pow_f32(float noundef [[X:%.*]], float noundef [[Y:%.*]]) #[[ATTR13]]
4892// APPROX-NEXT:    ret float [[CALL_I]]
4893//
4894extern "C" __device__ float test___powf(float x, float y) {
4895  return __powf(x, y);
4896}
4897
4898// DEFAULT-LABEL: @test___saturatef(
4899// DEFAULT-NEXT:  entry:
4900// DEFAULT-NEXT:    [[CMP_I:%.*]] = fcmp contract olt float [[X:%.*]], 0.000000e+00
4901// DEFAULT-NEXT:    [[CMP1_I:%.*]] = fcmp contract ogt float [[X]], 1.000000e+00
4902// DEFAULT-NEXT:    [[COND_I:%.*]] = select contract i1 [[CMP1_I]], float 1.000000e+00, float [[X]]
4903// DEFAULT-NEXT:    [[COND5_I:%.*]] = select contract i1 [[CMP_I]], float 0.000000e+00, float [[COND_I]]
4904// DEFAULT-NEXT:    ret float [[COND5_I]]
4905//
4906// FINITEONLY-LABEL: @test___saturatef(
4907// FINITEONLY-NEXT:  entry:
4908// FINITEONLY-NEXT:    [[CMP_I:%.*]] = fcmp nnan ninf contract olt float [[X:%.*]], 0.000000e+00
4909// FINITEONLY-NEXT:    [[CMP1_I:%.*]] = fcmp nnan ninf contract ogt float [[X]], 1.000000e+00
4910// FINITEONLY-NEXT:    [[COND_I:%.*]] = select nnan ninf contract i1 [[CMP1_I]], float 1.000000e+00, float [[X]]
4911// FINITEONLY-NEXT:    [[COND5_I:%.*]] = select nnan ninf contract i1 [[CMP_I]], float 0.000000e+00, float [[COND_I]]
4912// FINITEONLY-NEXT:    ret float [[COND5_I]]
4913//
4914// APPROX-LABEL: @test___saturatef(
4915// APPROX-NEXT:  entry:
4916// APPROX-NEXT:    [[CMP_I:%.*]] = fcmp contract olt float [[X:%.*]], 0.000000e+00
4917// APPROX-NEXT:    [[CMP1_I:%.*]] = fcmp contract ogt float [[X]], 1.000000e+00
4918// APPROX-NEXT:    [[COND_I:%.*]] = select contract i1 [[CMP1_I]], float 1.000000e+00, float [[X]]
4919// APPROX-NEXT:    [[COND5_I:%.*]] = select contract i1 [[CMP_I]], float 0.000000e+00, float [[COND_I]]
4920// APPROX-NEXT:    ret float [[COND5_I]]
4921//
4922extern "C" __device__ float test___saturatef(float x) {
4923  return __saturatef(x);
4924}
4925
4926// DEFAULT-LABEL: @test___sincosf(
4927// DEFAULT-NEXT:  entry:
4928// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4929// DEFAULT-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
4930// DEFAULT-NEXT:    [[CALL1_I:%.*]] = tail call contract float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR14]]
4931// DEFAULT-NEXT:    store float [[CALL1_I]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
4932// DEFAULT-NEXT:    ret void
4933//
4934// FINITEONLY-LABEL: @test___sincosf(
4935// FINITEONLY-NEXT:  entry:
4936// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4937// FINITEONLY-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
4938// FINITEONLY-NEXT:    [[CALL1_I:%.*]] = tail call nnan ninf contract nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X]]) #[[ATTR14]]
4939// FINITEONLY-NEXT:    store float [[CALL1_I]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
4940// FINITEONLY-NEXT:    ret void
4941//
4942// APPROX-LABEL: @test___sincosf(
4943// APPROX-NEXT:  entry:
4944// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4945// APPROX-NEXT:    store float [[CALL_I]], ptr [[Y:%.*]], align 4, !tbaa [[TBAA16]]
4946// APPROX-NEXT:    [[CALL1_I:%.*]] = tail call contract float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR14]]
4947// APPROX-NEXT:    store float [[CALL1_I]], ptr [[Z:%.*]], align 4, !tbaa [[TBAA16]]
4948// APPROX-NEXT:    ret void
4949//
4950extern "C" __device__ void test___sincosf(float x, float *y, float *z) {
4951  __sincosf(x, y, z);
4952}
4953
4954// DEFAULT-LABEL: @test___sinf(
4955// DEFAULT-NEXT:  entry:
4956// DEFAULT-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4957// DEFAULT-NEXT:    ret float [[CALL_I]]
4958//
4959// FINITEONLY-LABEL: @test___sinf(
4960// FINITEONLY-NEXT:  entry:
4961// FINITEONLY-NEXT:    [[CALL_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4962// FINITEONLY-NEXT:    ret float [[CALL_I]]
4963//
4964// APPROX-LABEL: @test___sinf(
4965// APPROX-NEXT:  entry:
4966// APPROX-NEXT:    [[CALL_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4967// APPROX-NEXT:    ret float [[CALL_I]]
4968//
4969extern "C" __device__ float test___sinf(float x) {
4970  return __sinf(x);
4971}
4972
4973// DEFAULT-LABEL: @test___tanf(
4974// DEFAULT-NEXT:  entry:
4975// DEFAULT-NEXT:    [[CALL_I3_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4976// DEFAULT-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR14]]
4977// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.amdgcn.rcp.f32(float [[CALL_I_I]])
4978// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract float [[CALL_I3_I]], [[TMP0]]
4979// DEFAULT-NEXT:    ret float [[MUL_I]]
4980//
4981// FINITEONLY-LABEL: @test___tanf(
4982// FINITEONLY-NEXT:  entry:
4983// FINITEONLY-NEXT:    [[CALL_I3_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_sin_f32(float noundef nofpclass(nan inf) [[X:%.*]]) #[[ATTR14]]
4984// FINITEONLY-NEXT:    [[CALL_I_I:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @__ocml_native_cos_f32(float noundef nofpclass(nan inf) [[X]]) #[[ATTR14]]
4985// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract float @llvm.amdgcn.rcp.f32(float [[CALL_I_I]])
4986// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract float [[CALL_I3_I]], [[TMP0]]
4987// FINITEONLY-NEXT:    ret float [[MUL_I]]
4988//
4989// APPROX-LABEL: @test___tanf(
4990// APPROX-NEXT:  entry:
4991// APPROX-NEXT:    [[CALL_I3_I:%.*]] = tail call contract noundef float @__ocml_native_sin_f32(float noundef [[X:%.*]]) #[[ATTR14]]
4992// APPROX-NEXT:    [[CALL_I_I:%.*]] = tail call contract noundef float @__ocml_native_cos_f32(float noundef [[X]]) #[[ATTR14]]
4993// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract float @llvm.amdgcn.rcp.f32(float [[CALL_I_I]])
4994// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract float [[CALL_I3_I]], [[TMP0]]
4995// APPROX-NEXT:    ret float [[MUL_I]]
4996//
4997extern "C" __device__ float test___tanf(float x) {
4998  return __tanf(x);
4999}
5000
5001// DEFAULT-LABEL: @test___dadd_rn(
5002// DEFAULT-NEXT:  entry:
5003// DEFAULT-NEXT:    [[ADD_I:%.*]] = fadd contract double [[X:%.*]], [[Y:%.*]]
5004// DEFAULT-NEXT:    ret double [[ADD_I]]
5005//
5006// FINITEONLY-LABEL: @test___dadd_rn(
5007// FINITEONLY-NEXT:  entry:
5008// FINITEONLY-NEXT:    [[ADD_I:%.*]] = fadd nnan ninf contract double [[X:%.*]], [[Y:%.*]]
5009// FINITEONLY-NEXT:    ret double [[ADD_I]]
5010//
5011// APPROX-LABEL: @test___dadd_rn(
5012// APPROX-NEXT:  entry:
5013// APPROX-NEXT:    [[ADD_I:%.*]] = fadd contract double [[X:%.*]], [[Y:%.*]]
5014// APPROX-NEXT:    ret double [[ADD_I]]
5015//
5016extern "C" __device__ double test___dadd_rn(double x, double y) {
5017  return __dadd_rn(x, y);
5018}
5019
5020// DEFAULT-LABEL: @test___ddiv_rn(
5021// DEFAULT-NEXT:  entry:
5022// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract double [[X:%.*]], [[Y:%.*]]
5023// DEFAULT-NEXT:    ret double [[DIV_I]]
5024//
5025// FINITEONLY-LABEL: @test___ddiv_rn(
5026// FINITEONLY-NEXT:  entry:
5027// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract double [[X:%.*]], [[Y:%.*]]
5028// FINITEONLY-NEXT:    ret double [[DIV_I]]
5029//
5030// APPROX-LABEL: @test___ddiv_rn(
5031// APPROX-NEXT:  entry:
5032// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract double [[X:%.*]], [[Y:%.*]]
5033// APPROX-NEXT:    ret double [[DIV_I]]
5034//
5035extern "C" __device__ double test___ddiv_rn(double x, double y) {
5036  return __ddiv_rn(x, y);
5037}
5038
5039// DEFAULT-LABEL: @test___dmul_rn(
5040// DEFAULT-NEXT:  entry:
5041// DEFAULT-NEXT:    [[MUL_I:%.*]] = fmul contract double [[X:%.*]], [[Y:%.*]]
5042// DEFAULT-NEXT:    ret double [[MUL_I]]
5043//
5044// FINITEONLY-LABEL: @test___dmul_rn(
5045// FINITEONLY-NEXT:  entry:
5046// FINITEONLY-NEXT:    [[MUL_I:%.*]] = fmul nnan ninf contract double [[X:%.*]], [[Y:%.*]]
5047// FINITEONLY-NEXT:    ret double [[MUL_I]]
5048//
5049// APPROX-LABEL: @test___dmul_rn(
5050// APPROX-NEXT:  entry:
5051// APPROX-NEXT:    [[MUL_I:%.*]] = fmul contract double [[X:%.*]], [[Y:%.*]]
5052// APPROX-NEXT:    ret double [[MUL_I]]
5053//
5054extern "C" __device__ double test___dmul_rn(double x, double y) {
5055  return __dmul_rn(x, y);
5056}
5057
5058// DEFAULT-LABEL: @test___drcp_rn(
5059// DEFAULT-NEXT:  entry:
5060// DEFAULT-NEXT:    [[DIV_I:%.*]] = fdiv contract double 1.000000e+00, [[X:%.*]]
5061// DEFAULT-NEXT:    ret double [[DIV_I]]
5062//
5063// FINITEONLY-LABEL: @test___drcp_rn(
5064// FINITEONLY-NEXT:  entry:
5065// FINITEONLY-NEXT:    [[DIV_I:%.*]] = fdiv nnan ninf contract double 1.000000e+00, [[X:%.*]]
5066// FINITEONLY-NEXT:    ret double [[DIV_I]]
5067//
5068// APPROX-LABEL: @test___drcp_rn(
5069// APPROX-NEXT:  entry:
5070// APPROX-NEXT:    [[DIV_I:%.*]] = fdiv contract double 1.000000e+00, [[X:%.*]]
5071// APPROX-NEXT:    ret double [[DIV_I]]
5072//
5073extern "C" __device__ double test___drcp_rn(double x) {
5074  return __drcp_rn(x);
5075}
5076
5077// DEFAULT-LABEL: @test___dsqrt_rn(
5078// DEFAULT-NEXT:  entry:
5079// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.sqrt.f64(double [[X:%.*]])
5080// DEFAULT-NEXT:    ret double [[TMP0]]
5081//
5082// FINITEONLY-LABEL: @test___dsqrt_rn(
5083// FINITEONLY-NEXT:  entry:
5084// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.sqrt.f64(double [[X:%.*]])
5085// FINITEONLY-NEXT:    ret double [[TMP0]]
5086//
5087// APPROX-LABEL: @test___dsqrt_rn(
5088// APPROX-NEXT:  entry:
5089// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.sqrt.f64(double [[X:%.*]])
5090// APPROX-NEXT:    ret double [[TMP0]]
5091//
5092extern "C" __device__ double test___dsqrt_rn(double x) {
5093  return __dsqrt_rn(x);
5094}
5095
5096// DEFAULT-LABEL: @test__fma_rn(
5097// DEFAULT-NEXT:  entry:
5098// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
5099// DEFAULT-NEXT:    ret double [[TMP0]]
5100//
5101// FINITEONLY-LABEL: @test__fma_rn(
5102// FINITEONLY-NEXT:  entry:
5103// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
5104// FINITEONLY-NEXT:    ret double [[TMP0]]
5105//
5106// APPROX-LABEL: @test__fma_rn(
5107// APPROX-NEXT:  entry:
5108// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.fma.f64(double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]])
5109// APPROX-NEXT:    ret double [[TMP0]]
5110//
5111extern "C" __device__ double test__fma_rn(double x, double y, double z) {
5112  return __fma_rn(x, y, z);
5113}
5114
5115// DEFAULT-LABEL: @test_float_min(
5116// DEFAULT-NEXT:  entry:
5117// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
5118// DEFAULT-NEXT:    ret float [[TMP0]]
5119//
5120// FINITEONLY-LABEL: @test_float_min(
5121// FINITEONLY-NEXT:  entry:
5122// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
5123// FINITEONLY-NEXT:    ret float [[TMP0]]
5124//
5125// APPROX-LABEL: @test_float_min(
5126// APPROX-NEXT:  entry:
5127// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
5128// APPROX-NEXT:    ret float [[TMP0]]
5129//
5130extern "C" __device__ float test_float_min(float x, float y) {
5131  return min(x, y);
5132}
5133
5134// DEFAULT-LABEL: @test_float_max(
5135// DEFAULT-NEXT:  entry:
5136// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
5137// DEFAULT-NEXT:    ret float [[TMP0]]
5138//
5139// FINITEONLY-LABEL: @test_float_max(
5140// FINITEONLY-NEXT:  entry:
5141// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
5142// FINITEONLY-NEXT:    ret float [[TMP0]]
5143//
5144// APPROX-LABEL: @test_float_max(
5145// APPROX-NEXT:  entry:
5146// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
5147// APPROX-NEXT:    ret float [[TMP0]]
5148//
5149extern "C" __device__ float test_float_max(float x, float y) {
5150  return max(x, y);
5151}
5152
5153// DEFAULT-LABEL: @test_double_min(
5154// DEFAULT-NEXT:  entry:
5155// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
5156// DEFAULT-NEXT:    ret double [[TMP0]]
5157//
5158// FINITEONLY-LABEL: @test_double_min(
5159// FINITEONLY-NEXT:  entry:
5160// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
5161// FINITEONLY-NEXT:    ret double [[TMP0]]
5162//
5163// APPROX-LABEL: @test_double_min(
5164// APPROX-NEXT:  entry:
5165// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
5166// APPROX-NEXT:    ret double [[TMP0]]
5167//
5168extern "C" __device__ double test_double_min(double x, double y) {
5169  return min(x, y);
5170}
5171
5172// DEFAULT-LABEL: @test_double_max(
5173// DEFAULT-NEXT:  entry:
5174// DEFAULT-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
5175// DEFAULT-NEXT:    ret double [[TMP0]]
5176//
5177// FINITEONLY-LABEL: @test_double_max(
5178// FINITEONLY-NEXT:  entry:
5179// FINITEONLY-NEXT:    [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
5180// FINITEONLY-NEXT:    ret double [[TMP0]]
5181//
5182// APPROX-LABEL: @test_double_max(
5183// APPROX-NEXT:  entry:
5184// APPROX-NEXT:    [[TMP0:%.*]] = tail call contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
5185// APPROX-NEXT:    ret double [[TMP0]]
5186//
5187extern "C" __device__ double test_double_max(double x, double y) {
5188  return max(x, y);
5189}
5190// CHECK-LABEL: @test_int_min(
5191// CHECK-NEXT:  entry:
5192// CHECK-NEXT:    [[COND_I:%.*]] = tail call noundef i32 @llvm.smin.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
5193// CHECK-NEXT:    ret i32 [[COND_I]]
5194//
5195extern "C" __device__ int test_int_min(int x, int y) {
5196  return min(x, y);
5197}
5198
5199// CHECK-LABEL: @test_int_max(
5200// CHECK-NEXT:  entry:
5201// CHECK-NEXT:    [[COND_I:%.*]] = tail call noundef i32 @llvm.smax.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
5202// CHECK-NEXT:    ret i32 [[COND_I]]
5203//
5204extern "C" __device__ int test_int_max(int x, int y) {
5205  return max(x, y);
5206}
5207