]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/optabs.h
tree-ssa-live.c: Include debug.h and flags.h.
[thirdparty/gcc.git] / gcc / optabs.h
CommitLineData
e78d8e51 1/* Definitions for code generation pass of GNU compiler.
6fb5fa3c 2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
20f06221 3 Free Software Foundation, Inc.
e78d8e51 4
40803cd5 5This file is part of GCC.
e78d8e51 6
40803cd5 7GCC is free software; you can redistribute it and/or modify
e78d8e51
ZW
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
40803cd5 12GCC is distributed in the hope that it will be useful,
e78d8e51
ZW
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
40803cd5 18along with GCC; see the file COPYING. If not, write to
366ccddb
KC
19the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */
e78d8e51
ZW
21
22#ifndef GCC_OPTABS_H
23#define GCC_OPTABS_H
24
25#include "insn-codes.h"
26
27/* Optabs are tables saying how to generate insn bodies
28 for various machine modes and numbers of operands.
29 Each optab applies to one operation.
98b44b0e 30
e78d8e51
ZW
31 For example, add_optab applies to addition.
32
33 The insn_code slot is the enum insn_code that says how to
34 generate an insn for this operation on a particular machine mode.
35 It is CODE_FOR_nothing if there is no such insn on the target machine.
36
37 The `lib_call' slot is the name of the library function that
38 can be used to perform the operation.
39
40 A few optabs, such as move_optab and cmp_optab, are used
41 by special code. */
42
85363ca0
ZW
43struct optab_handlers GTY(())
44{
45 enum insn_code insn_code;
46 rtx libfunc;
47};
48
e2500fed 49struct optab GTY(())
e78d8e51
ZW
50{
51 enum rtx_code code;
85363ca0 52 struct optab_handlers handlers[NUM_MACHINE_MODES];
e2500fed
GK
53};
54typedef struct optab * optab;
e78d8e51 55
85363ca0
ZW
56/* A convert_optab is for some sort of conversion operation between
57 modes. The first array index is the destination mode, the second
58 is the source mode. */
59struct convert_optab GTY(())
60{
61 enum rtx_code code;
62 struct optab_handlers handlers[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
63};
64typedef struct convert_optab *convert_optab;
65
e78d8e51
ZW
66/* Given an enum insn_code, access the function to construct
67 the body of that kind of insn. */
85363ca0 68#define GEN_FCN(CODE) (insn_data[CODE].genfun)
e78d8e51
ZW
69
70/* Enumeration of valid indexes into optab_table. */
71enum optab_index
72{
73 OTI_add,
74 OTI_addv,
75 OTI_sub,
76 OTI_subv,
77
78 /* Signed and fp multiply */
79 OTI_smul,
80 OTI_smulv,
81 /* Signed multiply, return high word */
82 OTI_smul_highpart,
83 OTI_umul_highpart,
84 /* Signed multiply with result one machine mode wider than args */
85 OTI_smul_widen,
86 OTI_umul_widen,
8b44057d
BS
87 /* Widening multiply of one unsigned and one signed operand. */
88 OTI_usmul_widen,
7f9844ca
RS
89 /* Signed multiply and add with the result and addend one machine mode
90 wider than the multiplicand and multiplier. */
91 OTI_smadd_widen,
c80b4100 92 /* Unsigned multiply and add with the result and addend one machine mode
7f9844ca
RS
93 wider than the multiplicand and multiplier. */
94 OTI_umadd_widen,
14661f36
CF
95 /* Signed multiply and subtract the result and minuend one machine mode
96 wider than the multiplicand and multiplier. */
97 OTI_smsub_widen,
c80b4100 98 /* Unsigned multiply and subtract the result and minuend one machine mode
14661f36
CF
99 wider than the multiplicand and multiplier. */
100 OTI_umsub_widen,
e78d8e51
ZW
101
102 /* Signed divide */
103 OTI_sdiv,
104 OTI_sdivv,
105 /* Signed divide-and-remainder in one */
106 OTI_sdivmod,
107 OTI_udiv,
108 OTI_udivmod,
109 /* Signed remainder */
110 OTI_smod,
111 OTI_umod,
5ae27cfa
UB
112 /* Floating point remainder functions */
113 OTI_fmod,
17b98269 114 OTI_remainder,
e78d8e51
ZW
115 /* Convert float to integer in float fmt */
116 OTI_ftrunc,
117
118 /* Logical and */
119 OTI_and,
120 /* Logical or */
121 OTI_ior,
122 /* Logical xor */
123 OTI_xor,
124
125 /* Arithmetic shift left */
126 OTI_ashl,
127 /* Logical shift right */
0c20a65f 128 OTI_lshr,
e78d8e51
ZW
129 /* Arithmetic shift right */
130 OTI_ashr,
131 /* Rotate left */
132 OTI_rotl,
133 /* Rotate right */
134 OTI_rotr,
135 /* Signed and floating-point minimum value */
136 OTI_smin,
137 /* Signed and floating-point maximum value */
138 OTI_smax,
139 /* Unsigned minimum value */
140 OTI_umin,
141 /* Unsigned maximum value */
142 OTI_umax,
b5e01d4b
RS
143 /* Power */
144 OTI_pow,
145 /* Arc tangent of y/x */
146 OTI_atan2,
e78d8e51
ZW
147
148 /* Move instruction. */
149 OTI_mov,
150 /* Move, preserving high part of register. */
151 OTI_movstrict,
1e0598e2
RH
152 /* Move, with a misaligned memory. */
153 OTI_movmisalign,
79f5e442
ZD
154 /* Nontemporal store. */
155 OTI_storent,
e78d8e51
ZW
156
157 /* Unary operations */
158 /* Negation */
159 OTI_neg,
160 OTI_negv,
161 /* Abs value */
162 OTI_abs,
163 OTI_absv,
167fa32c
EC
164 /* Byteswap */
165 OTI_bswap,
e78d8e51
ZW
166 /* Bitwise not */
167 OTI_one_cmpl,
2928cd7a 168 /* Bit scanning and counting */
e78d8e51 169 OTI_ffs,
2928cd7a
RH
170 OTI_clz,
171 OTI_ctz,
172 OTI_popcount,
173 OTI_parity,
e78d8e51
ZW
174 /* Square root */
175 OTI_sqrt,
6c7cf1f0
UB
176 /* Sine-Cosine */
177 OTI_sincos,
e78d8e51
ZW
178 /* Sine */
179 OTI_sin,
c56122d8
UB
180 /* Inverse sine */
181 OTI_asin,
e78d8e51
ZW
182 /* Cosine */
183 OTI_cos,
c56122d8
UB
184 /* Inverse cosine */
185 OTI_acos,
e7b489c8
RS
186 /* Exponential */
187 OTI_exp,
a251102e
UB
188 /* Base-10 Exponential */
189 OTI_exp10,
190 /* Base-2 Exponential */
191 OTI_exp2,
7a8e07c7
UB
192 /* Exponential - 1*/
193 OTI_expm1,
c94a75af
UB
194 /* Load exponent of a floating point number */
195 OTI_ldexp,
0c0d910d
KG
196 /* Multiply floating-point number by integral power of radix */
197 OTI_scalb,
88b28a31
UB
198 /* Radix-independent exponent */
199 OTI_logb,
200 OTI_ilogb,
e7b489c8
RS
201 /* Natural Logarithm */
202 OTI_log,
3b8e0c91
UB
203 /* Base-10 Logarithm */
204 OTI_log10,
205 /* Base-2 Logarithm */
206 OTI_log2,
c2fcfa4f
UB
207 /* logarithm of 1 plus argument */
208 OTI_log1p,
4977bab6
ZW
209 /* Rounding functions */
210 OTI_floor,
211 OTI_ceil,
edeacc14 212 OTI_btrunc,
4977bab6
ZW
213 OTI_round,
214 OTI_nearbyint,
edeacc14 215 OTI_rint,
82d397c7
RS
216 /* Tangent */
217 OTI_tan,
218 /* Inverse tangent */
219 OTI_atan,
046625fa
RH
220 /* Copy sign */
221 OTI_copysign,
d0c9d431
UB
222 /* Signbit */
223 OTI_signbit,
9ed4207f
UB
224 /* Test for infinite value */
225 OTI_isinf,
226
e78d8e51
ZW
227 /* Compare insn; two operands. */
228 OTI_cmp,
229 /* Used only for libcalls for unsigned comparisons. */
230 OTI_ucmp,
231 /* tst insn; compare one operand against 0 */
232 OTI_tst,
233
c9034561
ZW
234 /* Floating point comparison optabs - used primarily for libfuncs */
235 OTI_eq,
236 OTI_ne,
237 OTI_gt,
238 OTI_ge,
239 OTI_lt,
240 OTI_le,
241 OTI_unord,
242
e78d8e51
ZW
243 /* String length */
244 OTI_strlen,
245
246 /* Combined compare & jump/store flags/move operations. */
247 OTI_cbranch,
248 OTI_cmov,
249 OTI_cstore,
0c20a65f 250
e78d8e51
ZW
251 /* Push instruction. */
252 OTI_push,
253
068f5dea
JH
254 /* Conditional add instruction. */
255 OTI_addcc,
256
61d3cdbb
DN
257 /* Reduction operations on a vector operand. */
258 OTI_reduc_smax,
259 OTI_reduc_umax,
260 OTI_reduc_smin,
261 OTI_reduc_umin,
a6b46ba2
DN
262 OTI_reduc_splus,
263 OTI_reduc_uplus,
61d3cdbb 264
20f06221
DN
265 /* Summation, with result machine mode one or more wider than args. */
266 OTI_ssum_widen,
267 OTI_usum_widen,
268
269 /* Dot product, with result machine mode one or more wider than args. */
270 OTI_sdot_prod,
271 OTI_udot_prod,
272
997404de
JH
273 /* Set specified field of vector operand. */
274 OTI_vec_set,
275 /* Extract specified field of vector operand. */
276 OTI_vec_extract,
98b44b0e
IR
277 /* Extract even/odd fields of vector operands. */
278 OTI_vec_extract_even,
279 OTI_vec_extract_odd,
280 /* Interleave fields of vector operands. */
281 OTI_vec_interleave_high,
282 OTI_vec_interleave_low,
997404de
JH
283 /* Initialize vector operand. */
284 OTI_vec_init,
a6b46ba2
DN
285 /* Whole vector shift. The shift amount is in bits. */
286 OTI_vec_shl,
287 OTI_vec_shr,
7ccf35ed
DN
288 /* Extract specified elements from vectors, for vector load. */
289 OTI_vec_realign_load,
89d67cca
DN
290 /* Widening multiplication.
291 The high/low part of the resulting vector of products is returned. */
292 OTI_vec_widen_umult_hi,
293 OTI_vec_widen_umult_lo,
294 OTI_vec_widen_smult_hi,
295 OTI_vec_widen_smult_lo,
8115817b
UB
296 /* Extract and widen the high/low part of a vector of signed or
297 floating point elements. */
89d67cca
DN
298 OTI_vec_unpacks_hi,
299 OTI_vec_unpacks_lo,
8115817b
UB
300 /* Extract and widen the high/low part of a vector of unsigned
301 elements. */
89d67cca
DN
302 OTI_vec_unpacku_hi,
303 OTI_vec_unpacku_lo,
d9987fb4
UB
304
305 /* Extract, convert to floating point and widen the high/low part of
306 a vector of signed or unsigned integer elements. */
307 OTI_vec_unpacks_float_hi,
308 OTI_vec_unpacks_float_lo,
309 OTI_vec_unpacku_float_hi,
310 OTI_vec_unpacku_float_lo,
311
89d67cca 312 /* Narrow (demote) and merge the elements of two vectors. */
8115817b 313 OTI_vec_pack_trunc,
89d67cca
DN
314 OTI_vec_pack_usat,
315 OTI_vec_pack_ssat,
997404de 316
d9987fb4
UB
317 /* Convert to signed/unsigned integer, narrow and merge elements
318 of two vectors of floating point elements. */
319 OTI_vec_pack_sfix_trunc,
320 OTI_vec_pack_ufix_trunc,
321
17684d46
RG
322 /* Perform a raise to the power of integer. */
323 OTI_powi,
324
e78d8e51
ZW
325 OTI_MAX
326};
327
e2500fed 328extern GTY(()) optab optab_table[OTI_MAX];
e78d8e51
ZW
329
330#define add_optab (optab_table[OTI_add])
331#define sub_optab (optab_table[OTI_sub])
332#define smul_optab (optab_table[OTI_smul])
333#define addv_optab (optab_table[OTI_addv])
334#define subv_optab (optab_table[OTI_subv])
335#define smul_highpart_optab (optab_table[OTI_smul_highpart])
336#define umul_highpart_optab (optab_table[OTI_umul_highpart])
337#define smul_widen_optab (optab_table[OTI_smul_widen])
338#define umul_widen_optab (optab_table[OTI_umul_widen])
8b44057d 339#define usmul_widen_optab (optab_table[OTI_usmul_widen])
7f9844ca
RS
340#define smadd_widen_optab (optab_table[OTI_smadd_widen])
341#define umadd_widen_optab (optab_table[OTI_umadd_widen])
14661f36
CF
342#define smsub_widen_optab (optab_table[OTI_smsub_widen])
343#define umsub_widen_optab (optab_table[OTI_umsub_widen])
e78d8e51
ZW
344#define sdiv_optab (optab_table[OTI_sdiv])
345#define smulv_optab (optab_table[OTI_smulv])
346#define sdivv_optab (optab_table[OTI_sdivv])
347#define sdivmod_optab (optab_table[OTI_sdivmod])
348#define udiv_optab (optab_table[OTI_udiv])
349#define udivmod_optab (optab_table[OTI_udivmod])
350#define smod_optab (optab_table[OTI_smod])
351#define umod_optab (optab_table[OTI_umod])
5ae27cfa 352#define fmod_optab (optab_table[OTI_fmod])
17b98269 353#define remainder_optab (optab_table[OTI_remainder])
e78d8e51
ZW
354#define ftrunc_optab (optab_table[OTI_ftrunc])
355#define and_optab (optab_table[OTI_and])
356#define ior_optab (optab_table[OTI_ior])
357#define xor_optab (optab_table[OTI_xor])
358#define ashl_optab (optab_table[OTI_ashl])
359#define lshr_optab (optab_table[OTI_lshr])
360#define ashr_optab (optab_table[OTI_ashr])
361#define rotl_optab (optab_table[OTI_rotl])
362#define rotr_optab (optab_table[OTI_rotr])
363#define smin_optab (optab_table[OTI_smin])
364#define smax_optab (optab_table[OTI_smax])
365#define umin_optab (optab_table[OTI_umin])
366#define umax_optab (optab_table[OTI_umax])
b5e01d4b
RS
367#define pow_optab (optab_table[OTI_pow])
368#define atan2_optab (optab_table[OTI_atan2])
e78d8e51
ZW
369
370#define mov_optab (optab_table[OTI_mov])
371#define movstrict_optab (optab_table[OTI_movstrict])
1e0598e2 372#define movmisalign_optab (optab_table[OTI_movmisalign])
79f5e442 373#define storent_optab (optab_table[OTI_storent])
e78d8e51
ZW
374
375#define neg_optab (optab_table[OTI_neg])
376#define negv_optab (optab_table[OTI_negv])
377#define abs_optab (optab_table[OTI_abs])
378#define absv_optab (optab_table[OTI_absv])
379#define one_cmpl_optab (optab_table[OTI_one_cmpl])
167fa32c 380#define bswap_optab (optab_table[OTI_bswap])
e78d8e51 381#define ffs_optab (optab_table[OTI_ffs])
2928cd7a
RH
382#define clz_optab (optab_table[OTI_clz])
383#define ctz_optab (optab_table[OTI_ctz])
384#define popcount_optab (optab_table[OTI_popcount])
385#define parity_optab (optab_table[OTI_parity])
e78d8e51 386#define sqrt_optab (optab_table[OTI_sqrt])
6c7cf1f0 387#define sincos_optab (optab_table[OTI_sincos])
e78d8e51 388#define sin_optab (optab_table[OTI_sin])
c56122d8 389#define asin_optab (optab_table[OTI_asin])
e78d8e51 390#define cos_optab (optab_table[OTI_cos])
c56122d8 391#define acos_optab (optab_table[OTI_acos])
e7b489c8 392#define exp_optab (optab_table[OTI_exp])
a251102e
UB
393#define exp10_optab (optab_table[OTI_exp10])
394#define exp2_optab (optab_table[OTI_exp2])
7a8e07c7 395#define expm1_optab (optab_table[OTI_expm1])
c94a75af 396#define ldexp_optab (optab_table[OTI_ldexp])
0c0d910d 397#define scalb_optab (optab_table[OTI_scalb])
88b28a31
UB
398#define logb_optab (optab_table[OTI_logb])
399#define ilogb_optab (optab_table[OTI_ilogb])
e7b489c8 400#define log_optab (optab_table[OTI_log])
3b8e0c91
UB
401#define log10_optab (optab_table[OTI_log10])
402#define log2_optab (optab_table[OTI_log2])
c2fcfa4f 403#define log1p_optab (optab_table[OTI_log1p])
4977bab6
ZW
404#define floor_optab (optab_table[OTI_floor])
405#define ceil_optab (optab_table[OTI_ceil])
edeacc14 406#define btrunc_optab (optab_table[OTI_btrunc])
4977bab6
ZW
407#define round_optab (optab_table[OTI_round])
408#define nearbyint_optab (optab_table[OTI_nearbyint])
edeacc14 409#define rint_optab (optab_table[OTI_rint])
82d397c7
RS
410#define tan_optab (optab_table[OTI_tan])
411#define atan_optab (optab_table[OTI_atan])
046625fa 412#define copysign_optab (optab_table[OTI_copysign])
d0c9d431 413#define signbit_optab (optab_table[OTI_signbit])
9ed4207f
UB
414#define isinf_optab (optab_table[OTI_isinf])
415
e78d8e51
ZW
416#define cmp_optab (optab_table[OTI_cmp])
417#define ucmp_optab (optab_table[OTI_ucmp])
418#define tst_optab (optab_table[OTI_tst])
419
c9034561
ZW
420#define eq_optab (optab_table[OTI_eq])
421#define ne_optab (optab_table[OTI_ne])
422#define gt_optab (optab_table[OTI_gt])
423#define ge_optab (optab_table[OTI_ge])
424#define lt_optab (optab_table[OTI_lt])
425#define le_optab (optab_table[OTI_le])
426#define unord_optab (optab_table[OTI_unord])
427
e78d8e51
ZW
428#define strlen_optab (optab_table[OTI_strlen])
429
430#define cbranch_optab (optab_table[OTI_cbranch])
431#define cmov_optab (optab_table[OTI_cmov])
432#define cstore_optab (optab_table[OTI_cstore])
433#define push_optab (optab_table[OTI_push])
068f5dea 434#define addcc_optab (optab_table[OTI_addcc])
e78d8e51 435
61d3cdbb
DN
436#define reduc_smax_optab (optab_table[OTI_reduc_smax])
437#define reduc_umax_optab (optab_table[OTI_reduc_umax])
438#define reduc_smin_optab (optab_table[OTI_reduc_smin])
439#define reduc_umin_optab (optab_table[OTI_reduc_umin])
a6b46ba2
DN
440#define reduc_splus_optab (optab_table[OTI_reduc_splus])
441#define reduc_uplus_optab (optab_table[OTI_reduc_uplus])
8115817b 442
20f06221
DN
443#define ssum_widen_optab (optab_table[OTI_ssum_widen])
444#define usum_widen_optab (optab_table[OTI_usum_widen])
445#define sdot_prod_optab (optab_table[OTI_sdot_prod])
446#define udot_prod_optab (optab_table[OTI_udot_prod])
61d3cdbb 447
997404de
JH
448#define vec_set_optab (optab_table[OTI_vec_set])
449#define vec_extract_optab (optab_table[OTI_vec_extract])
98b44b0e
IR
450#define vec_extract_even_optab (optab_table[OTI_vec_extract_even])
451#define vec_extract_odd_optab (optab_table[OTI_vec_extract_odd])
452#define vec_interleave_high_optab (optab_table[OTI_vec_interleave_high])
453#define vec_interleave_low_optab (optab_table[OTI_vec_interleave_low])
997404de 454#define vec_init_optab (optab_table[OTI_vec_init])
a6b46ba2
DN
455#define vec_shl_optab (optab_table[OTI_vec_shl])
456#define vec_shr_optab (optab_table[OTI_vec_shr])
7ccf35ed 457#define vec_realign_load_optab (optab_table[OTI_vec_realign_load])
89d67cca
DN
458#define vec_widen_umult_hi_optab (optab_table[OTI_vec_widen_umult_hi])
459#define vec_widen_umult_lo_optab (optab_table[OTI_vec_widen_umult_lo])
460#define vec_widen_smult_hi_optab (optab_table[OTI_vec_widen_smult_hi])
461#define vec_widen_smult_lo_optab (optab_table[OTI_vec_widen_smult_lo])
462#define vec_unpacks_hi_optab (optab_table[OTI_vec_unpacks_hi])
89d67cca 463#define vec_unpacks_lo_optab (optab_table[OTI_vec_unpacks_lo])
8115817b 464#define vec_unpacku_hi_optab (optab_table[OTI_vec_unpacku_hi])
89d67cca 465#define vec_unpacku_lo_optab (optab_table[OTI_vec_unpacku_lo])
d9987fb4
UB
466#define vec_unpacks_float_hi_optab (optab_table[OTI_vec_unpacks_float_hi])
467#define vec_unpacks_float_lo_optab (optab_table[OTI_vec_unpacks_float_lo])
468#define vec_unpacku_float_hi_optab (optab_table[OTI_vec_unpacku_float_hi])
469#define vec_unpacku_float_lo_optab (optab_table[OTI_vec_unpacku_float_lo])
8115817b 470#define vec_pack_trunc_optab (optab_table[OTI_vec_pack_trunc])
89d67cca
DN
471#define vec_pack_ssat_optab (optab_table[OTI_vec_pack_ssat])
472#define vec_pack_usat_optab (optab_table[OTI_vec_pack_usat])
d9987fb4
UB
473#define vec_pack_sfix_trunc_optab (optab_table[OTI_vec_pack_sfix_trunc])
474#define vec_pack_ufix_trunc_optab (optab_table[OTI_vec_pack_ufix_trunc])
8115817b 475
17684d46
RG
476#define powi_optab (optab_table[OTI_powi])
477
85363ca0
ZW
478/* Conversion optabs have their own table and indexes. */
479enum convert_optab_index
480{
c414ac1d
EC
481 COI_sext,
482 COI_zext,
483 COI_trunc,
85363ca0 484
c414ac1d
EC
485 COI_sfix,
486 COI_ufix,
85363ca0 487
c414ac1d
EC
488 COI_sfixtrunc,
489 COI_ufixtrunc,
85363ca0 490
c414ac1d
EC
491 COI_sfloat,
492 COI_ufloat,
85363ca0 493
bb7f0423 494 COI_lrint,
4d81bf84 495 COI_lround,
c3a4177f
RG
496 COI_lfloor,
497 COI_lceil,
bb7f0423 498
c414ac1d 499 COI_MAX
85363ca0
ZW
500};
501
c414ac1d 502extern GTY(()) convert_optab convert_optab_table[COI_MAX];
e78d8e51 503
c414ac1d
EC
504#define sext_optab (convert_optab_table[COI_sext])
505#define zext_optab (convert_optab_table[COI_zext])
506#define trunc_optab (convert_optab_table[COI_trunc])
507#define sfix_optab (convert_optab_table[COI_sfix])
508#define ufix_optab (convert_optab_table[COI_ufix])
509#define sfixtrunc_optab (convert_optab_table[COI_sfixtrunc])
510#define ufixtrunc_optab (convert_optab_table[COI_ufixtrunc])
511#define sfloat_optab (convert_optab_table[COI_sfloat])
512#define ufloat_optab (convert_optab_table[COI_ufloat])
bb7f0423 513#define lrint_optab (convert_optab_table[COI_lrint])
4d81bf84 514#define lround_optab (convert_optab_table[COI_lround])
c3a4177f
RG
515#define lfloor_optab (convert_optab_table[COI_lfloor])
516#define lceil_optab (convert_optab_table[COI_lceil])
e78d8e51
ZW
517
518/* These arrays record the insn_code of insns that may be needed to
519 perform input and output reloads of special objects. They provide a
520 place to pass a scratch register. */
521extern enum insn_code reload_in_optab[NUM_MACHINE_MODES];
522extern enum insn_code reload_out_optab[NUM_MACHINE_MODES];
523
524/* Contains the optab used for each rtx code. */
17211ab5 525extern GTY(()) optab code_to_optab[NUM_RTX_CODE + 1];
e78d8e51 526
e78d8e51 527\f
0c20a65f 528typedef rtx (*rtxfun) (rtx);
e78d8e51 529
454ff5cb 530/* Indexed by the rtx-code for a conditional (e.g. EQ, LT,...)
e78d8e51
ZW
531 gives the gen_function to make a branch to test that condition. */
532
533extern rtxfun bcc_gen_fctn[NUM_RTX_CODE];
534
454ff5cb 535/* Indexed by the rtx-code for a conditional (e.g. EQ, LT,...)
e78d8e51
ZW
536 gives the insn code to make a store-condition insn
537 to test that condition. */
538
539extern enum insn_code setcc_gen_code[NUM_RTX_CODE];
540
541#ifdef HAVE_conditional_move
542/* Indexed by the machine mode, gives the insn code to make a conditional
543 move insn. */
544
545extern enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
546#endif
547
7ce67fbe
DP
548/* Indexed by the machine mode, gives the insn code for vector conditional
549 operation. */
550
551extern enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
552extern enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
553
e78d8e51 554/* This array records the insn_code of insns to perform block moves. */
70128ad9 555extern enum insn_code movmem_optab[NUM_MACHINE_MODES];
e78d8e51 556
57e84f18
AS
557/* This array records the insn_code of insns to perform block sets. */
558extern enum insn_code setmem_optab[NUM_MACHINE_MODES];
118355a0
ZW
559
560/* These arrays record the insn_code of two different kinds of insns
561 to perform block compares. */
562extern enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
40c1d5f8 563extern enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
118355a0 564extern enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
e78d8e51 565
48ae6c13
RH
566/* Synchronization primitives. This first set is atomic operation for
567 which we don't care about the resulting value. */
568extern enum insn_code sync_add_optab[NUM_MACHINE_MODES];
569extern enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
570extern enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
571extern enum insn_code sync_and_optab[NUM_MACHINE_MODES];
572extern enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
573extern enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
574
575/* This second set is atomic operations in which we return the value
576 that existed in memory before the operation. */
577extern enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
578extern enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
579extern enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
580extern enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
581extern enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
582extern enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
583
584/* This third set is atomic operations in which we return the value
585 that resulted after performing the operation. */
586extern enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
587extern enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
588extern enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
589extern enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
590extern enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
591extern enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
592
593/* Atomic compare and swap. */
594extern enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
595extern enum insn_code sync_compare_and_swap_cc[NUM_MACHINE_MODES];
596
597/* Atomic exchange with acquire semantics. */
598extern enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
599
600/* Atomic clear with release semantics. */
601extern enum insn_code sync_lock_release[NUM_MACHINE_MODES];
602
e78d8e51
ZW
603/* Define functions given in optabs.c. */
604
20f06221
DN
605extern rtx expand_widen_pattern_expr (tree exp, rtx op0, rtx op1, rtx wide_op,
606 rtx target, int unsignedp);
607
c414ac1d
EC
608extern rtx expand_ternary_op (enum machine_mode mode, optab ternary_optab,
609 rtx op0, rtx op1, rtx op2, rtx target,
7ccf35ed
DN
610 int unsignedp);
611
e78d8e51 612/* Expand a binary operation given optab and rtx operands. */
0c20a65f
AJ
613extern rtx expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
614 enum optab_methods);
e78d8e51 615
bef5d8b6
RS
616extern bool force_expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
617 enum optab_methods);
618
e78d8e51 619/* Expand a binary operation with both signed and unsigned forms. */
0c20a65f
AJ
620extern rtx sign_expand_binop (enum machine_mode, optab, optab, rtx, rtx,
621 rtx, int, enum optab_methods);
e78d8e51 622
6c7cf1f0
UB
623/* Generate code to perform an operation on one operand with two results. */
624extern int expand_twoval_unop (optab, rtx, rtx, rtx, int);
625
e78d8e51 626/* Generate code to perform an operation on two operands with two results. */
0c20a65f 627extern int expand_twoval_binop (optab, rtx, rtx, rtx, rtx, int);
e78d8e51 628
b3f8d95d
MM
629/* Generate code to perform an operation on two operands with two
630 results, using a library function. */
5906d013 631extern bool expand_twoval_binop_libfunc (optab, rtx, rtx, rtx, rtx,
b3f8d95d
MM
632 enum rtx_code);
633
e78d8e51 634/* Expand a unary arithmetic operation given optab rtx operand. */
0c20a65f 635extern rtx expand_unop (enum machine_mode, optab, rtx, rtx, int);
e78d8e51
ZW
636
637/* Expand the absolute value operation. */
0c20a65f
AJ
638extern rtx expand_abs_nojump (enum machine_mode, rtx, rtx, int);
639extern rtx expand_abs (enum machine_mode, rtx, rtx, int, int);
e78d8e51 640
046625fa
RH
641/* Expand the copysign operation. */
642extern rtx expand_copysign (rtx, rtx, rtx);
643
e78d8e51
ZW
644/* Generate an instruction with a given INSN_CODE with an output and
645 an input. */
0c20a65f 646extern void emit_unop_insn (int, rtx, rtx, enum rtx_code);
e78d8e51 647
6fb5fa3c
DB
648/* Excapsulate the block in REG_LIBCALL, and REG_RETVAL reg notes and add
649 REG_LIBCALL_ID notes to all insns in block. */
650extern void maybe_encapsulate_block (rtx, rtx, rtx);
651
e78d8e51
ZW
652/* Emit code to perform a series of operations on a multi-word quantity, one
653 word at a time. */
0c20a65f 654extern rtx emit_no_conflict_block (rtx, rtx, rtx, rtx, rtx);
e78d8e51 655
e78d8e51 656/* Emit one rtl insn to compare two rtx's. */
0c20a65f
AJ
657extern void emit_cmp_insn (rtx, rtx, enum rtx_code, rtx, enum machine_mode,
658 int);
e78d8e51
ZW
659
660/* The various uses that a comparison can have; used by can_compare_p:
661 jumps, conditional moves, store flag operations. */
662enum can_compare_purpose
663{
664 ccp_jump,
665 ccp_cmov,
666 ccp_store_flag
667};
668
26277d41
PB
669/* Return the optab used for computing the given operation on the type
670 given by the second argument. */
671extern optab optab_for_tree_code (enum tree_code, tree);
672
e78d8e51
ZW
673/* Nonzero if a compare of mode MODE can be done straightforwardly
674 (without splitting it into pieces). */
0c20a65f
AJ
675extern int can_compare_p (enum rtx_code, enum machine_mode,
676 enum can_compare_purpose);
e78d8e51 677
e78d8e51 678/* Return the INSN_CODE to use for an extend operation. */
0c20a65f 679extern enum insn_code can_extend_p (enum machine_mode, enum machine_mode, int);
e78d8e51
ZW
680
681/* Generate the body of an insn to extend Y (with mode MFROM)
682 into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */
0c20a65f
AJ
683extern rtx gen_extend_insn (rtx, rtx, enum machine_mode,
684 enum machine_mode, int);
e78d8e51 685
c15c90bb
ZW
686/* Call this to reset the function entry for one optab. */
687extern void set_optab_libfunc (optab, enum machine_mode, const char *);
85363ca0
ZW
688extern void set_conv_libfunc (convert_optab, enum machine_mode,
689 enum machine_mode, const char *);
c15c90bb 690
e78d8e51 691/* Generate code for a FLOAT_EXPR. */
0c20a65f 692extern void expand_float (rtx, rtx, int);
e78d8e51
ZW
693
694/* Generate code for a FIX_EXPR. */
0c20a65f 695extern void expand_fix (rtx, rtx, int);
e78d8e51 696
bb7f0423
RG
697/* Generate code for float to integral conversion. */
698extern bool expand_sfix_optab (rtx, rtx, convert_optab);
699
6dbd43ba 700/* Return tree if target supports vector operations for COND_EXPR. */
7ce67fbe
DP
701bool expand_vec_cond_expr_p (tree, enum machine_mode);
702
703/* Generate code for VEC_COND_EXPR. */
704extern rtx expand_vec_cond_expr (tree, rtx);
705
a6b46ba2
DN
706/* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR. */
707extern rtx expand_vec_shift_expr (tree, rtx);
708
e78d8e51 709#endif /* GCC_OPTABS_H */