revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / libs / mesa / src / gallium / auxiliary / gallivm / lp_bld_arit.h
blobc78b61decf08bb9ba491b5a4b6b8da2bb0d1d003
1 /**************************************************************************
3 * Copyright 2009 VMware, Inc.
4 * All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 /**
29 * @file
30 * Helper arithmetic functions.
32 * @author Jose Fonseca <jfonseca@vmware.com>
36 #ifndef LP_BLD_ARIT_H
37 #define LP_BLD_ARIT_H
40 #include "gallivm/lp_bld.h"
43 struct lp_type;
44 struct lp_build_context;
47 /**
48 * Complement, i.e., 1 - a.
50 LLVMValueRef
51 lp_build_comp(struct lp_build_context *bld,
52 LLVMValueRef a);
54 LLVMValueRef
55 lp_build_add(struct lp_build_context *bld,
56 LLVMValueRef a,
57 LLVMValueRef b);
59 LLVMValueRef
60 lp_build_sum_vector(struct lp_build_context *bld,
61 LLVMValueRef a);
63 LLVMValueRef
64 lp_build_sub(struct lp_build_context *bld,
65 LLVMValueRef a,
66 LLVMValueRef b);
68 LLVMValueRef
69 lp_build_mul(struct lp_build_context *bld,
70 LLVMValueRef a,
71 LLVMValueRef b);
73 LLVMValueRef
74 lp_build_mul_imm(struct lp_build_context *bld,
75 LLVMValueRef a,
76 int b);
78 LLVMValueRef
79 lp_build_div(struct lp_build_context *bld,
80 LLVMValueRef a,
81 LLVMValueRef b);
83 LLVMValueRef
84 lp_build_lerp(struct lp_build_context *bld,
85 LLVMValueRef x,
86 LLVMValueRef v0,
87 LLVMValueRef v1);
89 /**
90 * Bilinear interpolation.
92 * Values indices are in v_{yx}.
94 LLVMValueRef
95 lp_build_lerp_2d(struct lp_build_context *bld,
96 LLVMValueRef x,
97 LLVMValueRef y,
98 LLVMValueRef v00,
99 LLVMValueRef v01,
100 LLVMValueRef v10,
101 LLVMValueRef v11);
103 LLVMValueRef
104 lp_build_min(struct lp_build_context *bld,
105 LLVMValueRef a,
106 LLVMValueRef b);
108 LLVMValueRef
109 lp_build_max(struct lp_build_context *bld,
110 LLVMValueRef a,
111 LLVMValueRef b);
113 LLVMValueRef
114 lp_build_clamp(struct lp_build_context *bld,
115 LLVMValueRef a,
116 LLVMValueRef min,
117 LLVMValueRef max);
119 LLVMValueRef
120 lp_build_abs(struct lp_build_context *bld,
121 LLVMValueRef a);
123 LLVMValueRef
124 lp_build_negate(struct lp_build_context *bld,
125 LLVMValueRef a);
127 LLVMValueRef
128 lp_build_sgn(struct lp_build_context *bld,
129 LLVMValueRef a);
131 LLVMValueRef
132 lp_build_set_sign(struct lp_build_context *bld,
133 LLVMValueRef a, LLVMValueRef sign);
135 LLVMValueRef
136 lp_build_int_to_float(struct lp_build_context *bld,
137 LLVMValueRef a);
139 LLVMValueRef
140 lp_build_round(struct lp_build_context *bld,
141 LLVMValueRef a);
143 LLVMValueRef
144 lp_build_floor(struct lp_build_context *bld,
145 LLVMValueRef a);
147 LLVMValueRef
148 lp_build_ceil(struct lp_build_context *bld,
149 LLVMValueRef a);
151 LLVMValueRef
152 lp_build_trunc(struct lp_build_context *bld,
153 LLVMValueRef a);
155 LLVMValueRef
156 lp_build_fract(struct lp_build_context *bld,
157 LLVMValueRef a);
159 LLVMValueRef
160 lp_build_ifloor(struct lp_build_context *bld,
161 LLVMValueRef a);
162 LLVMValueRef
163 lp_build_iceil(struct lp_build_context *bld,
164 LLVMValueRef a);
166 LLVMValueRef
167 lp_build_iround(struct lp_build_context *bld,
168 LLVMValueRef a);
170 LLVMValueRef
171 lp_build_itrunc(struct lp_build_context *bld,
172 LLVMValueRef a);
174 void
175 lp_build_ifloor_fract(struct lp_build_context *bld,
176 LLVMValueRef a,
177 LLVMValueRef *out_ipart,
178 LLVMValueRef *out_fpart);
180 LLVMValueRef
181 lp_build_sqrt(struct lp_build_context *bld,
182 LLVMValueRef a);
184 LLVMValueRef
185 lp_build_rcp(struct lp_build_context *bld,
186 LLVMValueRef a);
188 LLVMValueRef
189 lp_build_rsqrt(struct lp_build_context *bld,
190 LLVMValueRef a);
192 LLVMValueRef
193 lp_build_cos(struct lp_build_context *bld,
194 LLVMValueRef a);
196 LLVMValueRef
197 lp_build_sin(struct lp_build_context *bld,
198 LLVMValueRef a);
200 LLVMValueRef
201 lp_build_pow(struct lp_build_context *bld,
202 LLVMValueRef a,
203 LLVMValueRef b);
205 LLVMValueRef
206 lp_build_exp(struct lp_build_context *bld,
207 LLVMValueRef a);
209 LLVMValueRef
210 lp_build_log(struct lp_build_context *bld,
211 LLVMValueRef a);
213 LLVMValueRef
214 lp_build_exp2(struct lp_build_context *bld,
215 LLVMValueRef a);
217 LLVMValueRef
218 lp_build_extract_exponent(struct lp_build_context *bld,
219 LLVMValueRef x,
220 int bias);
222 LLVMValueRef
223 lp_build_extract_mantissa(struct lp_build_context *bld,
224 LLVMValueRef x);
226 LLVMValueRef
227 lp_build_log2(struct lp_build_context *bld,
228 LLVMValueRef a);
230 LLVMValueRef
231 lp_build_fast_log2(struct lp_build_context *bld,
232 LLVMValueRef a);
234 LLVMValueRef
235 lp_build_ilog2(struct lp_build_context *bld,
236 LLVMValueRef x);
238 void
239 lp_build_exp2_approx(struct lp_build_context *bld,
240 LLVMValueRef x,
241 LLVMValueRef *p_exp2_int_part,
242 LLVMValueRef *p_frac_part,
243 LLVMValueRef *p_exp2);
245 void
246 lp_build_log2_approx(struct lp_build_context *bld,
247 LLVMValueRef x,
248 LLVMValueRef *p_exp,
249 LLVMValueRef *p_floor_log2,
250 LLVMValueRef *p_log2);
252 #endif /* !LP_BLD_ARIT_H */