1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2009 VMware, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci/**
29bf215546Sopenharmony_ci * @file
30bf215546Sopenharmony_ci * Helper arithmetic functions.
31bf215546Sopenharmony_ci *
32bf215546Sopenharmony_ci * @author Jose Fonseca <jfonseca@vmware.com>
33bf215546Sopenharmony_ci */
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_ci#ifndef LP_BLD_ARIT_H
37bf215546Sopenharmony_ci#define LP_BLD_ARIT_H
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ci#include "gallivm/lp_bld.h"
41bf215546Sopenharmony_ci#include "pipe/p_compiler.h"
42bf215546Sopenharmony_ci
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_cistruct lp_type;
45bf215546Sopenharmony_cistruct lp_build_context;
46bf215546Sopenharmony_cistruct gallivm_state;
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_ci/**
50bf215546Sopenharmony_ci * Complement, i.e., 1 - a.
51bf215546Sopenharmony_ci */
52bf215546Sopenharmony_ciLLVMValueRef
53bf215546Sopenharmony_cilp_build_comp(struct lp_build_context *bld,
54bf215546Sopenharmony_ci              LLVMValueRef a);
55bf215546Sopenharmony_ci
56bf215546Sopenharmony_ciLLVMValueRef
57bf215546Sopenharmony_cilp_build_add(struct lp_build_context *bld,
58bf215546Sopenharmony_ci             LLVMValueRef a,
59bf215546Sopenharmony_ci             LLVMValueRef b);
60bf215546Sopenharmony_ci
61bf215546Sopenharmony_ciLLVMValueRef
62bf215546Sopenharmony_cilp_build_horizontal_add(struct lp_build_context *bld,
63bf215546Sopenharmony_ci                        LLVMValueRef a);
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ciLLVMValueRef
66bf215546Sopenharmony_cilp_build_hadd_partial4(struct lp_build_context *bld,
67bf215546Sopenharmony_ci                       LLVMValueRef vectors[],
68bf215546Sopenharmony_ci                       unsigned num_vecs);
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ciLLVMValueRef
71bf215546Sopenharmony_cilp_build_sub(struct lp_build_context *bld,
72bf215546Sopenharmony_ci             LLVMValueRef a,
73bf215546Sopenharmony_ci             LLVMValueRef b);
74bf215546Sopenharmony_ci
75bf215546Sopenharmony_ci
76bf215546Sopenharmony_ciLLVMValueRef
77bf215546Sopenharmony_cilp_build_mul_norm(struct gallivm_state *gallivm,
78bf215546Sopenharmony_ci                  struct lp_type wide_type,
79bf215546Sopenharmony_ci                  LLVMValueRef a,
80bf215546Sopenharmony_ci                  LLVMValueRef b);
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_ciLLVMValueRef
83bf215546Sopenharmony_cilp_build_mul(struct lp_build_context *bld,
84bf215546Sopenharmony_ci             LLVMValueRef a,
85bf215546Sopenharmony_ci             LLVMValueRef b);
86bf215546Sopenharmony_ci
87bf215546Sopenharmony_ciLLVMValueRef
88bf215546Sopenharmony_cilp_build_mul_32_lohi_cpu(struct lp_build_context *bld,
89bf215546Sopenharmony_ci                         LLVMValueRef a,
90bf215546Sopenharmony_ci                         LLVMValueRef b,
91bf215546Sopenharmony_ci                         LLVMValueRef *res_hi);
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_ciLLVMValueRef
94bf215546Sopenharmony_cilp_build_mul_32_lohi(struct lp_build_context *bld,
95bf215546Sopenharmony_ci                     LLVMValueRef a,
96bf215546Sopenharmony_ci                     LLVMValueRef b,
97bf215546Sopenharmony_ci                     LLVMValueRef *res_hi);
98bf215546Sopenharmony_ci
99bf215546Sopenharmony_ciLLVMValueRef
100bf215546Sopenharmony_cilp_build_mul_imm(struct lp_build_context *bld,
101bf215546Sopenharmony_ci                 LLVMValueRef a,
102bf215546Sopenharmony_ci                 int b);
103bf215546Sopenharmony_ci
104bf215546Sopenharmony_ciLLVMValueRef
105bf215546Sopenharmony_cilp_build_div(struct lp_build_context *bld,
106bf215546Sopenharmony_ci             LLVMValueRef a,
107bf215546Sopenharmony_ci             LLVMValueRef b);
108bf215546Sopenharmony_ci
109bf215546Sopenharmony_ci
110bf215546Sopenharmony_ci/* llvm.fmuladd.* intrinsic */
111bf215546Sopenharmony_ciLLVMValueRef
112bf215546Sopenharmony_cilp_build_fmuladd(LLVMBuilderRef builder,
113bf215546Sopenharmony_ci                 LLVMValueRef a,
114bf215546Sopenharmony_ci                 LLVMValueRef b,
115bf215546Sopenharmony_ci                 LLVMValueRef c);
116bf215546Sopenharmony_ci
117bf215546Sopenharmony_ci/* a * b + c */
118bf215546Sopenharmony_ciLLVMValueRef
119bf215546Sopenharmony_cilp_build_mad(struct lp_build_context *bld,
120bf215546Sopenharmony_ci             LLVMValueRef a,
121bf215546Sopenharmony_ci             LLVMValueRef b,
122bf215546Sopenharmony_ci             LLVMValueRef c);
123bf215546Sopenharmony_ci
124bf215546Sopenharmony_ci
125bf215546Sopenharmony_ci/**
126bf215546Sopenharmony_ci * Set when the weights for normalized are prescaled, that is, in range
127bf215546Sopenharmony_ci * 0..2**n, as opposed to range 0..2**(n-1).
128bf215546Sopenharmony_ci */
129bf215546Sopenharmony_ci#define LP_BLD_LERP_PRESCALED_WEIGHTS (1 << 0)
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_ci/**
132bf215546Sopenharmony_ci * Used internally when using wide intermediates for normalized lerps.
133bf215546Sopenharmony_ci *
134bf215546Sopenharmony_ci * Do not use.
135bf215546Sopenharmony_ci */
136bf215546Sopenharmony_ci#define LP_BLD_LERP_WIDE_NORMALIZED (1 << 1)
137bf215546Sopenharmony_ci
138bf215546Sopenharmony_ciLLVMValueRef
139bf215546Sopenharmony_cilp_build_lerp(struct lp_build_context *bld,
140bf215546Sopenharmony_ci              LLVMValueRef x,
141bf215546Sopenharmony_ci              LLVMValueRef v0,
142bf215546Sopenharmony_ci              LLVMValueRef v1,
143bf215546Sopenharmony_ci              unsigned flags);
144bf215546Sopenharmony_ci
145bf215546Sopenharmony_ciLLVMValueRef
146bf215546Sopenharmony_cilp_build_lerp_2d(struct lp_build_context *bld,
147bf215546Sopenharmony_ci                 LLVMValueRef x,
148bf215546Sopenharmony_ci                 LLVMValueRef y,
149bf215546Sopenharmony_ci                 LLVMValueRef v00,
150bf215546Sopenharmony_ci                 LLVMValueRef v01,
151bf215546Sopenharmony_ci                 LLVMValueRef v10,
152bf215546Sopenharmony_ci                 LLVMValueRef v11,
153bf215546Sopenharmony_ci                 unsigned flags);
154bf215546Sopenharmony_ci
155bf215546Sopenharmony_ciLLVMValueRef
156bf215546Sopenharmony_cilp_build_lerp_3d(struct lp_build_context *bld,
157bf215546Sopenharmony_ci                 LLVMValueRef x,
158bf215546Sopenharmony_ci                 LLVMValueRef y,
159bf215546Sopenharmony_ci                 LLVMValueRef z,
160bf215546Sopenharmony_ci                 LLVMValueRef v000,
161bf215546Sopenharmony_ci                 LLVMValueRef v001,
162bf215546Sopenharmony_ci                 LLVMValueRef v010,
163bf215546Sopenharmony_ci                 LLVMValueRef v011,
164bf215546Sopenharmony_ci                 LLVMValueRef v100,
165bf215546Sopenharmony_ci                 LLVMValueRef v101,
166bf215546Sopenharmony_ci                 LLVMValueRef v110,
167bf215546Sopenharmony_ci                 LLVMValueRef v111,
168bf215546Sopenharmony_ci                 unsigned flags);
169bf215546Sopenharmony_ci
170bf215546Sopenharmony_ci/**
171bf215546Sopenharmony_ci * Specifies floating point NaN behavior.
172bf215546Sopenharmony_ci */
173bf215546Sopenharmony_cienum gallivm_nan_behavior {
174bf215546Sopenharmony_ci   /* Results are undefined with NaN. Results in fastest code */
175bf215546Sopenharmony_ci   GALLIVM_NAN_BEHAVIOR_UNDEFINED,
176bf215546Sopenharmony_ci   /* If one of the inputs is NaN, the other operand is returned */
177bf215546Sopenharmony_ci   GALLIVM_NAN_RETURN_OTHER,
178bf215546Sopenharmony_ci   /* If one of the inputs is NaN, the other operand is returned,
179bf215546Sopenharmony_ci    * but we guarantee the second operand is not a NaN.
180bf215546Sopenharmony_ci    * In min/max it will be as fast as undefined with sse opcodes,
181bf215546Sopenharmony_ci    * and archs having native return_other can benefit too. */
182bf215546Sopenharmony_ci   GALLIVM_NAN_RETURN_OTHER_SECOND_NONNAN,
183bf215546Sopenharmony_ci   /* If one of the inputs is NaN, NaN is returned,
184bf215546Sopenharmony_ci    * but we guarantee the first operand is not a NaN.
185bf215546Sopenharmony_ci    * In min/max it will be as fast as undefined with sse opcodes,
186bf215546Sopenharmony_ci    * and archs having native return_nan can benefit too. */
187bf215546Sopenharmony_ci   GALLIVM_NAN_RETURN_NAN_FIRST_NONNAN,
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_ci};
190bf215546Sopenharmony_ci
191bf215546Sopenharmony_ciLLVMValueRef
192bf215546Sopenharmony_cilp_build_min(struct lp_build_context *bld,
193bf215546Sopenharmony_ci             LLVMValueRef a,
194bf215546Sopenharmony_ci             LLVMValueRef b);
195bf215546Sopenharmony_ci
196bf215546Sopenharmony_ciLLVMValueRef
197bf215546Sopenharmony_cilp_build_min_ext(struct lp_build_context *bld,
198bf215546Sopenharmony_ci                 LLVMValueRef a,
199bf215546Sopenharmony_ci                 LLVMValueRef b,
200bf215546Sopenharmony_ci                 enum gallivm_nan_behavior nan_behavior);
201bf215546Sopenharmony_ci
202bf215546Sopenharmony_ciLLVMValueRef
203bf215546Sopenharmony_cilp_build_max(struct lp_build_context *bld,
204bf215546Sopenharmony_ci             LLVMValueRef a,
205bf215546Sopenharmony_ci             LLVMValueRef b);
206bf215546Sopenharmony_ci
207bf215546Sopenharmony_ciLLVMValueRef
208bf215546Sopenharmony_cilp_build_max_ext(struct lp_build_context *bld,
209bf215546Sopenharmony_ci                 LLVMValueRef a,
210bf215546Sopenharmony_ci                 LLVMValueRef b,
211bf215546Sopenharmony_ci                 enum gallivm_nan_behavior nan_behavior);
212bf215546Sopenharmony_ci
213bf215546Sopenharmony_ciLLVMValueRef
214bf215546Sopenharmony_cilp_build_clamp(struct lp_build_context *bld,
215bf215546Sopenharmony_ci               LLVMValueRef a,
216bf215546Sopenharmony_ci               LLVMValueRef min,
217bf215546Sopenharmony_ci               LLVMValueRef max);
218bf215546Sopenharmony_ci
219bf215546Sopenharmony_ciLLVMValueRef
220bf215546Sopenharmony_cilp_build_clamp_zero_one_nanzero(struct lp_build_context *bld,
221bf215546Sopenharmony_ci                                LLVMValueRef a);
222bf215546Sopenharmony_ci
223bf215546Sopenharmony_ciLLVMValueRef
224bf215546Sopenharmony_cilp_build_abs(struct lp_build_context *bld,
225bf215546Sopenharmony_ci             LLVMValueRef a);
226bf215546Sopenharmony_ci
227bf215546Sopenharmony_ciLLVMValueRef
228bf215546Sopenharmony_cilp_build_negate(struct lp_build_context *bld,
229bf215546Sopenharmony_ci                LLVMValueRef a);
230bf215546Sopenharmony_ci
231bf215546Sopenharmony_ciLLVMValueRef
232bf215546Sopenharmony_cilp_build_sgn(struct lp_build_context *bld,
233bf215546Sopenharmony_ci             LLVMValueRef a);
234bf215546Sopenharmony_ci
235bf215546Sopenharmony_ciLLVMValueRef
236bf215546Sopenharmony_cilp_build_set_sign(struct lp_build_context *bld,
237bf215546Sopenharmony_ci                  LLVMValueRef a, LLVMValueRef sign);
238bf215546Sopenharmony_ci
239bf215546Sopenharmony_ciLLVMValueRef
240bf215546Sopenharmony_cilp_build_int_to_float(struct lp_build_context *bld,
241bf215546Sopenharmony_ci                      LLVMValueRef a);
242bf215546Sopenharmony_ci
243bf215546Sopenharmony_ciLLVMValueRef
244bf215546Sopenharmony_cilp_build_round(struct lp_build_context *bld,
245bf215546Sopenharmony_ci               LLVMValueRef a);
246bf215546Sopenharmony_ci
247bf215546Sopenharmony_ciLLVMValueRef
248bf215546Sopenharmony_cilp_build_floor(struct lp_build_context *bld,
249bf215546Sopenharmony_ci               LLVMValueRef a);
250bf215546Sopenharmony_ci
251bf215546Sopenharmony_ciLLVMValueRef
252bf215546Sopenharmony_cilp_build_ceil(struct lp_build_context *bld,
253bf215546Sopenharmony_ci              LLVMValueRef a);
254bf215546Sopenharmony_ci
255bf215546Sopenharmony_ciLLVMValueRef
256bf215546Sopenharmony_cilp_build_trunc(struct lp_build_context *bld,
257bf215546Sopenharmony_ci               LLVMValueRef a);
258bf215546Sopenharmony_ci
259bf215546Sopenharmony_ciLLVMValueRef
260bf215546Sopenharmony_cilp_build_fract(struct lp_build_context *bld,
261bf215546Sopenharmony_ci               LLVMValueRef a);
262bf215546Sopenharmony_ci
263bf215546Sopenharmony_ciLLVMValueRef
264bf215546Sopenharmony_cilp_build_fract_safe(struct lp_build_context *bld,
265bf215546Sopenharmony_ci                    LLVMValueRef a);
266bf215546Sopenharmony_ci
267bf215546Sopenharmony_ciLLVMValueRef
268bf215546Sopenharmony_cilp_build_ifloor(struct lp_build_context *bld,
269bf215546Sopenharmony_ci                LLVMValueRef a);
270bf215546Sopenharmony_ciLLVMValueRef
271bf215546Sopenharmony_cilp_build_iceil(struct lp_build_context *bld,
272bf215546Sopenharmony_ci               LLVMValueRef a);
273bf215546Sopenharmony_ci
274bf215546Sopenharmony_ciLLVMValueRef
275bf215546Sopenharmony_cilp_build_iround(struct lp_build_context *bld,
276bf215546Sopenharmony_ci                LLVMValueRef a);
277bf215546Sopenharmony_ci
278bf215546Sopenharmony_ciLLVMValueRef
279bf215546Sopenharmony_cilp_build_itrunc(struct lp_build_context *bld,
280bf215546Sopenharmony_ci                LLVMValueRef a);
281bf215546Sopenharmony_ci
282bf215546Sopenharmony_civoid
283bf215546Sopenharmony_cilp_build_ifloor_fract(struct lp_build_context *bld,
284bf215546Sopenharmony_ci                      LLVMValueRef a,
285bf215546Sopenharmony_ci                      LLVMValueRef *out_ipart,
286bf215546Sopenharmony_ci                      LLVMValueRef *out_fpart);
287bf215546Sopenharmony_ci
288bf215546Sopenharmony_civoid
289bf215546Sopenharmony_cilp_build_ifloor_fract_safe(struct lp_build_context *bld,
290bf215546Sopenharmony_ci                           LLVMValueRef a,
291bf215546Sopenharmony_ci                           LLVMValueRef *out_ipart,
292bf215546Sopenharmony_ci                           LLVMValueRef *out_fpart);
293bf215546Sopenharmony_ci
294bf215546Sopenharmony_ciLLVMValueRef
295bf215546Sopenharmony_cilp_build_sqrt(struct lp_build_context *bld,
296bf215546Sopenharmony_ci              LLVMValueRef a);
297bf215546Sopenharmony_ci
298bf215546Sopenharmony_ciLLVMValueRef
299bf215546Sopenharmony_cilp_build_rcp(struct lp_build_context *bld,
300bf215546Sopenharmony_ci             LLVMValueRef a);
301bf215546Sopenharmony_ci
302bf215546Sopenharmony_ciLLVMValueRef
303bf215546Sopenharmony_cilp_build_rsqrt(struct lp_build_context *bld,
304bf215546Sopenharmony_ci               LLVMValueRef a);
305bf215546Sopenharmony_ci
306bf215546Sopenharmony_ciboolean
307bf215546Sopenharmony_cilp_build_fast_rsqrt_available(struct lp_type type);
308bf215546Sopenharmony_ci
309bf215546Sopenharmony_ciLLVMValueRef
310bf215546Sopenharmony_cilp_build_fast_rsqrt(struct lp_build_context *bld,
311bf215546Sopenharmony_ci                    LLVMValueRef a);
312bf215546Sopenharmony_ci
313bf215546Sopenharmony_ciLLVMValueRef
314bf215546Sopenharmony_cilp_build_polynomial(struct lp_build_context *bld,
315bf215546Sopenharmony_ci                    LLVMValueRef x,
316bf215546Sopenharmony_ci                    const double *coeffs,
317bf215546Sopenharmony_ci                    unsigned num_coeffs);
318bf215546Sopenharmony_ci
319bf215546Sopenharmony_ciLLVMValueRef
320bf215546Sopenharmony_cilp_build_cos(struct lp_build_context *bld,
321bf215546Sopenharmony_ci             LLVMValueRef a);
322bf215546Sopenharmony_ci
323bf215546Sopenharmony_ciLLVMValueRef
324bf215546Sopenharmony_cilp_build_sin(struct lp_build_context *bld,
325bf215546Sopenharmony_ci             LLVMValueRef a);
326bf215546Sopenharmony_ci
327bf215546Sopenharmony_ciLLVMValueRef
328bf215546Sopenharmony_cilp_build_pow(struct lp_build_context *bld,
329bf215546Sopenharmony_ci             LLVMValueRef a,
330bf215546Sopenharmony_ci             LLVMValueRef b);
331bf215546Sopenharmony_ci
332bf215546Sopenharmony_ciLLVMValueRef
333bf215546Sopenharmony_cilp_build_exp(struct lp_build_context *bld,
334bf215546Sopenharmony_ci             LLVMValueRef a);
335bf215546Sopenharmony_ci
336bf215546Sopenharmony_ciLLVMValueRef
337bf215546Sopenharmony_cilp_build_log(struct lp_build_context *bld,
338bf215546Sopenharmony_ci             LLVMValueRef a);
339bf215546Sopenharmony_ci
340bf215546Sopenharmony_ciLLVMValueRef
341bf215546Sopenharmony_cilp_build_log_safe(struct lp_build_context *bld,
342bf215546Sopenharmony_ci                  LLVMValueRef a);
343bf215546Sopenharmony_ci
344bf215546Sopenharmony_ciLLVMValueRef
345bf215546Sopenharmony_cilp_build_exp2(struct lp_build_context *bld,
346bf215546Sopenharmony_ci              LLVMValueRef a);
347bf215546Sopenharmony_ci
348bf215546Sopenharmony_ciLLVMValueRef
349bf215546Sopenharmony_cilp_build_extract_exponent(struct lp_build_context *bld,
350bf215546Sopenharmony_ci                          LLVMValueRef x,
351bf215546Sopenharmony_ci                          int bias);
352bf215546Sopenharmony_ci
353bf215546Sopenharmony_ciLLVMValueRef
354bf215546Sopenharmony_cilp_build_extract_mantissa(struct lp_build_context *bld,
355bf215546Sopenharmony_ci                          LLVMValueRef x);
356bf215546Sopenharmony_ci
357bf215546Sopenharmony_ciLLVMValueRef
358bf215546Sopenharmony_cilp_build_log2(struct lp_build_context *bld,
359bf215546Sopenharmony_ci              LLVMValueRef a);
360bf215546Sopenharmony_ci
361bf215546Sopenharmony_ciLLVMValueRef
362bf215546Sopenharmony_cilp_build_log2_safe(struct lp_build_context *bld,
363bf215546Sopenharmony_ci                   LLVMValueRef a);
364bf215546Sopenharmony_ci
365bf215546Sopenharmony_ciLLVMValueRef
366bf215546Sopenharmony_cilp_build_fast_log2(struct lp_build_context *bld,
367bf215546Sopenharmony_ci                   LLVMValueRef a);
368bf215546Sopenharmony_ci
369bf215546Sopenharmony_ciLLVMValueRef
370bf215546Sopenharmony_cilp_build_ilog2(struct lp_build_context *bld,
371bf215546Sopenharmony_ci               LLVMValueRef x);
372bf215546Sopenharmony_ci
373bf215546Sopenharmony_civoid
374bf215546Sopenharmony_cilp_build_log2_approx(struct lp_build_context *bld,
375bf215546Sopenharmony_ci                     LLVMValueRef x,
376bf215546Sopenharmony_ci                     LLVMValueRef *p_exp,
377bf215546Sopenharmony_ci                     LLVMValueRef *p_floor_log2,
378bf215546Sopenharmony_ci                     LLVMValueRef *p_log2,
379bf215546Sopenharmony_ci                     boolean handle_nans);
380bf215546Sopenharmony_ci
381bf215546Sopenharmony_ciLLVMValueRef
382bf215546Sopenharmony_cilp_build_mod(struct lp_build_context *bld,
383bf215546Sopenharmony_ci             LLVMValueRef x,
384bf215546Sopenharmony_ci             LLVMValueRef y);
385bf215546Sopenharmony_ci
386bf215546Sopenharmony_ciLLVMValueRef
387bf215546Sopenharmony_cilp_build_isnan(struct lp_build_context *bld,
388bf215546Sopenharmony_ci               LLVMValueRef x);
389bf215546Sopenharmony_ci
390bf215546Sopenharmony_ciLLVMValueRef
391bf215546Sopenharmony_cilp_build_isfinite(struct lp_build_context *bld,
392bf215546Sopenharmony_ci                  LLVMValueRef x);
393bf215546Sopenharmony_ci
394bf215546Sopenharmony_ci
395bf215546Sopenharmony_ciLLVMValueRef
396bf215546Sopenharmony_cilp_build_is_inf_or_nan(struct gallivm_state *gallivm,
397bf215546Sopenharmony_ci                       const struct lp_type type,
398bf215546Sopenharmony_ci                       LLVMValueRef x);
399bf215546Sopenharmony_ci
400bf215546Sopenharmony_ci
401bf215546Sopenharmony_ciLLVMValueRef
402bf215546Sopenharmony_cilp_build_fpstate_get(struct gallivm_state *gallivm);
403bf215546Sopenharmony_ci
404bf215546Sopenharmony_civoid
405bf215546Sopenharmony_cilp_build_fpstate_set_denorms_zero(struct gallivm_state *gallivm,
406bf215546Sopenharmony_ci                                  boolean zero);
407bf215546Sopenharmony_civoid
408bf215546Sopenharmony_cilp_build_fpstate_set(struct gallivm_state *gallivm,
409bf215546Sopenharmony_ci                     LLVMValueRef mxcsr);
410bf215546Sopenharmony_ci
411bf215546Sopenharmony_ci#endif /* !LP_BLD_ARIT_H */
412