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