GCC Middle and Back End API Reference
expmed.h
Go to the documentation of this file.
1/* Target-dependent costs for expmed.cc.
2 Copyright (C) 1987-2026 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef EXPMED_H
21#define EXPMED_H 1
22
23#include "insn-codes.h"
24
37
38/* Indicates the type of fixup needed after a constant multiplication.
39 BASIC_VARIANT means no fixup is needed, NEGATE_VARIANT means that
40 the result should be negated, and ADD_VARIANT means that the
41 multiplicand should be added to the result. */
43
44bool choose_mult_variant (machine_mode, HOST_WIDE_INT,
45 struct algorithm *, enum mult_variant *, int);
46
47/* This structure holds the "cost" of a multiply sequence. The
48 "cost" field holds the total rtx_cost of every operator in the
49 synthetic multiplication sequence, hence cost(a op b) is defined
50 as rtx_cost(op) + cost(a) + cost(b), where cost(leaf) is zero.
51 The "latency" field holds the minimum possible latency of the
52 synthetic multiply, on a hypothetical infinitely parallel CPU.
53 This is the critical path, or the maximum height, of the expression
54 tree which is the sum of rtx_costs on the most expensive path from
55 any leaf to the root. Hence latency(a op b) is defined as zero for
56 leaves and rtx_cost(op) + max(latency(a), latency(b)) otherwise. */
57
58struct mult_cost {
59 short cost; /* Total rtx_cost of the multiplication sequence. */
60 short latency; /* The latency of the multiplication sequence. */
61};
62
63/* This macro is used to compare a pointer to a mult_cost against an
64 single integer "rtx_cost" value. This is equivalent to the macro
65 CHEAPER_MULT_COST(X,Z) where Z = {Y,Y}. */
66#define MULT_COST_LESS(X,Y) ((X)->cost < (Y) \
67 || ((X)->cost == (Y) && (X)->latency < (Y)))
68
69/* This macro is used to compare two pointers to mult_costs against
70 each other. The macro returns true if X is cheaper than Y.
71 Currently, the cheaper of two mult_costs is the one with the
72 lower "cost". If "cost"s are tied, the lower latency is cheaper. */
73#define CHEAPER_MULT_COST(X,Y) ((X)->cost < (Y)->cost \
74 || ((X)->cost == (Y)->cost \
75 && (X)->latency < (Y)->latency))
76
77/* This structure records a sequence of operations.
78 `ops' is the number of operations recorded.
79 `cost' is their total cost.
80 The operations are stored in `op' and the corresponding
81 logarithms of the integer coefficients in `log'.
82
83 These are the operations:
84 alg_zero total := 0;
85 alg_m total := multiplicand;
86 alg_shift total := total * coeff
87 alg_add_t_m2 total := total + multiplicand * coeff;
88 alg_sub_t_m2 total := total - multiplicand * coeff;
89 alg_add_factor total := total * coeff + total;
90 alg_sub_factor total := total * coeff - total;
91 alg_add_t2_m total := total * coeff + multiplicand;
92 alg_sub_t2_m total := total * coeff - multiplicand;
93
94 The first operand must be either alg_zero or alg_m. */
95
97{
99 short ops;
100 /* The size of the OP and LOG fields are not directly related to the
101 word size, but the worst-case algorithms will be if we have few
102 consecutive ones or zeros, i.e., a multiplicand like 10101010101...
103 In that case we will generate shift-by-2, add, shift-by-2, add,...,
104 in total wordsize operations. One extra slot: synth_mult extends
105 a sub-algorithm of up to MAX_BITS_PER_WORD operations by one
106 before its length check discards the result. */
109};
110
111/* The entry for our multiplication cache/hash table. */
113 /* The number we are multiplying by. */
114 unsigned HOST_WIDE_INT t;
115
116 /* The mode in which we are multiplying something by T. */
117 machine_mode mode;
118
119 /* The best multiplication algorithm for t. */
121
122 /* The cost of multiplication if ALG_CODE is not alg_impossible.
123 Otherwise, the cost within which multiplication by T is
124 impossible. */
126
127 /* Optimized for speed? */
128 bool speed;
129};
130
131/* The number of cache/hash entries. */
132#if HOST_BITS_PER_WIDE_INT == 64
133#define NUM_ALG_HASH_ENTRIES 1031
134#else
135#define NUM_ALG_HASH_ENTRIES 307
136#endif
137
138#define NUM_MODE_IP_INT (NUM_MODE_INT + NUM_MODE_PARTIAL_INT)
139#define NUM_MODE_IPV_INT (NUM_MODE_IP_INT + NUM_MODE_VECTOR_INT)
140
144
148
149/* Target-dependent globals. */
151 /* Each entry of ALG_HASH caches alg_code for some integer. This is
152 actually a hash table. If we have a collision, that the older
153 entry is kicked out. */
155
156 /* True if x_alg_hash might already have been used. */
158
159 /* Nonzero means divides or modulus operations are relatively cheap for
160 powers of two, so don't use branches; emit the operation instead.
161 Usually, this will mean that the MD file will emit non-branch
162 sequences. */
165
166 /* Cost of various pieces of RTL. */
177 int x_mul_widen_cost[2][NUM_MODE_INT];
178 int x_mul_highpart_cost[2][NUM_MODE_INT];
179
180 /* Conversion costs are only defined between two scalar integer modes
181 of different sizes. The first machine mode is the destination mode,
182 and the second is the source mode. */
184};
185
187#if SWITCHABLE_TARGET
188extern struct target_expmed *this_target_expmed;
189#else
190#define this_target_expmed (&default_target_expmed)
191#endif
192
193/* Return a pointer to the alg_hash_entry at IDX. */
194
195inline struct alg_hash_entry *
197{
198 return &this_target_expmed->x_alg_hash[idx];
199}
200
201/* Return true if the x_alg_hash field might have been used. */
202
203inline bool
205{
206 return this_target_expmed->x_alg_hash_used_p;
207}
208
209/* Set whether the x_alg_hash field might have been used. */
210
211inline void
213{
214 this_target_expmed->x_alg_hash_used_p = usedp;
215}
216
217/* Compute an index into the cost arrays by mode class. */
218
219inline int
221{
222 switch (GET_MODE_CLASS (mode))
223 {
224 case MODE_INT:
225 return mode - MIN_MODE_INT;
226 case MODE_PARTIAL_INT:
227 /* If there are no partial integer modes, help the compiler
228 to figure out this will never happen. See PR59934. */
229 if (MIN_MODE_PARTIAL_INT != VOIDmode)
230 return mode - MIN_MODE_PARTIAL_INT + NUM_MODE_INT;
231 break;
232 case MODE_VECTOR_INT:
233 /* If there are no vector integer modes, help the compiler
234 to figure out this will never happen. See PR59934. */
235 if (MIN_MODE_VECTOR_INT != VOIDmode)
236 return mode - MIN_MODE_VECTOR_INT + NUM_MODE_IP_INT;
237 break;
238 default:
239 break;
240 }
242}
243
244/* Return a pointer to a boolean contained in EOC indicating whether
245 a particular operation performed in MODE is cheap when optimizing
246 for SPEED. */
247
248inline bool *
250 machine_mode mode)
251{
252 int idx = expmed_mode_index (mode);
253 return &eoc->cheap[speed][idx];
254}
255
256/* Return a pointer to a cost contained in COSTS when a particular
257 operation is performed in MODE when optimizing for SPEED. */
258
259inline int *
261 machine_mode mode)
262{
263 int idx = expmed_mode_index (mode);
264 return &costs->cost[speed][idx];
265}
266
267/* Subroutine of {set_,}sdiv_pow2_cheap. Not to be used otherwise. */
268
269inline bool *
270sdiv_pow2_cheap_ptr (bool speed, machine_mode mode)
271{
272 return expmed_op_cheap_ptr (&this_target_expmed->x_sdiv_pow2_cheap,
273 speed, mode);
274}
275
276/* Set whether a signed division by a power of 2 is cheap in MODE
277 when optimizing for SPEED. */
278
279inline void
280set_sdiv_pow2_cheap (bool speed, machine_mode mode, bool cheap_p)
281{
282 *sdiv_pow2_cheap_ptr (speed, mode) = cheap_p;
283}
284
285/* Return whether a signed division by a power of 2 is cheap in MODE
286 when optimizing for SPEED. */
287
288inline bool
289sdiv_pow2_cheap (bool speed, machine_mode mode)
290{
291 return *sdiv_pow2_cheap_ptr (speed, mode);
292}
293
294/* Subroutine of {set_,}smod_pow2_cheap. Not to be used otherwise. */
295
296inline bool *
297smod_pow2_cheap_ptr (bool speed, machine_mode mode)
298{
299 return expmed_op_cheap_ptr (&this_target_expmed->x_smod_pow2_cheap,
300 speed, mode);
301}
302
303/* Set whether a signed modulo by a power of 2 is CHEAP in MODE when
304 optimizing for SPEED. */
305
306inline void
307set_smod_pow2_cheap (bool speed, machine_mode mode, bool cheap)
308{
309 *smod_pow2_cheap_ptr (speed, mode) = cheap;
310}
311
312/* Return whether a signed modulo by a power of 2 is cheap in MODE
313 when optimizing for SPEED. */
314
315inline bool
316smod_pow2_cheap (bool speed, machine_mode mode)
317{
318 return *smod_pow2_cheap_ptr (speed, mode);
319}
320
321/* Subroutine of {set_,}zero_cost. Not to be used otherwise. */
322
323inline int *
325{
326 return &this_target_expmed->x_zero_cost[speed];
327}
328
329/* Set the COST of loading zero when optimizing for SPEED. */
330
331inline void
333{
335}
336
337/* Return the COST of loading zero when optimizing for SPEED. */
338
339inline int
341{
342 return *zero_cost_ptr (speed);
343}
344
345/* Subroutine of {set_,}add_cost. Not to be used otherwise. */
346
347inline int *
348add_cost_ptr (bool speed, machine_mode mode)
349{
350 return expmed_op_cost_ptr (&this_target_expmed->x_add_cost, speed, mode);
351}
352
353/* Set the COST of computing an add in MODE when optimizing for SPEED. */
354
355inline void
356set_add_cost (bool speed, machine_mode mode, int cost)
357{
359}
360
361/* Return the cost of computing an add in MODE when optimizing for SPEED. */
362
363inline int
364add_cost (bool speed, machine_mode mode)
365{
366 return *add_cost_ptr (speed, mode);
367}
368
369/* Subroutine of {set_,}neg_cost. Not to be used otherwise. */
370
371inline int *
372neg_cost_ptr (bool speed, machine_mode mode)
373{
374 return expmed_op_cost_ptr (&this_target_expmed->x_neg_cost, speed, mode);
375}
376
377/* Set the COST of computing a negation in MODE when optimizing for SPEED. */
378
379inline void
380set_neg_cost (bool speed, machine_mode mode, int cost)
381{
383}
384
385/* Return the cost of computing a negation in MODE when optimizing for
386 SPEED. */
387
388inline int
389neg_cost (bool speed, machine_mode mode)
390{
391 return *neg_cost_ptr (speed, mode);
392}
393
394/* Subroutine of {set_,}shift_cost. Not to be used otherwise. */
395
396inline int *
397shift_cost_ptr (bool speed, machine_mode mode, int bits)
398{
399 int midx = expmed_mode_index (mode);
400 return &this_target_expmed->x_shift_cost[speed][midx][bits];
401}
402
403/* Set the COST of doing a shift in MODE by BITS when optimizing for SPEED. */
404
405inline void
406set_shift_cost (bool speed, machine_mode mode, int bits, int cost)
407{
408 *shift_cost_ptr (speed, mode, bits) = cost;
409}
410
411/* Return the cost of doing a shift in MODE by BITS when optimizing for
412 SPEED. */
413
414inline int
415shift_cost (bool speed, machine_mode mode, int bits)
416{
417 return *shift_cost_ptr (speed, mode, bits);
418}
419
420/* Subroutine of {set_,}shiftadd_cost. Not to be used otherwise. */
421
422inline int *
423shiftadd_cost_ptr (bool speed, machine_mode mode, int bits)
424{
425 int midx = expmed_mode_index (mode);
426 return &this_target_expmed->x_shiftadd_cost[speed][midx][bits];
427}
428
429/* Set the COST of doing a shift in MODE by BITS followed by an add when
430 optimizing for SPEED. */
431
432inline void
433set_shiftadd_cost (bool speed, machine_mode mode, int bits, int cost)
434{
435 *shiftadd_cost_ptr (speed, mode, bits) = cost;
436}
437
438/* Return the cost of doing a shift in MODE by BITS followed by an add
439 when optimizing for SPEED. */
440
441inline int
442shiftadd_cost (bool speed, machine_mode mode, int bits)
443{
444 return *shiftadd_cost_ptr (speed, mode, bits);
445}
446
447/* Subroutine of {set_,}shiftsub0_cost. Not to be used otherwise. */
448
449inline int *
450shiftsub0_cost_ptr (bool speed, machine_mode mode, int bits)
451{
452 int midx = expmed_mode_index (mode);
453 return &this_target_expmed->x_shiftsub0_cost[speed][midx][bits];
454}
455
456/* Set the COST of doing a shift in MODE by BITS and then subtracting a
457 value when optimizing for SPEED. */
458
459inline void
460set_shiftsub0_cost (bool speed, machine_mode mode, int bits, int cost)
461{
462 *shiftsub0_cost_ptr (speed, mode, bits) = cost;
463}
464
465/* Return the cost of doing a shift in MODE by BITS and then subtracting
466 a value when optimizing for SPEED. */
467
468inline int
469shiftsub0_cost (bool speed, machine_mode mode, int bits)
470{
471 return *shiftsub0_cost_ptr (speed, mode, bits);
472}
473
474/* Subroutine of {set_,}shiftsub1_cost. Not to be used otherwise. */
475
476inline int *
477shiftsub1_cost_ptr (bool speed, machine_mode mode, int bits)
478{
479 int midx = expmed_mode_index (mode);
480 return &this_target_expmed->x_shiftsub1_cost[speed][midx][bits];
481}
482
483/* Set the COST of subtracting a shift in MODE by BITS from a value when
484 optimizing for SPEED. */
485
486inline void
487set_shiftsub1_cost (bool speed, machine_mode mode, int bits, int cost)
488{
489 *shiftsub1_cost_ptr (speed, mode, bits) = cost;
490}
491
492/* Return the cost of subtracting a shift in MODE by BITS from a value
493 when optimizing for SPEED. */
494
495inline int
496shiftsub1_cost (bool speed, machine_mode mode, int bits)
497{
498 return *shiftsub1_cost_ptr (speed, mode, bits);
499}
500
501/* Subroutine of {set_,}mul_cost. Not to be used otherwise. */
502
503inline int *
504mul_cost_ptr (bool speed, machine_mode mode)
505{
506 return expmed_op_cost_ptr (&this_target_expmed->x_mul_cost, speed, mode);
507}
508
509/* Set the COST of doing a multiplication in MODE when optimizing for
510 SPEED. */
511
512inline void
513set_mul_cost (bool speed, machine_mode mode, int cost)
514{
516}
517
518/* Return the cost of doing a multiplication in MODE when optimizing
519 for SPEED. */
520
521inline int
522mul_cost (bool speed, machine_mode mode)
523{
524 return *mul_cost_ptr (speed, mode);
525}
526
527/* Subroutine of {set_,}sdiv_cost. Not to be used otherwise. */
528
529inline int *
530sdiv_cost_ptr (bool speed, machine_mode mode)
531{
532 return expmed_op_cost_ptr (&this_target_expmed->x_sdiv_cost, speed, mode);
533}
534
535/* Set the COST of doing a signed division in MODE when optimizing
536 for SPEED. */
537
538inline void
539set_sdiv_cost (bool speed, machine_mode mode, int cost)
540{
542}
543
544/* Return the cost of doing a signed division in MODE when optimizing
545 for SPEED. */
546
547inline int
548sdiv_cost (bool speed, machine_mode mode)
549{
550 return *sdiv_cost_ptr (speed, mode);
551}
552
553/* Subroutine of {set_,}udiv_cost. Not to be used otherwise. */
554
555inline int *
556udiv_cost_ptr (bool speed, machine_mode mode)
557{
558 return expmed_op_cost_ptr (&this_target_expmed->x_udiv_cost, speed, mode);
559}
560
561/* Set the COST of doing an unsigned division in MODE when optimizing
562 for SPEED. */
563
564inline void
565set_udiv_cost (bool speed, machine_mode mode, int cost)
566{
568}
569
570/* Return the cost of doing an unsigned division in MODE when
571 optimizing for SPEED. */
572
573inline int
574udiv_cost (bool speed, machine_mode mode)
575{
576 return *udiv_cost_ptr (speed, mode);
577}
578
579/* Subroutine of {set_,}mul_widen_cost. Not to be used otherwise. */
580
581inline int *
582mul_widen_cost_ptr (bool speed, machine_mode mode)
583{
584 gcc_assert (GET_MODE_CLASS (mode) == MODE_INT);
585
586 return &this_target_expmed->x_mul_widen_cost[speed][mode - MIN_MODE_INT];
587}
588
589/* Set the COST for computing a widening multiplication in MODE when
590 optimizing for SPEED. */
591
592inline void
593set_mul_widen_cost (bool speed, machine_mode mode, int cost)
594{
596}
597
598/* Return the cost for computing a widening multiplication in MODE when
599 optimizing for SPEED. */
600
601inline int
602mul_widen_cost (bool speed, machine_mode mode)
603{
604 return *mul_widen_cost_ptr (speed, mode);
605}
606
607/* Subroutine of {set_,}mul_highpart_cost. Not to be used otherwise. */
608
609inline int *
610mul_highpart_cost_ptr (bool speed, machine_mode mode)
611{
612 gcc_assert (GET_MODE_CLASS (mode) == MODE_INT);
613 int m = mode - MIN_MODE_INT;
614 gcc_assert (m < NUM_MODE_INT);
615
616 return &this_target_expmed->x_mul_highpart_cost[speed][m];
617}
618
619/* Set the COST for computing the high part of a multiplication in MODE
620 when optimizing for SPEED. */
621
622inline void
623set_mul_highpart_cost (bool speed, machine_mode mode, int cost)
624{
626}
627
628/* Return the cost for computing the high part of a multiplication in MODE
629 when optimizing for SPEED. */
630
631inline int
632mul_highpart_cost (bool speed, machine_mode mode)
633{
635}
636
637/* Subroutine of {set_,}convert_cost. Not to be used otherwise. */
638
639inline int *
640convert_cost_ptr (machine_mode to_mode, machine_mode from_mode,
641 bool speed)
642{
643 int to_idx = expmed_mode_index (to_mode);
644 int from_idx = expmed_mode_index (from_mode);
645
646 gcc_assert (IN_RANGE (to_idx, 0, NUM_MODE_IP_INT - 1));
647 gcc_assert (IN_RANGE (from_idx, 0, NUM_MODE_IP_INT - 1));
648
649 return &this_target_expmed->x_convert_cost[speed][to_idx][from_idx];
650}
651
652/* Set the COST for converting from FROM_MODE to TO_MODE when optimizing
653 for SPEED. */
654
655inline void
656set_convert_cost (machine_mode to_mode, machine_mode from_mode,
657 bool speed, int cost)
658{
659 *convert_cost_ptr (to_mode, from_mode, speed) = cost;
660}
661
662/* Return the cost for converting from FROM_MODE to TO_MODE when optimizing
663 for SPEED. */
664
665inline int
666convert_cost (machine_mode to_mode, machine_mode from_mode,
667 bool speed)
668{
669 return *convert_cost_ptr (to_mode, from_mode, speed);
670}
671
672extern int mult_by_coeff_cost (HOST_WIDE_INT, machine_mode, bool);
673extern rtx emit_cstore (rtx target, enum insn_code icode, enum rtx_code code,
674 machine_mode mode, machine_mode compare_mode,
675 int unsignedp, rtx x, rtx y, int normalizep,
676 machine_mode target_mode);
677
678/* Arguments MODE, RTX: return an rtx for the negation of that value.
679 May emit insns. */
680extern rtx negate_rtx (machine_mode, rtx);
681
682/* Arguments MODE, RTX: return an rtx for the flipping of that value.
683 May emit insns. */
684extern rtx flip_storage_order (machine_mode, rtx);
685
686/* Expand a logical AND operation. */
687extern rtx expand_and (machine_mode, rtx, rtx, rtx);
688
689/* Emit a store-flag operation. */
690extern rtx emit_store_flag (rtx, enum rtx_code, rtx, rtx, machine_mode,
691 int, int);
692
693/* Like emit_store_flag, but always succeeds. */
695 machine_mode, int, int);
696
697extern void canonicalize_comparison (machine_mode, enum rtx_code *, rtx *);
698
699/* Choose a minimal N + 1 bit approximation to 2**K / D that can be used to
700 replace division by D, put the least significant N bits of the result in
701 *MULTIPLIER_PTR, the value K - N in *POST_SHIFT_PTR, and return the most
702 significant bit. */
703extern unsigned HOST_WIDE_INT choose_multiplier (unsigned HOST_WIDE_INT, int,
704 int, unsigned HOST_WIDE_INT *,
705 int *);
706
707#ifdef TREE_CODE
708extern rtx expand_variable_shift (enum tree_code, machine_mode,
709 rtx, tree, rtx, int);
710extern rtx expand_shift (enum tree_code, machine_mode, rtx, poly_int64, rtx,
711 int);
712extern rtx maybe_expand_shift (enum tree_code, machine_mode, rtx, int, rtx,
713 int);
714#ifdef GCC_OPTABS_H
715extern rtx expand_divmod (int, enum tree_code, machine_mode, rtx, rtx,
716 rtx, int, enum optab_methods = OPTAB_LIB_WIDEN);
717#endif
718#endif
719
722 machine_mode, rtx, bool, bool);
724 machine_mode, machine_mode, bool, rtx *);
725extern rtx extract_low_bits (machine_mode, machine_mode, rtx);
726extern rtx expand_mult (machine_mode, rtx, rtx, rtx, int, bool = false);
728 rtx, int);
730 int, int);
731extern rtx expand_rotate_as_vec_perm (machine_mode, rtx, rtx, rtx);
732
733/* The constant divisor of the last division expanded, reset per function
734 by prepare_function_start. */
735extern HOST_WIDE_INT last_div_const;
736
737#endif // EXPMED_H
Definition machmode.h:437
struct rtx_def * rtx
Definition coretypes.h:57
union tree_node * tree
Definition coretypes.h:97
#define MAX_BITS_PER_WORD
Definition defaults.h:1011
void store_bit_field(rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, poly_uint64 bitregion_start, poly_uint64 bitregion_end, machine_mode fieldmode, rtx value, bool reverse, bool undefined_p)
Definition expmed.cc:1181
rtx expmed_mult_highpart_optab(scalar_int_mode mode, rtx op0, rtx op1, rtx target, int unsignedp, int max_cost)
Definition expmed.cc:3961
rtx negate_rtx(machine_mode mode, rtx x)
Definition expmed.cc:346
rtx expand_divmod(int rem_flag, enum tree_code code, machine_mode mode, rtx op0, rtx op1, rtx target, int unsignedp, enum optab_methods methods)
Definition expmed.cc:4410
rtx extract_low_bits(machine_mode mode, machine_mode src_mode, rtx src)
Definition expmed.cc:2490
void canonicalize_comparison(machine_mode mode, enum rtx_code *code, rtx *imm)
Definition expmed.cc:6537
HOST_WIDE_INT last_div_const
Definition expmed.cc:63
rtx maybe_expand_shift(enum tree_code code, machine_mode mode, rtx shifted, int amount, rtx target, int unsignedp)
Definition expmed.cc:2797
unsigned HOST_WIDE_INT choose_multiplier(unsigned HOST_WIDE_INT d, int n, int precision, unsigned HOST_WIDE_INT *multiplier_ptr, int *post_shift_ptr)
Definition expmed.cc:3813
rtx emit_store_flag(rtx target, enum rtx_code code, rtx op0, rtx op1, machine_mode mode, int unsignedp, int normalizep)
Definition expmed.cc:6212
rtx emit_cstore(rtx target, enum insn_code icode, enum rtx_code code, machine_mode mode, machine_mode compare_mode, int unsignedp, rtx x, rtx y, int normalizep, machine_mode target_mode)
Definition expmed.cc:5687
rtx extract_bit_field(rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, int unsignedp, rtx target, machine_mode mode, machine_mode tmode, bool reverse, rtx *alt_rtl)
Definition expmed.cc:2191
int mult_by_coeff_cost(HOST_WIDE_INT coeff, machine_mode mode, bool speed)
Definition expmed.cc:3726
rtx expand_mult(machine_mode mode, rtx op0, rtx op1, rtx target, int unsignedp, bool no_libcall)
Definition expmed.cc:3572
struct target_expmed default_target_expmed
Definition expmed.cc:48
rtx expand_variable_shift(enum tree_code code, machine_mode mode, rtx shifted, tree amount, rtx target, int unsignedp)
Definition expmed.cc:2812
rtx emit_store_flag_force(rtx target, enum rtx_code code, rtx op0, rtx op1, machine_mode mode, int unsignedp, int normalizep)
Definition expmed.cc:6360
rtx expand_mult_highpart_adjust(scalar_int_mode mode, rtx adj_operand, rtx op0, rtx op1, rtx target, int unsignedp)
Definition expmed.cc:3921
rtx flip_storage_order(machine_mode mode, rtx x)
Definition expmed.cc:395
rtx expand_and(machine_mode mode, rtx op0, rtx op1, rtx target)
Definition expmed.cc:5669
bool choose_mult_variant(machine_mode mode, HOST_WIDE_INT val, struct algorithm *alg, enum mult_variant *variant, int mult_cost)
Definition expmed.cc:3332
rtx expand_shift(enum tree_code code, machine_mode mode, rtx shifted, poly_int64 amount, rtx target, int unsignedp)
Definition expmed.cc:2786
rtx expand_rotate_as_vec_perm(machine_mode mode, rtx dst, rtx x, rtx amt)
Definition expmed.cc:6450
int convert_cost(machine_mode to_mode, machine_mode from_mode, bool speed)
Definition expmed.h:666
void set_alg_hash_used_p(bool usedp)
Definition expmed.h:212
bool * sdiv_pow2_cheap_ptr(bool speed, machine_mode mode)
Definition expmed.h:270
int shiftsub0_cost(bool speed, machine_mode mode, int bits)
Definition expmed.h:469
#define this_target_expmed
Definition expmed.h:190
int * shiftsub1_cost_ptr(bool speed, machine_mode mode, int bits)
Definition expmed.h:477
int neg_cost(bool speed, machine_mode mode)
Definition expmed.h:389
int shift_cost(bool speed, machine_mode mode, int bits)
Definition expmed.h:415
int mul_highpart_cost(bool speed, machine_mode mode)
Definition expmed.h:632
void set_mul_widen_cost(bool speed, machine_mode mode, int cost)
Definition expmed.h:593
int * mul_highpart_cost_ptr(bool speed, machine_mode mode)
Definition expmed.h:610
void set_udiv_cost(bool speed, machine_mode mode, int cost)
Definition expmed.h:565
int mul_widen_cost(bool speed, machine_mode mode)
Definition expmed.h:602
void set_smod_pow2_cheap(bool speed, machine_mode mode, bool cheap)
Definition expmed.h:307
int udiv_cost(bool speed, machine_mode mode)
Definition expmed.h:574
int * sdiv_cost_ptr(bool speed, machine_mode mode)
Definition expmed.h:530
int * shiftsub0_cost_ptr(bool speed, machine_mode mode, int bits)
Definition expmed.h:450
int zero_cost(bool speed)
Definition expmed.h:340
void set_mul_highpart_cost(bool speed, machine_mode mode, int cost)
Definition expmed.h:623
void set_zero_cost(bool speed, int cost)
Definition expmed.h:332
int * neg_cost_ptr(bool speed, machine_mode mode)
Definition expmed.h:372
void set_convert_cost(machine_mode to_mode, machine_mode from_mode, bool speed, int cost)
Definition expmed.h:656
int sdiv_cost(bool speed, machine_mode mode)
Definition expmed.h:548
void set_sdiv_cost(bool speed, machine_mode mode, int cost)
Definition expmed.h:539
int * shiftadd_cost_ptr(bool speed, machine_mode mode, int bits)
Definition expmed.h:423
void set_sdiv_pow2_cheap(bool speed, machine_mode mode, bool cheap_p)
Definition expmed.h:280
bool sdiv_pow2_cheap(bool speed, machine_mode mode)
Definition expmed.h:289
void set_mul_cost(bool speed, machine_mode mode, int cost)
Definition expmed.h:513
void set_shiftadd_cost(bool speed, machine_mode mode, int bits, int cost)
Definition expmed.h:433
int * add_cost_ptr(bool speed, machine_mode mode)
Definition expmed.h:348
int * mul_widen_cost_ptr(bool speed, machine_mode mode)
Definition expmed.h:582
mult_variant
Definition expmed.h:42
@ add_variant
Definition expmed.h:42
@ negate_variant
Definition expmed.h:42
@ basic_variant
Definition expmed.h:42
#define NUM_ALG_HASH_ENTRIES
Definition expmed.h:135
#define NUM_MODE_IP_INT
Definition expmed.h:138
int * zero_cost_ptr(bool speed)
Definition expmed.h:324
int * mul_cost_ptr(bool speed, machine_mode mode)
Definition expmed.h:504
bool * smod_pow2_cheap_ptr(bool speed, machine_mode mode)
Definition expmed.h:297
int expmed_mode_index(machine_mode mode)
Definition expmed.h:220
int add_cost(bool speed, machine_mode mode)
Definition expmed.h:364
void set_shift_cost(bool speed, machine_mode mode, int bits, int cost)
Definition expmed.h:406
alg_code
Definition expmed.h:25
@ alg_add_t_m2
Definition expmed.h:29
@ alg_sub_factor
Definition expmed.h:32
@ alg_zero
Definition expmed.h:27
@ alg_unknown
Definition expmed.h:26
@ alg_impossible
Definition expmed.h:35
@ alg_sub_t_m2
Definition expmed.h:30
@ alg_shift
Definition expmed.h:28
@ alg_add_factor
Definition expmed.h:31
@ alg_m
Definition expmed.h:28
@ alg_sub_t2_m
Definition expmed.h:34
@ alg_add_t2_m
Definition expmed.h:33
int * convert_cost_ptr(machine_mode to_mode, machine_mode from_mode, bool speed)
Definition expmed.h:640
int shiftsub1_cost(bool speed, machine_mode mode, int bits)
Definition expmed.h:496
void set_neg_cost(bool speed, machine_mode mode, int cost)
Definition expmed.h:380
void set_add_cost(bool speed, machine_mode mode, int cost)
Definition expmed.h:356
int mul_cost(bool speed, machine_mode mode)
Definition expmed.h:522
void set_shiftsub1_cost(bool speed, machine_mode mode, int bits, int cost)
Definition expmed.h:487
void set_shiftsub0_cost(bool speed, machine_mode mode, int bits, int cost)
Definition expmed.h:460
int * shift_cost_ptr(bool speed, machine_mode mode, int bits)
Definition expmed.h:397
int shiftadd_cost(bool speed, machine_mode mode, int bits)
Definition expmed.h:442
#define NUM_MODE_IPV_INT
Definition expmed.h:139
bool smod_pow2_cheap(bool speed, machine_mode mode)
Definition expmed.h:316
int * udiv_cost_ptr(bool speed, machine_mode mode)
Definition expmed.h:556
struct alg_hash_entry * alg_hash_entry_ptr(int idx)
Definition expmed.h:196
int * expmed_op_cost_ptr(struct expmed_op_costs *costs, bool speed, machine_mode mode)
Definition expmed.h:260
bool * expmed_op_cheap_ptr(struct expmed_op_cheap *eoc, bool speed, machine_mode mode)
Definition expmed.h:249
bool alg_hash_used_p(void)
Definition expmed.h:204
tree_code
Definition genmatch.cc:1011
#define GET_MODE_CLASS(MODE)
Definition machmode.h:105
optab_methods
Definition optabs.h:177
@ OPTAB_LIB_WIDEN
Definition optabs.h:181
poly_int< NUM_POLY_INT_COEFFS, unsigned HOST_WIDE_INT > poly_uint64
Definition poly-int-types.h:25
poly_int< NUM_POLY_INT_COEFFS, HOST_WIDE_INT > poly_int64
Definition poly-int-types.h:24
rtx_code
Definition rtl.h:48
Definition expmed.h:112
unsigned HOST_WIDE_INT t
Definition expmed.h:114
machine_mode mode
Definition expmed.h:117
struct mult_cost cost
Definition expmed.h:125
enum alg_code alg
Definition expmed.h:120
bool speed
Definition expmed.h:128
Definition expmed.h:97
short ops
Definition expmed.h:99
char log[MAX_BITS_PER_WORD+1]
Definition expmed.h:108
struct mult_cost cost
Definition expmed.h:98
enum alg_code op[MAX_BITS_PER_WORD+1]
Definition expmed.h:107
Definition ira-costs.cc:54
int cost[1]
Definition ira-costs.cc:58
Definition expmed.h:141
bool cheap[2][NUM_MODE_IPV_INT]
Definition expmed.h:142
Definition expmed.h:145
int cost[2][NUM_MODE_IPV_INT]
Definition expmed.h:146
Definition expmed.h:58
short cost
Definition expmed.h:59
short latency
Definition expmed.h:60
Definition expmed.h:150
int x_shift_cost[2][NUM_MODE_IPV_INT][MAX_BITS_PER_WORD]
Definition expmed.h:170
struct alg_hash_entry x_alg_hash[NUM_ALG_HASH_ENTRIES]
Definition expmed.h:154
int x_convert_cost[2][NUM_MODE_IP_INT][NUM_MODE_IP_INT]
Definition expmed.h:183
struct expmed_op_costs x_sdiv_cost
Definition expmed.h:175
struct expmed_op_cheap x_sdiv_pow2_cheap
Definition expmed.h:163
int x_shiftadd_cost[2][NUM_MODE_IPV_INT][MAX_BITS_PER_WORD]
Definition expmed.h:171
int x_mul_highpart_cost[2][NUM_MODE_INT]
Definition expmed.h:178
int x_zero_cost[2]
Definition expmed.h:167
struct expmed_op_costs x_add_cost
Definition expmed.h:168
bool x_alg_hash_used_p
Definition expmed.h:157
int x_shiftsub1_cost[2][NUM_MODE_IPV_INT][MAX_BITS_PER_WORD]
Definition expmed.h:173
struct expmed_op_costs x_mul_cost
Definition expmed.h:174
struct expmed_op_cheap x_smod_pow2_cheap
Definition expmed.h:164
struct expmed_op_costs x_neg_cost
Definition expmed.h:169
int x_mul_widen_cost[2][NUM_MODE_INT]
Definition expmed.h:177
int x_shiftsub0_cost[2][NUM_MODE_IPV_INT][MAX_BITS_PER_WORD]
Definition expmed.h:172
struct expmed_op_costs x_udiv_cost
Definition expmed.h:176
#define gcc_assert(EXPR)
Definition system.h:819
#define gcc_unreachable()
Definition system.h:846
#define IN_RANGE(VALUE, LOWER, UPPER)
Definition system.h:338
const T2 & y
Definition wide-int.h:3870