GCC Middle and Back End API Reference
|
#include "insn-codes.h"
Go to the source code of this file.
Data Structures | |
struct | mult_cost |
struct | algorithm |
struct | alg_hash_entry |
struct | expmed_op_cheap |
struct | expmed_op_costs |
struct | target_expmed |
Macros | |
#define | MULT_COST_LESS(X, Y) |
#define | CHEAPER_MULT_COST(X, Y) |
#define | NUM_ALG_HASH_ENTRIES 307 |
#define | NUM_MODE_IP_INT (NUM_MODE_INT + NUM_MODE_PARTIAL_INT) |
#define | NUM_MODE_IPV_INT (NUM_MODE_IP_INT + NUM_MODE_VECTOR_INT) |
#define | this_target_expmed (&default_target_expmed) |
Enumerations | |
enum | alg_code { alg_unknown , alg_zero , alg_m , alg_shift , alg_add_t_m2 , alg_sub_t_m2 , alg_add_factor , alg_sub_factor , alg_add_t2_m , alg_sub_t2_m , alg_impossible } |
enum | mult_variant { basic_variant , negate_variant , add_variant } |
Functions | |
bool | choose_mult_variant (machine_mode, HOST_WIDE_INT, struct algorithm *, enum mult_variant *, int) |
struct alg_hash_entry * | alg_hash_entry_ptr (int idx) |
bool | alg_hash_used_p (void) |
void | set_alg_hash_used_p (bool usedp) |
int | expmed_mode_index (machine_mode mode) |
bool * | expmed_op_cheap_ptr (struct expmed_op_cheap *eoc, bool speed, machine_mode mode) |
int * | expmed_op_cost_ptr (struct expmed_op_costs *costs, bool speed, machine_mode mode) |
bool * | sdiv_pow2_cheap_ptr (bool speed, machine_mode mode) |
void | set_sdiv_pow2_cheap (bool speed, machine_mode mode, bool cheap_p) |
bool | sdiv_pow2_cheap (bool speed, machine_mode mode) |
bool * | smod_pow2_cheap_ptr (bool speed, machine_mode mode) |
void | set_smod_pow2_cheap (bool speed, machine_mode mode, bool cheap) |
bool | smod_pow2_cheap (bool speed, machine_mode mode) |
int * | zero_cost_ptr (bool speed) |
void | set_zero_cost (bool speed, int cost) |
int | zero_cost (bool speed) |
int * | add_cost_ptr (bool speed, machine_mode mode) |
void | set_add_cost (bool speed, machine_mode mode, int cost) |
int | add_cost (bool speed, machine_mode mode) |
int * | neg_cost_ptr (bool speed, machine_mode mode) |
void | set_neg_cost (bool speed, machine_mode mode, int cost) |
int | neg_cost (bool speed, machine_mode mode) |
int * | shift_cost_ptr (bool speed, machine_mode mode, int bits) |
void | set_shift_cost (bool speed, machine_mode mode, int bits, int cost) |
int | shift_cost (bool speed, machine_mode mode, int bits) |
int * | shiftadd_cost_ptr (bool speed, machine_mode mode, int bits) |
void | set_shiftadd_cost (bool speed, machine_mode mode, int bits, int cost) |
int | shiftadd_cost (bool speed, machine_mode mode, int bits) |
int * | shiftsub0_cost_ptr (bool speed, machine_mode mode, int bits) |
void | set_shiftsub0_cost (bool speed, machine_mode mode, int bits, int cost) |
int | shiftsub0_cost (bool speed, machine_mode mode, int bits) |
int * | shiftsub1_cost_ptr (bool speed, machine_mode mode, int bits) |
void | set_shiftsub1_cost (bool speed, machine_mode mode, int bits, int cost) |
int | shiftsub1_cost (bool speed, machine_mode mode, int bits) |
int * | mul_cost_ptr (bool speed, machine_mode mode) |
void | set_mul_cost (bool speed, machine_mode mode, int cost) |
int | mul_cost (bool speed, machine_mode mode) |
int * | sdiv_cost_ptr (bool speed, machine_mode mode) |
void | set_sdiv_cost (bool speed, machine_mode mode, int cost) |
int | sdiv_cost (bool speed, machine_mode mode) |
int * | udiv_cost_ptr (bool speed, machine_mode mode) |
void | set_udiv_cost (bool speed, machine_mode mode, int cost) |
int | udiv_cost (bool speed, machine_mode mode) |
int * | mul_widen_cost_ptr (bool speed, machine_mode mode) |
void | set_mul_widen_cost (bool speed, machine_mode mode, int cost) |
int | mul_widen_cost (bool speed, machine_mode mode) |
int * | mul_highpart_cost_ptr (bool speed, machine_mode mode) |
void | set_mul_highpart_cost (bool speed, machine_mode mode, int cost) |
int | mul_highpart_cost (bool speed, machine_mode mode) |
int * | convert_cost_ptr (machine_mode to_mode, machine_mode from_mode, bool speed) |
void | set_convert_cost (machine_mode to_mode, machine_mode from_mode, bool speed, int cost) |
int | convert_cost (machine_mode to_mode, machine_mode from_mode, bool speed) |
int | mult_by_coeff_cost (HOST_WIDE_INT, machine_mode, bool) |
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) |
rtx | negate_rtx (machine_mode, rtx) |
rtx | flip_storage_order (machine_mode, rtx) |
rtx | expand_and (machine_mode, rtx, rtx, rtx) |
rtx | emit_store_flag (rtx, enum rtx_code, rtx, rtx, machine_mode, int, int) |
rtx | emit_store_flag_force (rtx, enum rtx_code, rtx, rtx, machine_mode, int, int) |
void | canonicalize_comparison (machine_mode, enum rtx_code *, rtx *) |
unsigned HOST_WIDE_INT | choose_multiplier (unsigned HOST_WIDE_INT, int, int, unsigned HOST_WIDE_INT *, int *) |
void | store_bit_field (rtx, poly_uint64, poly_uint64, poly_uint64, poly_uint64, machine_mode, rtx, bool, bool) |
rtx | extract_bit_field (rtx, poly_uint64, poly_uint64, int, rtx, machine_mode, machine_mode, bool, rtx *) |
rtx | extract_low_bits (machine_mode, machine_mode, rtx) |
rtx | expand_mult (machine_mode, rtx, rtx, rtx, int, bool=false) |
rtx | expand_mult_highpart_adjust (scalar_int_mode, rtx, rtx, rtx, rtx, int) |
rtx | expmed_mult_highpart_optab (scalar_int_mode, rtx, rtx, rtx, int, int) |
rtx | expand_rotate_as_vec_perm (machine_mode, rtx, rtx, rtx) |
Variables | |
struct target_expmed | default_target_expmed |
#define CHEAPER_MULT_COST | ( | X, | |
Y ) |
This macro is used to compare two pointers to mult_costs against each other. The macro returns true if X is cheaper than Y. Currently, the cheaper of two mult_costs is the one with the lower "cost". If "cost"s are tied, the lower latency is cheaper.
Referenced by choose_mult_variant(), and synth_mult().
#define MULT_COST_LESS | ( | X, | |
Y ) |
This macro is used to compare a pointer to a mult_cost against an single integer "rtx_cost" value. This is equivalent to the macro CHEAPER_MULT_COST(X,Z) where Z = {Y,Y}.
Referenced by choose_mult_variant(), and synth_mult().
#define NUM_ALG_HASH_ENTRIES 307 |
The number of cache/hash entries.
Referenced by init_expmed(), and synth_mult().
#define NUM_MODE_IP_INT (NUM_MODE_INT + NUM_MODE_PARTIAL_INT) |
Referenced by convert_cost_ptr(), and expmed_mode_index().
#define NUM_MODE_IPV_INT (NUM_MODE_IP_INT + NUM_MODE_VECTOR_INT) |
#define this_target_expmed (&default_target_expmed) |
Referenced by add_cost_ptr(), alg_hash_entry_ptr(), alg_hash_used_p(), convert_cost_ptr(), mul_cost_ptr(), mul_highpart_cost_ptr(), mul_widen_cost_ptr(), neg_cost_ptr(), sdiv_cost_ptr(), sdiv_pow2_cheap_ptr(), set_alg_hash_used_p(), shift_cost_ptr(), shiftadd_cost_ptr(), shiftsub0_cost_ptr(), shiftsub1_cost_ptr(), smod_pow2_cheap_ptr(), udiv_cost_ptr(), and zero_cost_ptr().
enum alg_code |
Target-dependent costs for expmed.cc. Copyright (C) 1987-2024 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Enumerator | |
---|---|
alg_unknown | |
alg_zero | |
alg_m | |
alg_shift | |
alg_add_t_m2 | |
alg_sub_t_m2 | |
alg_add_factor | |
alg_sub_factor | |
alg_add_t2_m | |
alg_sub_t2_m | |
alg_impossible |
enum mult_variant |
|
inline |
Return the cost of computing an add in MODE when optimizing for SPEED.
References add_cost_ptr(), alg_hash_entry::mode, and alg_hash_entry::speed.
Referenced by add_dependency(), analyze_increments(), assign_hard_reg(), vect_optimize_slp_pass::backward_pass(), choose_mult_variant(), determine_iv_cost(), expand_divmod(), expand_expr_real_2(), expand_shift_1(), expmed_mult_highpart(), expmed_mult_highpart_optab(), find_costs_and_classes(), force_expr_to_var_cost(), vect_optimize_slp_pass::forward_pass(), get_address_cost(), get_computation_cost(), get_shiftadd_cost(), improve_allocation(), init_expmed_one_mode(), phi_incr_cost_1(), record_address_regs(), replace_uncond_cands_and_profitable_phis(), scan_one_insn(), stmt_cost(), synth_mult(), and vect_optimize_slp_pass::total_in_cost().
|
inline |
Subroutine of {set_,}add_cost. Not to be used otherwise.
References expmed_op_cost_ptr(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by add_cost(), and set_add_cost().
|
inline |
Return a pointer to the alg_hash_entry at IDX.
References this_target_expmed.
Referenced by init_expmed(), and synth_mult().
|
inline |
Return true if the x_alg_hash field might have been used.
References this_target_expmed.
Referenced by init_expmed().
Choose the more appropiate immediate in scalar integer comparisons. The purpose of this is to end up with an immediate which can be loaded into a register in fewer moves, if possible. For each integer comparison there exists an equivalent choice: i) a > b or a >= b + 1 ii) a <= b or a < b + 1 iii) a >= b or a > b - 1 iv) a < b or a <= b - 1 MODE is the mode of the first operand. CODE points to the comparison code. IMM points to the rtx containing the immediate. *IMM must satisfy CONST_SCALAR_INT_P on entry and continues to satisfy CONST_SCALAR_INT_P on exit.
References wi::add(), can_create_pseudo_p, equivalent_cmp_code(), gen_move_insn(), gen_rtx_REG(), immed_wide_int_const(), insn_cost(), LAST_VIRTUAL_REGISTER, expand_operand::mode, wi::OVF_NONE, SCALAR_INT_MODE_P, SIGNED, wi::sub(), UNSIGNED, and unsigned_condition_p().
Referenced by emit_store_flag_1(), and prepare_cmp_insn().
bool choose_mult_variant | ( | machine_mode | mode, |
HOST_WIDE_INT | val, | ||
struct algorithm * | alg, | ||
enum mult_variant * | variant, | ||
int | mult_cost ) |
Find the cheapest way of multiplying a value of mode MODE by VAL. Try three variations: - a shift/add sequence based on VAL itself - a shift/add sequence based on -VAL, followed by a negation - a shift/add sequence based on VAL - 1, followed by an addition. Return true if the cheapest of these cost less than MULT_COST, describing the algorithm in *ALG and final fixup in *VARIANT.
References add_cost(), add_variant, basic_variant, CHEAPER_MULT_COST, algorithm::cost, mult_cost::cost, GET_MODE_UNIT_BITSIZE, GET_MODE_UNIT_PRECISION, HOST_BITS_PER_INT, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, HOST_WIDE_INT_MIN, mult_cost::latency, MULT_COST_LESS, neg_cost(), negate_variant, optimize_insn_for_speed_p(), and synth_mult().
Referenced by expand_expr_real_2(), expand_mult(), expand_widening_mult(), expmed_mult_highpart(), mult_by_coeff_cost(), and vect_synth_mult_by_constant().
|
extern |
Choose a minimal N + 1 bit approximation to 2**K / D that can be used to replace division by D, put the least significant N bits of the result in *MULTIPLIER_PTR, the value K - N in *POST_SHIFT_PTR, and return the most significant bit.
Choose a minimal N + 1 bit approximation to 2**K / D that can be used to replace division by D, put the least significant N bits of the result in *MULTIPLIER_PTR, the value K - N in *POST_SHIFT_PTR, and return the most significant bit. The width of operations is N (should be <= HOST_BITS_PER_WIDE_INT), the needed precision is PRECISION (should be <= N). PRECISION should be as small as possible so this function can choose the multiplier more freely. If PRECISION is <= N - 1, the most significant bit returned by the function will be zero. Using this function, x / D is equal to (x*m) / 2**N >> (*POST_SHIFT_PTR), where m is the full N + 1 bit multiplier.
References ceil_log2(), wi::extract_uhwi(), gcc_assert, HOST_BITS_PER_DOUBLE_INT, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, wi::set_bit_in_zero(), generic_wide_int< storage >::to_uhwi(), wi::udiv_trunc(), and wi::uhwi().
Referenced by expand_divmod(), expand_vector_divmod(), and vect_recog_divmod_pattern().
|
inline |
Return the cost for converting from FROM_MODE to TO_MODE when optimizing for SPEED.
References convert_cost_ptr(), and alg_hash_entry::speed.
Referenced by force_expr_to_var_cost(), get_computation_cost(), and stmt_cost().
|
inline |
Subroutine of {set_,}convert_cost. Not to be used otherwise.
References expmed_mode_index(), gcc_assert, IN_RANGE, NUM_MODE_IP_INT, alg_hash_entry::speed, and this_target_expmed.
Referenced by convert_cost(), and set_convert_cost().
|
extern |
Helper function for emit_store_flag.
References as_a(), const1_rtx, convert_move(), create_fixed_operand(), create_output_operand(), delete_insns_since(), expand_and(), expand_shift(), expand_unop(), gcc_assert, gen_reg_rtx(), get_last_insn(), GET_MODE_BITSIZE(), GET_MODE_PRECISION(), last, maybe_expand_insn(), expand_operand::mode, NULL_RTX, prepare_operand(), STORE_FLAG_VALUE, expand_operand::target, targetm, val_signbit_known_set_p(), expand_operand::value, and y.
Referenced by emit_store_flag_1(), and expand_ccmp_expr().
|
extern |
Emit a store-flag operation.
Emit a store-flags instruction for comparison CODE on OP0 and OP1 and storing in TARGET. Normally return TARGET. Return 0 if that cannot be done. MODE is the mode to use for OP0 and OP1 should they be CONST_INTs. If it is VOIDmode, they cannot both be CONST_INT. UNSIGNEDP is for the case where we have to widen the operands to perform the operation. It says to use zero-extension. NORMALIZEP is 1 if we should convert the result to be either zero or one. Normalize is -1 if we should convert the result to be either zero or -1. If NORMALIZEP is zero, the result will be left "raw" out of the scc insn.
References can_compare_p(), ccp_store_flag, const0_rtx, CONSTANT_P, delete_insns_since(), emit_conditional_move(), emit_store_flag_1(), emit_store_flag_int(), expand_binop(), gcc_assert, GEN_INT, gen_int_mode(), get_last_insn(), GET_MODE, GET_MODE_CLASS, HONOR_NANS(), HONOR_SNANS(), INTVAL, is_int_mode(), last, expand_operand::mode, NULL_RTX, OPTAB_WIDEN, optimize_insn_for_speed_p(), reverse_condition_maybe_unordered(), rtx_cost(), split_comparison(), STORE_FLAG_VALUE, expand_operand::target, and val_signbit_p().
Referenced by emit_store_flag_1(), emit_store_flag_force(), emit_store_flag_int(), expand_divmod(), expand_POPCOUNT(), expand_sdiv_pow2(), expand_smod_pow2(), noce_emit_store_flag(), and noce_try_sign_mask().
|
extern |
Like emit_store_flag, but always succeeds.
References can_compare_p(), ccp_jump, const0_rtx, const1_rtx, do_compare_rtx_and_jump(), emit_label(), emit_move_insn(), emit_store_flag(), FLOAT_MODE_P, GEN_INT, gen_label_rtx(), gen_reg_rtx(), GET_MODE, GET_MODE_CLASS, HONOR_NANS(), HONOR_SNANS(), expand_operand::mode, NULL, NULL_RTX, reg_mentioned_p(), REG_P, reverse_condition(), reverse_condition_maybe_unordered(), swap_commutative_operands_p(), swap_condition(), expand_operand::target, profile_probability::uninitialized(), and word_mode.
Referenced by convert_mode_scalar(), do_store_flag(), expand_atomic_compare_and_swap(), expand_atomic_test_and_set(), expand_binop(), expand_builtin_issignaling(), expand_divmod(), and expand_ifn_atomic_op_fetch_cmp_0().
Expand a logical AND operation.
Compute the logical-and of OP0 and OP1, storing it in TARGET and returning TARGET. If TARGET is 0, a pseudo-register or constant is returned.
References emit_move_insn(), expand_binop(), GET_MODE, OPTAB_LIB_WIDEN, and simplify_binary_operation().
Referenced by calculate_table_based_CRC(), emit_cstore(), expand_builtin_extract_return_addr(), expand_expr_real_2(), expand_mult_highpart_adjust(), gen_common_operation_to_reflect(), optimize_bitfield_assignment_op(), and reduce_to_bit_field_precision().
|
extern |
Perform a multiplication and return an rtx for the result. MODE is mode of value; OP0 and OP1 are what to multiply (rtx's); TARGET is a suggestion for where to store the result (an rtx). We check specially for a constant integer as OP1. If you want this check for OP0 as well, then before calling you should swap the two operands if OP0 would be constant.
References choose_mult_variant(), CONST0_RTX, CONST1_RTX, CONST_DOUBLE_AS_FLOAT_P, CONST_DOUBLE_AS_INT_P, CONST_DOUBLE_REAL_VALUE, CONST_INT_P, CONST_WIDE_INT_P, CONSTANT_P, CONSTM1_RTX, dconst2, wi::exact_log2(), EXACT_POWER_OF_2_OR_ZERO_P, expand_binop(), expand_mult_const(), expand_shift(), expand_unop(), floor_log2(), force_reg(), gcc_assert, gen_raw_REG(), GET_MODE, GET_MODE_CLASS, GET_MODE_UNIT_BITSIZE, HOST_BITS_PER_WIDE_INT, INTEGRAL_MODE_P, INTVAL, LAST_VIRTUAL_REGISTER, neg_cost(), NULL_RTX, optab_handler(), OPTAB_LIB_WIDEN, OPTAB_WIDEN, optimize_insn_for_speed_p(), real_equal(), SCALAR_INT_MODE_P, set_src_cost(), and unwrap_const_vec_duplicate().
Referenced by align_dynamic_address(), builtin_memset_gen_str(), can_widen_mult_without_libcall(), expand_divmod(), expand_expr_real_2(), force_operand(), index_part_to_reg(), and round_push().
|
extern |
Emit code to adjust ADJ_OPERAND after multiplication of wrong signedness flavor of OP0 and OP1. ADJ_OPERAND is already the high half of the product OP0 x OP1. If UNSIGNEDP is nonzero, adjust the signed product to become unsigned, if UNSIGNEDP is zero, adjust the unsigned product to become signed. The result is put in TARGET if that is convenient. MODE is the mode of operation.
References expand_and(), expand_shift(), force_operand(), GET_MODE_BITSIZE(), and NULL_RTX.
Referenced by expand_expr_real_2(), and expmed_mult_highpart_optab().
Expand a vector (left) rotate of MODE of X by an immediate AMT as a vector permute operation. Emit code to put the result in DST if successfull and return it. Otherwise return NULL. This is intended to implement vector rotates by byte amounts using vector permutes when the target does not offer native vector rotate operations.
References CONST_INT_P, emit_move_insn(), expand_vec_perm_const(), GET_MODE_INNER, GET_MODE_SIZE(), i, INTVAL, lowpart_subreg(), expand_operand::mode, int_vector_builder< T >::new_vector(), NULL_RTX, qimode_for_vec_perm(), and unwrap_const_vec_duplicate().
|
inline |
Compute an index into the cost arrays by mode class.
References gcc_unreachable, GET_MODE_CLASS, alg_hash_entry::mode, and NUM_MODE_IP_INT.
Referenced by convert_cost_ptr(), expmed_op_cheap_ptr(), expmed_op_cost_ptr(), shift_cost_ptr(), shiftadd_cost_ptr(), shiftsub0_cost_ptr(), and shiftsub1_cost_ptr().
|
extern |
Like expmed_mult_highpart, but only consider using multiplication optab.
References add_cost(), BITS_PER_WORD, convert_modes(), convert_optab_handler(), emit_insn(), end_sequence(), expand_binop(), expand_mult_highpart_adjust(), extract_high_half(), get_insns(), GET_MODE_BITSIZE(), GET_MODE_WIDER_MODE(), insns, mul_cost(), mul_highpart_cost(), mul_widen_cost(), NULL_RTX, OPTAB_DIRECT, optab_handler(), OPTAB_WIDEN, optimize_insn_for_speed_p(), shift_cost(), and start_sequence().
Referenced by expand_mult_highpart(), and expmed_mult_highpart().
|
inline |
Return a pointer to a boolean contained in EOC indicating whether a particular operation performed in MODE is cheap when optimizing for SPEED.
References expmed_op_cheap::cheap, expmed_mode_index(), alg_hash_entry::mode, and alg_hash_entry::speed.
Referenced by sdiv_pow2_cheap_ptr(), and smod_pow2_cheap_ptr().
|
inline |
Return a pointer to a cost contained in COSTS when a particular operation is performed in MODE when optimizing for SPEED.
References costs::cost, expmed_mode_index(), alg_hash_entry::mode, and alg_hash_entry::speed.
Referenced by add_cost_ptr(), mul_cost_ptr(), neg_cost_ptr(), sdiv_cost_ptr(), and udiv_cost_ptr().
|
extern |
Generate code to extract a byte-field from STR_RTX containing BITSIZE bits, starting at BITNUM, and put it in TARGET if possible (if TARGET is nonzero). Regardless of TARGET, we return the rtx for where the value is placed. STR_RTX is the structure containing the byte (a REG or MEM). UNSIGNEDP is nonzero if this is an unsigned bit field. MODE is the natural mode of the field value once extracted. TMODE is the mode the caller would like the value to have; but the value may be returned with type MODE instead. If REVERSE is true, the extraction is to be done in reverse order. If a TARGET is specified and we can store in it at no extra cost, we do so, and return TARGET. Otherwise, we return a REG of mode TMODE or MODE, with TMODE preferred if they are equally easy. If the result can be stored at TARGET, and ALT_RTL is non-NULL, then *ALT_RTL is set to TARGET (before legitimziation).
References adjust_bitfield_address, convert_extracted_bit_field(), copy_to_reg(), extract_bit_field_1(), flip_storage_order(), gcc_assert, GET_MODE, GET_MODE_BITSIZE(), is_a(), poly_int< N, C >::is_constant(), expand_operand::mode, narrow_bit_field_mem(), strict_volatile_bitfield_p(), and expand_operand::target.
Referenced by assign_parm_setup_reg(), copy_blkmode_from_reg(), copy_blkmode_to_reg(), emit_group_load_1(), expand_expr_real_1(), expand_misaligned_mem_ref(), expand_single_bit_test(), load_register_parameters(), read_complex_part(), store_field(), store_integral_bit_field(), and store_unaligned_arguments_into_pseudos().
Try to read the low bits of SRC as an rvalue of mode MODE, preserving the bit pattern. SRC_MODE is the mode of SRC; if this is smaller than MODE, fill the upper bits with zeros. Fail if the layout of either mode is unknown (as for CC modes) or if the extraction would involve unprofitable mode punning. Return the value on success, otherwise return null. This is different from gen_lowpart* in these respects: - the returned value must always be considered an rvalue - when MODE is wider than SRC_MODE, the extraction involves a zero extension - when MODE is smaller than SRC_MODE, the extraction involves a truncation (and is thus subject to TARGET_TRULY_NOOP_TRUNCATION). In other words, this routine performs a computation, whereas the gen_lowpart* routines are conceptually lvalue or rvalue subreg operations.
References CONSTANT_P, convert_modes(), force_reg(), gen_lowpart, gen_lowpart_common(), gen_rtx_SUBREG(), GET_MODE, GET_MODE_BITSIZE(), GET_MODE_CLASS, int_mode_for_mode(), known_eq, expand_operand::mode, NULL_RTX, simplify_subreg(), subreg_lowpart_offset(), targetm, and validate_subreg().
Referenced by find_shift_sequence(), and get_stored_val().
Arguments MODE, RTX: return an rtx for the flipping of that value. May emit insns.
Return an rtx representing value of X with reverse storage order. MODE is the intended mode of the result, useful if X is a CONST_INT.
References check_reverse_float_storage_order_support(), check_reverse_storage_order_support(), COMPLEX_MODE_P, expand_unop(), flip_storage_order(), FLOAT_MODE_P, gen_lowpart, GET_MODE_INNER, GET_MODE_NAME, GET_MODE_PRECISION(), int_mode_for_size(), is_a(), alg_hash_entry::mode, NULL_RTX, read_complex_part(), reverse_float_storage_order_supported, reverse_storage_order_supported, simplify_unary_operation(), sorry(), targetm, and UNLIKELY.
Referenced by assemble_real(), expand_assignment(), expand_expr_real_1(), extract_bit_field(), extract_bit_field_1(), extract_fixed_bit_field_1(), extract_integral_bit_field(), flip_storage_order(), optimize_bitfield_assignment_op(), output_constant(), store_bit_field(), store_bit_field_1(), store_expr(), store_field(), and store_fixed_bit_field_1().
|
inline |
Return the cost of doing a multiplication in MODE when optimizing for SPEED.
References alg_hash_entry::mode, mul_cost_ptr(), and alg_hash_entry::speed.
Referenced by analyze_increments(), expand_divmod(), expand_expr_real_2(), expmed_mult_highpart_optab(), and stmt_cost().
|
inline |
Subroutine of {set_,}mul_cost. Not to be used otherwise.
References expmed_op_cost_ptr(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by mul_cost(), and set_mul_cost().
|
inline |
Return the cost for computing the high part of a multiplication in MODE when optimizing for SPEED.
References alg_hash_entry::mode, mul_highpart_cost_ptr(), and alg_hash_entry::speed.
Referenced by expmed_mult_highpart_optab().
|
inline |
Subroutine of {set_,}mul_highpart_cost. Not to be used otherwise.
References gcc_assert, GET_MODE_CLASS, alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by mul_highpart_cost(), and set_mul_highpart_cost().
|
inline |
Return the cost for computing a widening multiplication in MODE when optimizing for SPEED.
References alg_hash_entry::mode, mul_widen_cost_ptr(), and alg_hash_entry::speed.
Referenced by expand_widening_mult(), and expmed_mult_highpart_optab().
|
inline |
Subroutine of {set_,}mul_widen_cost. Not to be used otherwise.
References gcc_assert, GET_MODE_CLASS, alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by mul_widen_cost(), and set_mul_widen_cost().
|
extern |
Return a cost estimate for multiplying a register by the given COEFFicient in the given MODE and SPEED.
References choose_mult_variant(), algorithm::cost, mult_cost::cost, gen_raw_REG(), LAST_VIRTUAL_REGISTER, and set_src_cost().
Referenced by analyze_increments(), force_expr_to_var_cost(), get_address_cost(), get_computation_cost(), most_expensive_mult_to_index(), and stmt_cost().
|
inline |
Return the cost of computing a negation in MODE when optimizing for SPEED.
References alg_hash_entry::mode, neg_cost_ptr(), and alg_hash_entry::speed.
Referenced by choose_mult_variant(), expand_expr_real_2(), expand_mult(), and stmt_cost().
|
inline |
Subroutine of {set_,}neg_cost. Not to be used otherwise.
References expmed_op_cost_ptr(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by neg_cost(), and set_neg_cost().
Arguments MODE, RTX: return an rtx for the negation of that value. May emit insns.
Return an rtx representing minus the value of X. MODE is the intended mode of the result, useful if X is a CONST_INT.
References expand_unop(), alg_hash_entry::mode, NULL_RTX, and simplify_unary_operation().
Referenced by expand_binop(), expand_builtin_apply(), expand_expr_real_2(), fill_slots_from_thread(), force_operand(), and push_block().
|
inline |
Return the cost of doing a signed division in MODE when optimizing for SPEED.
References alg_hash_entry::mode, sdiv_cost_ptr(), and alg_hash_entry::speed.
Referenced by expand_divmod().
|
inline |
Subroutine of {set_,}sdiv_cost. Not to be used otherwise.
References expmed_op_cost_ptr(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by sdiv_cost(), and set_sdiv_cost().
Return whether a signed division by a power of 2 is cheap in MODE when optimizing for SPEED.
References alg_hash_entry::mode, sdiv_pow2_cheap_ptr(), and alg_hash_entry::speed.
Referenced by expand_divmod().
Subroutine of {set_,}sdiv_pow2_cheap. Not to be used otherwise.
References expmed_op_cheap_ptr(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by sdiv_pow2_cheap(), and set_sdiv_pow2_cheap().
|
inline |
Set the COST of computing an add in MODE when optimizing for SPEED.
References add_cost_ptr(), alg_hash_entry::cost, alg_hash_entry::mode, and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set whether the x_alg_hash field might have been used.
References this_target_expmed.
Referenced by init_expmed().
|
inline |
Set the COST for converting from FROM_MODE to TO_MODE when optimizing for SPEED.
References convert_cost_ptr(), alg_hash_entry::cost, and alg_hash_entry::speed.
Referenced by init_expmed_one_conv().
|
inline |
Set the COST of doing a multiplication in MODE when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, mul_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST for computing the high part of a multiplication in MODE when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, mul_highpart_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST for computing a widening multiplication in MODE when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, mul_widen_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST of computing a negation in MODE when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, neg_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST of doing a signed division in MODE when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, sdiv_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
Set whether a signed division by a power of 2 is cheap in MODE when optimizing for SPEED.
References alg_hash_entry::mode, sdiv_pow2_cheap_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST of doing a shift in MODE by BITS when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, shift_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST of doing a shift in MODE by BITS followed by an add when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, shiftadd_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST of doing a shift in MODE by BITS and then subtracting a value when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, shiftsub0_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST of subtracting a shift in MODE by BITS from a value when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, shiftsub1_cost_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
Set whether a signed modulo by a power of 2 is CHEAP in MODE when optimizing for SPEED.
References alg_hash_entry::mode, smod_pow2_cheap_ptr(), and alg_hash_entry::speed.
Referenced by init_expmed_one_mode().
|
inline |
Set the COST of doing an unsigned division in MODE when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::mode, alg_hash_entry::speed, and udiv_cost_ptr().
Referenced by init_expmed_one_mode().
|
inline |
Set the COST of loading zero when optimizing for SPEED.
References alg_hash_entry::cost, alg_hash_entry::speed, and zero_cost_ptr().
Referenced by init_expmed().
|
inline |
Return the cost of doing a shift in MODE by BITS when optimizing for SPEED.
References alg_hash_entry::mode, shift_cost_ptr(), and alg_hash_entry::speed.
Referenced by expand_divmod(), expand_sdiv_pow2(), expand_shift_1(), expmed_mult_highpart(), expmed_mult_highpart_optab(), get_shiftadd_cost(), and synth_mult().
|
inline |
Subroutine of {set_,}shift_cost. Not to be used otherwise.
References expmed_mode_index(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by set_shift_cost(), and shift_cost().
|
inline |
Return the cost of doing a shift in MODE by BITS followed by an add when optimizing for SPEED.
References alg_hash_entry::mode, shiftadd_cost_ptr(), and alg_hash_entry::speed.
Referenced by get_shiftadd_cost(), and synth_mult().
|
inline |
Subroutine of {set_,}shiftadd_cost. Not to be used otherwise.
References expmed_mode_index(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by set_shiftadd_cost(), and shiftadd_cost().
|
inline |
Return the cost of doing a shift in MODE by BITS and then subtracting a value when optimizing for SPEED.
References alg_hash_entry::mode, shiftsub0_cost_ptr(), and alg_hash_entry::speed.
Referenced by get_shiftadd_cost(), and synth_mult().
|
inline |
Subroutine of {set_,}shiftsub0_cost. Not to be used otherwise.
References expmed_mode_index(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by set_shiftsub0_cost(), and shiftsub0_cost().
|
inline |
Return the cost of subtracting a shift in MODE by BITS from a value when optimizing for SPEED.
References alg_hash_entry::mode, shiftsub1_cost_ptr(), and alg_hash_entry::speed.
Referenced by get_shiftadd_cost(), and synth_mult().
|
inline |
Subroutine of {set_,}shiftsub1_cost. Not to be used otherwise.
References expmed_mode_index(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by set_shiftsub1_cost(), and shiftsub1_cost().
Return whether a signed modulo by a power of 2 is cheap in MODE when optimizing for SPEED.
References alg_hash_entry::mode, smod_pow2_cheap_ptr(), and alg_hash_entry::speed.
Referenced by expand_divmod().
Subroutine of {set_,}smod_pow2_cheap. Not to be used otherwise.
References expmed_op_cheap_ptr(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by set_smod_pow2_cheap(), and smod_pow2_cheap().
|
extern |
Generate code to store value from rtx VALUE into a bit-field within structure STR_RTX containing BITSIZE bits starting at bit BITNUM. BITREGION_START is bitpos of the first bitfield in this region. BITREGION_END is the bitpos of the ending bitfield in this region. These two fields are 0, if the C++ memory model does not apply, or we are not interested in keeping track of bitfield regions. FIELDMODE is the machine-mode of the FIELD_DECL node for this field. If REVERSE is true, the store is to be done in reverse order. If UNDEFINED_P is true then STR_RTX is currently undefined.
References adjust_bitfield_address, adjust_bitfield_address_size, bits_to_bytes_round_up, copy_to_reg(), emit_move_insn(), flip_storage_order(), gcc_assert, gcc_unreachable, get_best_mode(), GET_MODE_BITSIZE(), INT_MAX, is_a(), poly_int< N, C >::is_constant(), MEM_ALIGN, MEM_P, MEM_VOLATILE_P, narrow_bit_field_mem(), offset, store_bit_field_1(), strict_volatile_bitfield_p(), and expand_operand::value.
Referenced by copy_blkmode_from_reg(), copy_blkmode_to_reg(), emit_group_store(), expand_assignment(), expand_expr_real_2(), noce_emit_move_insn(), store_expr(), store_field(), store_unaligned_arguments_into_pseudos(), and write_complex_part().
|
inline |
Return the cost of doing an unsigned division in MODE when optimizing for SPEED.
References alg_hash_entry::mode, alg_hash_entry::speed, and udiv_cost_ptr().
Referenced by expand_divmod().
|
inline |
Subroutine of {set_,}udiv_cost. Not to be used otherwise.
References expmed_op_cost_ptr(), alg_hash_entry::mode, alg_hash_entry::speed, and this_target_expmed.
Referenced by set_udiv_cost(), and udiv_cost().
|
inline |
Return the COST of loading zero when optimizing for SPEED.
References alg_hash_entry::speed, and zero_cost_ptr().
Referenced by synth_mult().
|
inline |
Subroutine of {set_,}zero_cost. Not to be used otherwise.
References alg_hash_entry::speed, and this_target_expmed.
Referenced by set_zero_cost(), and zero_cost().
|
extern |
Medium-level subroutines: convert bit-field store and extract and shifts, multiplies and divides to rtl instructions. Copyright (C) 1987-2024 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Work around tree-optimization/91825.