recog.c (split_all_insns): Remove dead code.
[official-gcc.git] / gcc / optabs.h
blob8b9c9a730e01df0ce6ac3080dd7414d189494101
1 /* Definitions for code generation pass of GNU compiler.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
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 `lib_call' slot is the name of the library function that
33 can be used to perform the operation.
35 A few optabs, such as move_optab, are used by special code. */
37 struct optab_handlers
39 /* I - CODE_FOR_nothing, where I is either the insn code of the
40 associated insn generator or CODE_FOR_nothing if there is no such
41 insn on the target machine. */
42 int insn_code;
45 struct optab_d
47 enum rtx_code code;
48 char libcall_suffix;
49 const char *libcall_basename;
50 void (*libcall_gen)(struct optab_d *, const char *name, char suffix,
51 enum machine_mode);
52 struct optab_handlers handlers[NUM_MACHINE_MODES];
54 typedef struct optab_d * optab;
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. */
59 struct convert_optab_d
61 enum rtx_code code;
62 const char *libcall_basename;
63 void (*libcall_gen)(struct convert_optab_d *, const char *name,
64 enum machine_mode,
65 enum machine_mode);
66 struct optab_handlers handlers[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
68 typedef struct convert_optab_d *convert_optab;
70 /* Given an enum insn_code, access the function to construct
71 the body of that kind of insn. */
72 #define GEN_FCN(CODE) (insn_data[CODE].genfun)
74 /* Enumeration of valid indexes into optab_table. */
75 enum optab_index
77 /* Fixed-point operators with signed/unsigned saturation */
78 OTI_ssadd,
79 OTI_usadd,
80 OTI_sssub,
81 OTI_ussub,
82 OTI_ssmul,
83 OTI_usmul,
84 OTI_ssdiv,
85 OTI_usdiv,
86 OTI_ssneg,
87 OTI_usneg,
88 OTI_ssashl,
89 OTI_usashl,
91 OTI_add,
92 OTI_addv,
93 OTI_sub,
94 OTI_subv,
96 /* Signed and fp multiply */
97 OTI_smul,
98 OTI_smulv,
99 /* Signed multiply, return high word */
100 OTI_smul_highpart,
101 OTI_umul_highpart,
102 /* Signed multiply with result one machine mode wider than args */
103 OTI_smul_widen,
104 OTI_umul_widen,
105 /* Widening multiply of one unsigned and one signed operand. */
106 OTI_usmul_widen,
107 /* Signed multiply and add with the result and addend one machine mode
108 wider than the multiplicand and multiplier. */
109 OTI_smadd_widen,
110 /* Unsigned multiply and add with the result and addend one machine mode
111 wider than the multiplicand and multiplier. */
112 OTI_umadd_widen,
113 /* Signed multiply and add with the result and addend one machine mode
114 wider than the multiplicand and multiplier.
115 All involved operations are saturating. */
116 OTI_ssmadd_widen,
117 /* Unsigned multiply and add with the result and addend one machine mode
118 wider than the multiplicand and multiplier.
119 All involved operations are saturating. */
120 OTI_usmadd_widen,
121 /* Signed multiply and subtract the result and minuend one machine mode
122 wider than the multiplicand and multiplier. */
123 OTI_smsub_widen,
124 /* Unsigned multiply and subtract the result and minuend one machine mode
125 wider than the multiplicand and multiplier. */
126 OTI_umsub_widen,
127 /* Signed multiply and subtract the result and minuend one machine mode
128 wider than the multiplicand and multiplier.
129 All involved operations are saturating. */
130 OTI_ssmsub_widen,
131 /* Unsigned multiply and subtract the result and minuend one machine mode
132 wider than the multiplicand and multiplier.
133 All involved operations are saturating. */
134 OTI_usmsub_widen,
136 /* Signed divide */
137 OTI_sdiv,
138 OTI_sdivv,
139 /* Signed divide-and-remainder in one */
140 OTI_sdivmod,
141 OTI_udiv,
142 OTI_udivmod,
143 /* Signed remainder */
144 OTI_smod,
145 OTI_umod,
146 /* Floating point remainder functions */
147 OTI_fmod,
148 OTI_remainder,
149 /* Convert float to integer in float fmt */
150 OTI_ftrunc,
152 /* Logical and */
153 OTI_and,
154 /* Logical or */
155 OTI_ior,
156 /* Logical xor */
157 OTI_xor,
159 /* Arithmetic shift left */
160 OTI_ashl,
161 /* Logical shift right */
162 OTI_lshr,
163 /* Arithmetic shift right */
164 OTI_ashr,
165 /* Rotate left */
166 OTI_rotl,
167 /* Rotate right */
168 OTI_rotr,
170 /* Arithmetic shift left of vector by vector */
171 OTI_vashl,
172 /* Logical shift right of vector by vector */
173 OTI_vlshr,
174 /* Arithmetic shift right of vector by vector */
175 OTI_vashr,
176 /* Rotate left of vector by vector */
177 OTI_vrotl,
178 /* Rotate right of vector by vector */
179 OTI_vrotr,
181 /* Signed and floating-point minimum value */
182 OTI_smin,
183 /* Signed and floating-point maximum value */
184 OTI_smax,
185 /* Unsigned minimum value */
186 OTI_umin,
187 /* Unsigned maximum value */
188 OTI_umax,
189 /* Power */
190 OTI_pow,
191 /* Arc tangent of y/x */
192 OTI_atan2,
193 /* Floating multiply/add */
194 OTI_fma,
196 /* Move instruction. */
197 OTI_mov,
198 /* Move, preserving high part of register. */
199 OTI_movstrict,
200 /* Move, with a misaligned memory. */
201 OTI_movmisalign,
202 /* Nontemporal store. */
203 OTI_storent,
205 /* Unary operations */
206 /* Negation */
207 OTI_neg,
208 OTI_negv,
209 /* Abs value */
210 OTI_abs,
211 OTI_absv,
212 /* Byteswap */
213 OTI_bswap,
214 /* Bitwise not */
215 OTI_one_cmpl,
216 /* Bit scanning and counting */
217 OTI_ffs,
218 OTI_clz,
219 OTI_ctz,
220 OTI_popcount,
221 OTI_parity,
222 /* Square root */
223 OTI_sqrt,
224 /* Sine-Cosine */
225 OTI_sincos,
226 /* Sine */
227 OTI_sin,
228 /* Inverse sine */
229 OTI_asin,
230 /* Cosine */
231 OTI_cos,
232 /* Inverse cosine */
233 OTI_acos,
234 /* Exponential */
235 OTI_exp,
236 /* Base-10 Exponential */
237 OTI_exp10,
238 /* Base-2 Exponential */
239 OTI_exp2,
240 /* Exponential - 1*/
241 OTI_expm1,
242 /* Load exponent of a floating point number */
243 OTI_ldexp,
244 /* Multiply floating-point number by integral power of radix */
245 OTI_scalb,
246 /* Mantissa of a floating-point number */
247 OTI_significand,
248 /* Radix-independent exponent */
249 OTI_logb,
250 OTI_ilogb,
251 /* Natural Logarithm */
252 OTI_log,
253 /* Base-10 Logarithm */
254 OTI_log10,
255 /* Base-2 Logarithm */
256 OTI_log2,
257 /* logarithm of 1 plus argument */
258 OTI_log1p,
259 /* Rounding functions */
260 OTI_floor,
261 OTI_ceil,
262 OTI_btrunc,
263 OTI_round,
264 OTI_nearbyint,
265 OTI_rint,
266 /* Tangent */
267 OTI_tan,
268 /* Inverse tangent */
269 OTI_atan,
270 /* Copy sign */
271 OTI_copysign,
272 /* Signbit */
273 OTI_signbit,
274 /* Test for infinite value */
275 OTI_isinf,
277 /* Compare insn; two operands. Used only for libcalls. */
278 OTI_cmp,
279 OTI_ucmp,
281 /* Floating point comparison optabs - used primarily for libfuncs */
282 OTI_eq,
283 OTI_ne,
284 OTI_gt,
285 OTI_ge,
286 OTI_lt,
287 OTI_le,
288 OTI_unord,
290 /* String length */
291 OTI_strlen,
293 /* Combined compare & jump/move/store flags/trap operations. */
294 OTI_cbranch,
295 OTI_cmov,
296 OTI_cstore,
297 OTI_ctrap,
299 /* Push instruction. */
300 OTI_push,
302 /* Conditional add instruction. */
303 OTI_addcc,
305 /* Reduction operations on a vector operand. */
306 OTI_reduc_smax,
307 OTI_reduc_umax,
308 OTI_reduc_smin,
309 OTI_reduc_umin,
310 OTI_reduc_splus,
311 OTI_reduc_uplus,
313 /* Summation, with result machine mode one or more wider than args. */
314 OTI_ssum_widen,
315 OTI_usum_widen,
317 /* Dot product, with result machine mode one or more wider than args. */
318 OTI_sdot_prod,
319 OTI_udot_prod,
321 /* Set specified field of vector operand. */
322 OTI_vec_set,
323 /* Extract specified field of vector operand. */
324 OTI_vec_extract,
325 /* Extract even/odd fields of vector operands. */
326 OTI_vec_extract_even,
327 OTI_vec_extract_odd,
328 /* Interleave fields of vector operands. */
329 OTI_vec_interleave_high,
330 OTI_vec_interleave_low,
331 /* Initialize vector operand. */
332 OTI_vec_init,
333 /* Whole vector shift. The shift amount is in bits. */
334 OTI_vec_shl,
335 OTI_vec_shr,
336 /* Extract specified elements from vectors, for vector load. */
337 OTI_vec_realign_load,
338 /* Widening multiplication.
339 The high/low part of the resulting vector of products is returned. */
340 OTI_vec_widen_umult_hi,
341 OTI_vec_widen_umult_lo,
342 OTI_vec_widen_smult_hi,
343 OTI_vec_widen_smult_lo,
344 /* Extract and widen the high/low part of a vector of signed or
345 floating point elements. */
346 OTI_vec_unpacks_hi,
347 OTI_vec_unpacks_lo,
348 /* Extract and widen the high/low part of a vector of unsigned
349 elements. */
350 OTI_vec_unpacku_hi,
351 OTI_vec_unpacku_lo,
353 /* Extract, convert to floating point and widen the high/low part of
354 a vector of signed or unsigned integer elements. */
355 OTI_vec_unpacks_float_hi,
356 OTI_vec_unpacks_float_lo,
357 OTI_vec_unpacku_float_hi,
358 OTI_vec_unpacku_float_lo,
360 /* Narrow (demote) and merge the elements of two vectors. */
361 OTI_vec_pack_trunc,
362 OTI_vec_pack_usat,
363 OTI_vec_pack_ssat,
365 /* Convert to signed/unsigned integer, narrow and merge elements
366 of two vectors of floating point elements. */
367 OTI_vec_pack_sfix_trunc,
368 OTI_vec_pack_ufix_trunc,
370 /* Perform a raise to the power of integer. */
371 OTI_powi,
373 OTI_MAX
376 #define ssadd_optab (&optab_table[OTI_ssadd])
377 #define usadd_optab (&optab_table[OTI_usadd])
378 #define sssub_optab (&optab_table[OTI_sssub])
379 #define ussub_optab (&optab_table[OTI_ussub])
380 #define ssmul_optab (&optab_table[OTI_ssmul])
381 #define usmul_optab (&optab_table[OTI_usmul])
382 #define ssdiv_optab (&optab_table[OTI_ssdiv])
383 #define usdiv_optab (&optab_table[OTI_usdiv])
384 #define ssneg_optab (&optab_table[OTI_ssneg])
385 #define usneg_optab (&optab_table[OTI_usneg])
386 #define ssashl_optab (&optab_table[OTI_ssashl])
387 #define usashl_optab (&optab_table[OTI_usashl])
389 #define add_optab (&optab_table[OTI_add])
390 #define sub_optab (&optab_table[OTI_sub])
391 #define smul_optab (&optab_table[OTI_smul])
392 #define addv_optab (&optab_table[OTI_addv])
393 #define subv_optab (&optab_table[OTI_subv])
394 #define smul_highpart_optab (&optab_table[OTI_smul_highpart])
395 #define umul_highpart_optab (&optab_table[OTI_umul_highpart])
396 #define smul_widen_optab (&optab_table[OTI_smul_widen])
397 #define umul_widen_optab (&optab_table[OTI_umul_widen])
398 #define usmul_widen_optab (&optab_table[OTI_usmul_widen])
399 #define smadd_widen_optab (&optab_table[OTI_smadd_widen])
400 #define umadd_widen_optab (&optab_table[OTI_umadd_widen])
401 #define ssmadd_widen_optab (&optab_table[OTI_ssmadd_widen])
402 #define usmadd_widen_optab (&optab_table[OTI_usmadd_widen])
403 #define smsub_widen_optab (&optab_table[OTI_smsub_widen])
404 #define umsub_widen_optab (&optab_table[OTI_umsub_widen])
405 #define ssmsub_widen_optab (&optab_table[OTI_ssmsub_widen])
406 #define usmsub_widen_optab (&optab_table[OTI_usmsub_widen])
407 #define sdiv_optab (&optab_table[OTI_sdiv])
408 #define smulv_optab (&optab_table[OTI_smulv])
409 #define sdivv_optab (&optab_table[OTI_sdivv])
410 #define sdivmod_optab (&optab_table[OTI_sdivmod])
411 #define udiv_optab (&optab_table[OTI_udiv])
412 #define udivmod_optab (&optab_table[OTI_udivmod])
413 #define smod_optab (&optab_table[OTI_smod])
414 #define umod_optab (&optab_table[OTI_umod])
415 #define fmod_optab (&optab_table[OTI_fmod])
416 #define remainder_optab (&optab_table[OTI_remainder])
417 #define ftrunc_optab (&optab_table[OTI_ftrunc])
418 #define and_optab (&optab_table[OTI_and])
419 #define ior_optab (&optab_table[OTI_ior])
420 #define xor_optab (&optab_table[OTI_xor])
421 #define ashl_optab (&optab_table[OTI_ashl])
422 #define lshr_optab (&optab_table[OTI_lshr])
423 #define ashr_optab (&optab_table[OTI_ashr])
424 #define rotl_optab (&optab_table[OTI_rotl])
425 #define rotr_optab (&optab_table[OTI_rotr])
426 #define vashl_optab (&optab_table[OTI_vashl])
427 #define vlshr_optab (&optab_table[OTI_vlshr])
428 #define vashr_optab (&optab_table[OTI_vashr])
429 #define vrotl_optab (&optab_table[OTI_vrotl])
430 #define vrotr_optab (&optab_table[OTI_vrotr])
431 #define smin_optab (&optab_table[OTI_smin])
432 #define smax_optab (&optab_table[OTI_smax])
433 #define umin_optab (&optab_table[OTI_umin])
434 #define umax_optab (&optab_table[OTI_umax])
435 #define pow_optab (&optab_table[OTI_pow])
436 #define atan2_optab (&optab_table[OTI_atan2])
437 #define fma_optab (&optab_table[OTI_fma])
439 #define mov_optab (&optab_table[OTI_mov])
440 #define movstrict_optab (&optab_table[OTI_movstrict])
441 #define movmisalign_optab (&optab_table[OTI_movmisalign])
442 #define storent_optab (&optab_table[OTI_storent])
444 #define neg_optab (&optab_table[OTI_neg])
445 #define negv_optab (&optab_table[OTI_negv])
446 #define abs_optab (&optab_table[OTI_abs])
447 #define absv_optab (&optab_table[OTI_absv])
448 #define one_cmpl_optab (&optab_table[OTI_one_cmpl])
449 #define bswap_optab (&optab_table[OTI_bswap])
450 #define ffs_optab (&optab_table[OTI_ffs])
451 #define clz_optab (&optab_table[OTI_clz])
452 #define ctz_optab (&optab_table[OTI_ctz])
453 #define popcount_optab (&optab_table[OTI_popcount])
454 #define parity_optab (&optab_table[OTI_parity])
455 #define sqrt_optab (&optab_table[OTI_sqrt])
456 #define sincos_optab (&optab_table[OTI_sincos])
457 #define sin_optab (&optab_table[OTI_sin])
458 #define asin_optab (&optab_table[OTI_asin])
459 #define cos_optab (&optab_table[OTI_cos])
460 #define acos_optab (&optab_table[OTI_acos])
461 #define exp_optab (&optab_table[OTI_exp])
462 #define exp10_optab (&optab_table[OTI_exp10])
463 #define exp2_optab (&optab_table[OTI_exp2])
464 #define expm1_optab (&optab_table[OTI_expm1])
465 #define ldexp_optab (&optab_table[OTI_ldexp])
466 #define scalb_optab (&optab_table[OTI_scalb])
467 #define significand_optab (&optab_table[OTI_significand])
468 #define logb_optab (&optab_table[OTI_logb])
469 #define ilogb_optab (&optab_table[OTI_ilogb])
470 #define log_optab (&optab_table[OTI_log])
471 #define log10_optab (&optab_table[OTI_log10])
472 #define log2_optab (&optab_table[OTI_log2])
473 #define log1p_optab (&optab_table[OTI_log1p])
474 #define floor_optab (&optab_table[OTI_floor])
475 #define ceil_optab (&optab_table[OTI_ceil])
476 #define btrunc_optab (&optab_table[OTI_btrunc])
477 #define round_optab (&optab_table[OTI_round])
478 #define nearbyint_optab (&optab_table[OTI_nearbyint])
479 #define rint_optab (&optab_table[OTI_rint])
480 #define tan_optab (&optab_table[OTI_tan])
481 #define atan_optab (&optab_table[OTI_atan])
482 #define copysign_optab (&optab_table[OTI_copysign])
483 #define signbit_optab (&optab_table[OTI_signbit])
484 #define isinf_optab (&optab_table[OTI_isinf])
486 #define cmp_optab (&optab_table[OTI_cmp])
487 #define ucmp_optab (&optab_table[OTI_ucmp])
489 #define eq_optab (&optab_table[OTI_eq])
490 #define ne_optab (&optab_table[OTI_ne])
491 #define gt_optab (&optab_table[OTI_gt])
492 #define ge_optab (&optab_table[OTI_ge])
493 #define lt_optab (&optab_table[OTI_lt])
494 #define le_optab (&optab_table[OTI_le])
495 #define unord_optab (&optab_table[OTI_unord])
497 #define strlen_optab (&optab_table[OTI_strlen])
499 #define cbranch_optab (&optab_table[OTI_cbranch])
500 #define cmov_optab (&optab_table[OTI_cmov])
501 #define cstore_optab (&optab_table[OTI_cstore])
502 #define ctrap_optab (&optab_table[OTI_ctrap])
504 #define push_optab (&optab_table[OTI_push])
505 #define addcc_optab (&optab_table[OTI_addcc])
507 #define reduc_smax_optab (&optab_table[OTI_reduc_smax])
508 #define reduc_umax_optab (&optab_table[OTI_reduc_umax])
509 #define reduc_smin_optab (&optab_table[OTI_reduc_smin])
510 #define reduc_umin_optab (&optab_table[OTI_reduc_umin])
511 #define reduc_splus_optab (&optab_table[OTI_reduc_splus])
512 #define reduc_uplus_optab (&optab_table[OTI_reduc_uplus])
514 #define ssum_widen_optab (&optab_table[OTI_ssum_widen])
515 #define usum_widen_optab (&optab_table[OTI_usum_widen])
516 #define sdot_prod_optab (&optab_table[OTI_sdot_prod])
517 #define udot_prod_optab (&optab_table[OTI_udot_prod])
519 #define vec_set_optab (&optab_table[OTI_vec_set])
520 #define vec_extract_optab (&optab_table[OTI_vec_extract])
521 #define vec_extract_even_optab (&optab_table[OTI_vec_extract_even])
522 #define vec_extract_odd_optab (&optab_table[OTI_vec_extract_odd])
523 #define vec_interleave_high_optab (&optab_table[OTI_vec_interleave_high])
524 #define vec_interleave_low_optab (&optab_table[OTI_vec_interleave_low])
525 #define vec_init_optab (&optab_table[OTI_vec_init])
526 #define vec_shl_optab (&optab_table[OTI_vec_shl])
527 #define vec_shr_optab (&optab_table[OTI_vec_shr])
528 #define vec_realign_load_optab (&optab_table[OTI_vec_realign_load])
529 #define vec_widen_umult_hi_optab (&optab_table[OTI_vec_widen_umult_hi])
530 #define vec_widen_umult_lo_optab (&optab_table[OTI_vec_widen_umult_lo])
531 #define vec_widen_smult_hi_optab (&optab_table[OTI_vec_widen_smult_hi])
532 #define vec_widen_smult_lo_optab (&optab_table[OTI_vec_widen_smult_lo])
533 #define vec_unpacks_hi_optab (&optab_table[OTI_vec_unpacks_hi])
534 #define vec_unpacks_lo_optab (&optab_table[OTI_vec_unpacks_lo])
535 #define vec_unpacku_hi_optab (&optab_table[OTI_vec_unpacku_hi])
536 #define vec_unpacku_lo_optab (&optab_table[OTI_vec_unpacku_lo])
537 #define vec_unpacks_float_hi_optab (&optab_table[OTI_vec_unpacks_float_hi])
538 #define vec_unpacks_float_lo_optab (&optab_table[OTI_vec_unpacks_float_lo])
539 #define vec_unpacku_float_hi_optab (&optab_table[OTI_vec_unpacku_float_hi])
540 #define vec_unpacku_float_lo_optab (&optab_table[OTI_vec_unpacku_float_lo])
541 #define vec_pack_trunc_optab (&optab_table[OTI_vec_pack_trunc])
542 #define vec_pack_ssat_optab (&optab_table[OTI_vec_pack_ssat])
543 #define vec_pack_usat_optab (&optab_table[OTI_vec_pack_usat])
544 #define vec_pack_sfix_trunc_optab (&optab_table[OTI_vec_pack_sfix_trunc])
545 #define vec_pack_ufix_trunc_optab (&optab_table[OTI_vec_pack_ufix_trunc])
547 #define powi_optab (&optab_table[OTI_powi])
549 /* Conversion optabs have their own table and indexes. */
550 enum convert_optab_index
552 COI_sext,
553 COI_zext,
554 COI_trunc,
556 COI_sfix,
557 COI_ufix,
559 COI_sfixtrunc,
560 COI_ufixtrunc,
562 COI_sfloat,
563 COI_ufloat,
565 COI_lrint,
566 COI_lround,
567 COI_lfloor,
568 COI_lceil,
570 COI_fract,
571 COI_fractuns,
572 COI_satfract,
573 COI_satfractuns,
575 COI_MAX
578 #define sext_optab (&convert_optab_table[COI_sext])
579 #define zext_optab (&convert_optab_table[COI_zext])
580 #define trunc_optab (&convert_optab_table[COI_trunc])
581 #define sfix_optab (&convert_optab_table[COI_sfix])
582 #define ufix_optab (&convert_optab_table[COI_ufix])
583 #define sfixtrunc_optab (&convert_optab_table[COI_sfixtrunc])
584 #define ufixtrunc_optab (&convert_optab_table[COI_ufixtrunc])
585 #define sfloat_optab (&convert_optab_table[COI_sfloat])
586 #define ufloat_optab (&convert_optab_table[COI_ufloat])
587 #define lrint_optab (&convert_optab_table[COI_lrint])
588 #define lround_optab (&convert_optab_table[COI_lround])
589 #define lfloor_optab (&convert_optab_table[COI_lfloor])
590 #define lceil_optab (&convert_optab_table[COI_lceil])
591 #define fract_optab (&convert_optab_table[COI_fract])
592 #define fractuns_optab (&convert_optab_table[COI_fractuns])
593 #define satfract_optab (&convert_optab_table[COI_satfract])
594 #define satfractuns_optab (&convert_optab_table[COI_satfractuns])
596 /* Contains the optab used for each rtx code. */
597 extern optab code_to_optab[NUM_RTX_CODE + 1];
600 typedef rtx (*rtxfun) (rtx);
602 /* Enumerates operations that have a named .md pattern associated
603 with them, but which are not implemented as library functions. */
604 enum direct_optab_index
606 #ifdef HAVE_conditional_move
607 /* Conditional move operations. */
608 DOI_movcc,
609 #endif
611 /* Operations that use a scratch register to perform input and output
612 reloads of special objects. */
613 DOI_reload_in,
614 DOI_reload_out,
616 /* Vector conditional operations. */
617 DOI_vcond,
618 DOI_vcondu,
620 /* Block move operation. */
621 DOI_movmem,
623 /* Block set operation. */
624 DOI_setmem,
626 /* Various types of block compare operation. */
627 DOI_cmpstr,
628 DOI_cmpstrn,
629 DOI_cmpmem,
631 /* Synchronization primitives. This first set is atomic operation for
632 which we don't care about the resulting value. */
633 DOI_sync_add,
634 DOI_sync_sub,
635 DOI_sync_ior,
636 DOI_sync_and,
637 DOI_sync_xor,
638 DOI_sync_nand,
640 /* This second set is atomic operations in which we return the value
641 that existed in memory before the operation. */
642 DOI_sync_old_add,
643 DOI_sync_old_sub,
644 DOI_sync_old_ior,
645 DOI_sync_old_and,
646 DOI_sync_old_xor,
647 DOI_sync_old_nand,
649 /* This third set is atomic operations in which we return the value
650 that resulted after performing the operation. */
651 DOI_sync_new_add,
652 DOI_sync_new_sub,
653 DOI_sync_new_ior,
654 DOI_sync_new_and,
655 DOI_sync_new_xor,
656 DOI_sync_new_nand,
658 /* Atomic compare and swap. */
659 DOI_sync_compare_and_swap,
661 /* Atomic exchange with acquire semantics. */
662 DOI_sync_lock_test_and_set,
664 /* Atomic clear with release semantics. */
665 DOI_sync_lock_release,
667 DOI_MAX
670 /* A structure that says which insn should be used to perform an operation
671 in a particular mode. */
672 struct direct_optab_d
674 struct optab_handlers handlers[NUM_MACHINE_MODES];
676 typedef struct direct_optab_d *direct_optab;
678 #ifdef HAVE_conditional_move
679 #define movcc_optab (&direct_optab_table[(int) DOI_movcc])
680 #endif
681 #define reload_in_optab (&direct_optab_table[(int) DOI_reload_in])
682 #define reload_out_optab (&direct_optab_table[(int) DOI_reload_out])
683 #define vcond_optab (&direct_optab_table[(int) DOI_vcond])
684 #define vcondu_optab (&direct_optab_table[(int) DOI_vcondu])
685 #define movmem_optab (&direct_optab_table[(int) DOI_movmem])
686 #define setmem_optab (&direct_optab_table[(int) DOI_setmem])
687 #define cmpstr_optab (&direct_optab_table[(int) DOI_cmpstr])
688 #define cmpstrn_optab (&direct_optab_table[(int) DOI_cmpstrn])
689 #define cmpmem_optab (&direct_optab_table[(int) DOI_cmpmem])
690 #define sync_add_optab (&direct_optab_table[(int) DOI_sync_add])
691 #define sync_sub_optab (&direct_optab_table[(int) DOI_sync_sub])
692 #define sync_ior_optab (&direct_optab_table[(int) DOI_sync_ior])
693 #define sync_and_optab (&direct_optab_table[(int) DOI_sync_and])
694 #define sync_xor_optab (&direct_optab_table[(int) DOI_sync_xor])
695 #define sync_nand_optab (&direct_optab_table[(int) DOI_sync_nand])
696 #define sync_old_add_optab (&direct_optab_table[(int) DOI_sync_old_add])
697 #define sync_old_sub_optab (&direct_optab_table[(int) DOI_sync_old_sub])
698 #define sync_old_ior_optab (&direct_optab_table[(int) DOI_sync_old_ior])
699 #define sync_old_and_optab (&direct_optab_table[(int) DOI_sync_old_and])
700 #define sync_old_xor_optab (&direct_optab_table[(int) DOI_sync_old_xor])
701 #define sync_old_nand_optab (&direct_optab_table[(int) DOI_sync_old_nand])
702 #define sync_new_add_optab (&direct_optab_table[(int) DOI_sync_new_add])
703 #define sync_new_sub_optab (&direct_optab_table[(int) DOI_sync_new_sub])
704 #define sync_new_ior_optab (&direct_optab_table[(int) DOI_sync_new_ior])
705 #define sync_new_and_optab (&direct_optab_table[(int) DOI_sync_new_and])
706 #define sync_new_xor_optab (&direct_optab_table[(int) DOI_sync_new_xor])
707 #define sync_new_nand_optab (&direct_optab_table[(int) DOI_sync_new_nand])
708 #define sync_compare_and_swap_optab \
709 (&direct_optab_table[(int) DOI_sync_compare_and_swap])
710 #define sync_lock_test_and_set_optab \
711 (&direct_optab_table[(int) DOI_sync_lock_test_and_set])
712 #define sync_lock_release_optab \
713 (&direct_optab_table[(int) DOI_sync_lock_release])
715 /* Target-dependent globals. */
716 struct target_optabs {
717 /* Tables of patterns that may have an associated libcall. */
718 struct optab_d x_optab_table[(int) OTI_MAX];
720 /* Tables of patterns for converting one mode to another. */
721 struct convert_optab_d x_convert_optab_table[(int) COI_MAX];
723 /* Tables of patterns for direct optabs (i.e. those which cannot be
724 implemented using a libcall). */
725 struct direct_optab_d x_direct_optab_table[(int) DOI_MAX];
728 extern struct target_optabs default_target_optabs;
729 #if SWITCHABLE_TARGET
730 extern struct target_optabs *this_target_optabs;
731 #else
732 #define this_target_optabs (&default_target_optabs)
733 #endif
735 #define optab_table \
736 (this_target_optabs->x_optab_table)
737 #define convert_optab_table \
738 (this_target_optabs->x_convert_optab_table)
739 #define direct_optab_table \
740 (this_target_optabs->x_direct_optab_table)
742 /* Define functions given in optabs.c. */
744 extern rtx expand_widen_pattern_expr (sepops ops, rtx op0, rtx op1, rtx wide_op,
745 rtx target, int unsignedp);
747 extern rtx expand_ternary_op (enum machine_mode mode, optab ternary_optab,
748 rtx op0, rtx op1, rtx op2, rtx target,
749 int unsignedp);
751 /* Expand a binary operation given optab and rtx operands. */
752 extern rtx expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
753 enum optab_methods);
755 extern bool force_expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
756 enum optab_methods);
758 /* Expand a binary operation with both signed and unsigned forms. */
759 extern rtx sign_expand_binop (enum machine_mode, optab, optab, rtx, rtx,
760 rtx, int, enum optab_methods);
762 /* Generate code to perform an operation on one operand with two results. */
763 extern int expand_twoval_unop (optab, rtx, rtx, rtx, int);
765 /* Generate code to perform an operation on two operands with two results. */
766 extern int expand_twoval_binop (optab, rtx, rtx, rtx, rtx, int);
768 /* Generate code to perform an operation on two operands with two
769 results, using a library function. */
770 extern bool expand_twoval_binop_libfunc (optab, rtx, rtx, rtx, rtx,
771 enum rtx_code);
773 /* Expand a unary arithmetic operation given optab rtx operand. */
774 extern rtx expand_unop (enum machine_mode, optab, rtx, rtx, int);
776 /* Expand the absolute value operation. */
777 extern rtx expand_abs_nojump (enum machine_mode, rtx, rtx, int);
778 extern rtx expand_abs (enum machine_mode, rtx, rtx, int, int);
780 /* Expand the one's complement absolute value operation. */
781 extern rtx expand_one_cmpl_abs_nojump (enum machine_mode, rtx, rtx);
783 /* Expand the copysign operation. */
784 extern rtx expand_copysign (rtx, rtx, rtx);
786 /* Generate an instruction with a given INSN_CODE with an output and
787 an input. */
788 extern void emit_unop_insn (int, rtx, rtx, enum rtx_code);
789 extern bool maybe_emit_unop_insn (int, rtx, rtx, enum rtx_code);
791 /* An extra flag to control optab_for_tree_code's behavior. This is needed to
792 distinguish between machines with a vector shift that takes a scalar for the
793 shift amount vs. machines that take a vector for the shift amount. */
794 enum optab_subtype
796 optab_default,
797 optab_scalar,
798 optab_vector
801 /* Return the optab used for computing the given operation on the type given by
802 the second argument. The third argument distinguishes between the types of
803 vector shifts and rotates */
804 extern optab optab_for_tree_code (enum tree_code, const_tree, enum optab_subtype);
806 /* The various uses that a comparison can have; used by can_compare_p:
807 jumps, conditional moves, store flag operations. */
808 enum can_compare_purpose
810 ccp_jump,
811 ccp_cmov,
812 ccp_store_flag
815 /* Nonzero if a compare of mode MODE can be done straightforwardly
816 (without splitting it into pieces). */
817 extern int can_compare_p (enum rtx_code, enum machine_mode,
818 enum can_compare_purpose);
820 /* Return the INSN_CODE to use for an extend operation. */
821 extern enum insn_code can_extend_p (enum machine_mode, enum machine_mode, int);
823 /* Generate the body of an insn to extend Y (with mode MFROM)
824 into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */
825 extern rtx gen_extend_insn (rtx, rtx, enum machine_mode,
826 enum machine_mode, int);
828 /* Call this to reset the function entry for one optab. */
829 extern void set_optab_libfunc (optab, enum machine_mode, const char *);
830 extern void set_conv_libfunc (convert_optab, enum machine_mode,
831 enum machine_mode, const char *);
833 /* Generate code for a FIXED_CONVERT_EXPR. */
834 extern void expand_fixed_convert (rtx, rtx, int, int);
836 /* Generate code for a FLOAT_EXPR. */
837 extern void expand_float (rtx, rtx, int);
839 /* Generate code for a FIX_EXPR. */
840 extern void expand_fix (rtx, rtx, int);
842 /* Generate code for float to integral conversion. */
843 extern bool expand_sfix_optab (rtx, rtx, convert_optab);
845 /* Generate code for a widening multiply. */
846 extern rtx expand_widening_mult (enum machine_mode, rtx, rtx, rtx, int, optab);
848 /* Return tree if target supports vector operations for COND_EXPR. */
849 bool expand_vec_cond_expr_p (tree, enum machine_mode);
851 /* Generate code for VEC_COND_EXPR. */
852 extern rtx expand_vec_cond_expr (tree, tree, tree, tree, rtx);
853 /* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR. */
854 extern rtx expand_vec_shift_expr (sepops, rtx);
856 /* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing
857 if the target does not have such an insn. */
859 static inline enum insn_code
860 optab_handler (optab op, enum machine_mode mode)
862 return (enum insn_code) (op->handlers[(int) mode].insn_code
863 + (int) CODE_FOR_nothing);
866 /* Record that insn CODE should be used to implement mode MODE of OP. */
868 static inline void
869 set_optab_handler (optab op, enum machine_mode mode, enum insn_code code)
871 op->handlers[(int) mode].insn_code = (int) code - (int) CODE_FOR_nothing;
874 /* Return the insn used to perform conversion OP from mode FROM_MODE
875 to mode TO_MODE; return CODE_FOR_nothing if the target does not have
876 such an insn. */
878 static inline enum insn_code
879 convert_optab_handler (convert_optab op, enum machine_mode to_mode,
880 enum machine_mode from_mode)
882 return ((enum insn_code)
883 (op->handlers[(int) to_mode][(int) from_mode].insn_code
884 + (int) CODE_FOR_nothing));
887 /* Record that insn CODE should be used to perform conversion OP
888 from mode FROM_MODE to mode TO_MODE. */
890 static inline void
891 set_convert_optab_handler (convert_optab op, enum machine_mode to_mode,
892 enum machine_mode from_mode, enum insn_code code)
894 op->handlers[(int) to_mode][(int) from_mode].insn_code
895 = (int) code - (int) CODE_FOR_nothing;
898 /* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing
899 if the target does not have such an insn. */
901 static inline enum insn_code
902 direct_optab_handler (direct_optab op, enum machine_mode mode)
904 return (enum insn_code) (op->handlers[(int) mode].insn_code
905 + (int) CODE_FOR_nothing);
908 /* Record that insn CODE should be used to implement mode MODE of OP. */
910 static inline void
911 set_direct_optab_handler (direct_optab op, enum machine_mode mode,
912 enum insn_code code)
914 op->handlers[(int) mode].insn_code = (int) code - (int) CODE_FOR_nothing;
917 extern rtx optab_libfunc (optab optab, enum machine_mode mode);
918 extern rtx convert_optab_libfunc (convert_optab optab, enum machine_mode mode1,
919 enum machine_mode mode2);
920 #endif /* GCC_OPTABS_H */