GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "insn-codes.h"
#include "optabs-query.h"
#include "optabs-libfuncs.h"
#include "insn-config.h"
#include "rtl.h"
#include "recog.h"
#include "vec-perm-indices.h"
Enumerations | |
enum | extraction_type { ET_unaligned_mem , ET_reg } |
Functions | |
insn_code | convert_optab_handler (convert_optab optab, machine_mode to_mode, machine_mode from_mode, optimization_type opt_type) |
insn_code | direct_optab_handler (convert_optab optab, machine_mode mode, optimization_type opt_type) |
static bool | get_traditional_extraction_insn (extraction_insn *insn, enum extraction_type type, machine_mode mode, enum insn_code icode, int struct_op, int field_op) |
static bool | get_optab_extraction_insn (class extraction_insn *insn, enum extraction_type type, machine_mode mode, direct_optab reg_optab, direct_optab misalign_optab, int pos_op) |
static bool | get_extraction_insn (extraction_insn *insn, enum extraction_pattern pattern, enum extraction_type type, machine_mode mode) |
static bool | get_best_extraction_insn (extraction_insn *insn, enum extraction_pattern pattern, enum extraction_type type, unsigned HOST_WIDE_INT struct_bits, machine_mode field_mode) |
bool | get_best_reg_extraction_insn (extraction_insn *insn, enum extraction_pattern pattern, unsigned HOST_WIDE_INT struct_bits, machine_mode field_mode) |
bool | get_best_mem_extraction_insn (extraction_insn *insn, enum extraction_pattern pattern, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitnum, machine_mode field_mode) |
enum insn_code | can_extend_p (machine_mode to_mode, machine_mode from_mode, int unsignedp) |
enum insn_code | can_float_p (machine_mode fltmode, machine_mode fixmode, int unsignedp) |
enum insn_code | can_fix_p (machine_mode fixmode, machine_mode fltmode, int unsignedp, bool *truncp_ptr) |
bool | can_conditionally_move_p (machine_mode mode) |
opt_machine_mode | qimode_for_vec_perm (machine_mode mode) |
bool | selector_fits_mode_p (machine_mode mode, const vec_perm_indices &sel) |
bool | can_vec_perm_var_p (machine_mode mode) |
bool | can_vec_perm_const_p (machine_mode mode, machine_mode op_mode, const vec_perm_indices &sel, bool allow_variable_p) |
enum insn_code | find_widening_optab_handler_and_mode (optab op, machine_mode to_mode, machine_mode from_mode, machine_mode *found_mode) |
int | can_mult_highpart_p (machine_mode mode, bool uns_p) |
bool | can_compare_and_swap_p (machine_mode mode, bool allow_libcall) |
bool | can_atomic_exchange_p (machine_mode mode, bool allow_libcall) |
bool | can_atomic_load_p (machine_mode mode) |
bool | lshift_cheap_p (bool speed_p) |
static bool | supports_vec_convert_optab_p (optab op, machine_mode mode) |
bool | supports_vec_gather_load_p (machine_mode mode) |
bool | supports_vec_scatter_store_p (machine_mode mode) |
bool | can_vec_extract (machine_mode mode, machine_mode extr_mode) |
Variables | |
struct target_optabs | default_target_optabs |
struct target_optabs * | this_fn_optabs = &default_target_optabs |
enum extraction_type |
Return true if an atomic exchange can be performed.
References can_compare_and_swap_p(), and direct_optab_handler().
Referenced by expand_omp_atomic_store().
bool can_atomic_load_p | ( | machine_mode | mode | ) |
Return true if an atomic load can be performed without falling back to a compare-and-swap.
References BITS_PER_WORD, direct_optab_handler(), GET_MODE_PRECISION(), and known_le.
Referenced by expand_atomic_compare_and_swap(), expand_atomic_exchange(), expand_atomic_fetch_op(), expand_atomic_store(), expand_omp_atomic_cas(), expand_omp_atomic_fetch_op(), expand_omp_atomic_pipeline(), and fold_builtin_atomic_always_lock_free().
Return true if there is a compare_and_swap pattern.
References direct_optab_handler(), optab_handler(), and optab_libfunc().
Referenced by can_atomic_exchange_p(), expand_atomic_fetch_op(), expand_omp_atomic_cas(), expand_omp_atomic_fetch_op(), expand_omp_atomic_pipeline(), fold_builtin_atomic_always_lock_free(), maybe_emit_compare_and_swap_exchange_loop(), and maybe_emit_sync_lock_test_and_set().
bool can_conditionally_move_p | ( | machine_mode | mode | ) |
Return nonzero if a conditional move of mode MODE is supported. This function is for combine so it can tell whether an insn that looks like a conditional move is actually supported by the hardware. If we guess wrong we lose a bit on optimization, but that's it.
??? sparc64 supports conditionally moving integers values based on fp comparisons, and vice versa. How do we handle them?
References direct_optab_handler().
Referenced by bb_ok_for_noce_convert_multiple_sets(), expand_cond_expr_using_cmove(), expand_expr_real_2(), noce_try_cmove_arith(), and simplify_set().
enum insn_code can_extend_p | ( | machine_mode | to_mode, |
machine_mode | from_mode, | ||
int | unsignedp ) |
Return the insn code used to extend FROM_MODE to TO_MODE. UNSIGNEDP specifies zero-extension instead of sign-extension. If no such operation exists, CODE_FOR_nothing will be returned.
References convert_optab_handler(), and targetm.
Referenced by assign_parm_setup_reg(), compress_float_constant(), convert_mode_scalar(), gen_extend_insn(), init_expr_target(), and supportable_convert_operation().
enum insn_code can_fix_p | ( | machine_mode | fixmode, |
machine_mode | fltmode, | ||
int | unsignedp, | ||
bool * | truncp_ptr ) |
Return the insn code to convert floating-point mode FLTMODE to fixed-point mode FIXMODE, or CODE_FOR_nothing if no such instruction exists. UNSIGNEDP specifies whether FIXMODE is unsigned. On a successful return, set *TRUNCP_PTR to true if it is necessary to output an explicit FTRUNC before the instruction.
References convert_optab_handler(), and optab_handler().
Referenced by expand_fix(), and supportable_convert_operation().
enum insn_code can_float_p | ( | machine_mode | fltmode, |
machine_mode | fixmode, | ||
int | unsignedp ) |
Return the insn code to convert fixed-point mode FIXMODE to floating-point mode FLTMODE, or CODE_FOR_nothing if no such instruction exists. UNSIGNEDP specifies whether FIXMODE is unsigned.
References convert_optab_handler().
Referenced by expand_float(), simplify_using_ranges::simplify_float_conversion_using_ranges(), and supportable_convert_operation().
int can_mult_highpart_p | ( | machine_mode | mode, |
bool | uns_p ) |
Return non-zero if a highpart multiply is supported or can be synthesized. For the benefit of expand_mult_highpart, the return value is 1 for direct, 2 for integral widening, 3 for even/odd widening, 4 for hi/lo widening.
References BITS_PER_WORD, can_vec_perm_const_p(), convert_optab_handler(), GET_MODE_BITSIZE(), GET_MODE_CLASS, GET_MODE_NUNITS(), GET_MODE_WIDER_MODE(), i, is_a(), and optab_handler().
Referenced by default_preferred_div_as_shifts_over_mult(), expand_mul_overflow(), expand_mult_highpart(), expand_vector_divmod(), get_compute_type(), match_arith_overflow(), vect_recog_divmod_pattern(), and vectorizable_operation().
bool can_vec_extract | ( | machine_mode | mode, |
machine_mode | extr_mode ) |
Whether we can extract part of the vector mode MODE as (scalar or vector) mode EXTR_MODE.
References convert_optab_handler(), GET_MODE_BITSIZE(), GET_MODE_SIZE(), int_mode_for_size(), related_vector_mode(), and VECTOR_MODE_P.
Referenced by vect_find_reusable_accumulator().
bool can_vec_perm_const_p | ( | machine_mode | mode, |
machine_mode | op_mode, | ||
const vec_perm_indices & | sel, | ||
bool | allow_variable_p ) |
Return true if the target directly supports VEC_PERM_EXPRs on vectors of mode OP_MODE and result vector of mode MODE using the selector SEL. ALLOW_VARIABLE_P is true if it is acceptable to force the selector into a register and use a variable permute (if the target supports that). Note that additional permutations representing whole-vector shifts may also be handled via the vec_shr or vec_shl optab, but only where the second input vector is entirely constant zeroes; this case is not dealt with here.
References direct_optab_handler(), GET_MODE_UNIT_SIZE, vec_perm_indices::new_expanded_vector(), NULL, NULL_RTX, qimode_for_vec_perm(), selector_fits_mode_p(), targetm, and VECTOR_MODE_P.
Referenced by can_duplicate_and_interleave_p(), can_mult_highpart_p(), have_whole_vector_shift(), interleave_supported_p(), lower_vec_perm(), perm_mask_for_reverse(), scan_store_can_perm_p(), simplify_vector_constructor(), vect_gen_perm_mask_checked(), vect_grouped_load_supported(), vect_grouped_store_supported(), vect_recog_rotate_pattern(), vect_shift_permute_load_chain(), vect_transform_slp_perm_load_1(), vectorizable_bswap(), vectorizable_nonlinear_induction(), vectorizable_recurr(), and vectorizable_slp_permutation_1().
bool can_vec_perm_var_p | ( | machine_mode | mode | ) |
Return true if VEC_PERM_EXPRs with variable selector operands can be expanded using SIMD extensions of the CPU. MODE is the mode of the vectors being permuted.
References direct_optab_handler(), GET_MODE_MASK, GET_MODE_NUNITS(), GET_MODE_UNIT_SIZE, maybe_gt, optab_handler(), qimode_for_vec_perm(), and VECTOR_MODE_P.
Referenced by lower_vec_perm().
insn_code convert_optab_handler | ( | convert_optab | optab, |
machine_mode | to_mode, | ||
machine_mode | from_mode, | ||
optimization_type | opt_type ) |
Return the insn used to perform conversion OP from mode FROM_MODE to mode TO_MODE; return CODE_FOR_nothing if the target does not have such an insn, or if it is unsuitable for optimization type OPT_TYPE.
References convert_optab_handler(), and targetm.
Referenced by can_extend_p(), can_fix_p(), can_float_p(), can_mult_highpart_p(), can_vec_extract(), can_vec_extract_var_idx_p(), convert_mode_scalar(), convert_move(), convert_optab_handler(), convert_optab_supported_p(), directly_supported_p(), expand_binop(), expand_convert_optab_fn(), expand_fixed_convert(), expand_gather_load_optab_fn(), expand_partial_load_optab_fn(), expand_partial_store_optab_fn(), expand_scatter_store_optab_fn(), expand_sfix_optab(), expand_vec_cond_mask_optab_fn(), expand_vec_cond_optab_fn(), expand_vector_broadcast(), expand_while_optab_fn(), expmed_mult_highpart_optab(), extract_bit_field_1(), find_widening_optab_handler_and_mode(), get_multi_vector_move(), internal_gather_scatter_fn_supported_p(), internal_len_load_store_bias(), multi_vector_optab_supported_p(), store_constructor(), supportable_convert_operation(), supports_vec_convert_optab_p(), target_supports_len_load_store_p(), target_supports_mask_load_store_p(), vect_create_partial_epilog(), vect_lanes_optab_supported_p(), vector_vector_composition_type(), and vectorizable_store().
insn_code direct_optab_handler | ( | convert_optab | optab, |
machine_mode | mode, | ||
optimization_type | opt_type ) |
Return the insn used to implement mode MODE of OP; return CODE_FOR_nothing if the target does not have such an insn, or if it is unsuitable for optimization type OPT_TYPE.
References direct_optab_handler(), and targetm.
Referenced by can_atomic_exchange_p(), can_atomic_load_p(), can_compare_and_swap_p(), can_conditionally_move_p(), can_vec_perm_const_p(), can_vec_perm_var_p(), default_secondary_reload(), direct_optab_handler(), direct_optab_supported_p(), emit_block_cmp_via_cmpmem(), emit_block_move_via_pattern(), emit_conditional_move(), emit_conditional_move_1(), emit_conditional_neg_or_complement(), expand_atomic_compare_and_swap(), expand_atomic_load(), expand_atomic_store(), expand_builtin_feclear_feraise_except(), expand_builtin_fegetround(), expand_builtin_set_thread_pointer(), expand_builtin_strcmp(), expand_builtin_strncmp(), expand_builtin_thread_pointer(), expand_direct_optab_fn(), expand_ifn_atomic_bit_test_and(), expand_ifn_atomic_op_fetch_cmp_0(), expand_partial_load_optab_fn(), expand_partial_store_optab_fn(), expand_RAWMEMCHR(), expand_strided_load_optab_fn(), expand_strided_store_optab_fn(), expand_vec_perm_const(), expand_vec_perm_var(), expand_vec_series_expr(), get_optab_extraction_insn(), if_convert(), internal_check_ptrs_fn_supported_p(), internal_len_load_store_bias(), maybe_emit_atomic_exchange(), maybe_emit_op(), optimize_atomic_compare_exchange_p(), prepare_cmp_insn(), set_storage_via_setmem(), target_supports_len_load_store_p(), loop_distribution::transform_reduction_loop(), validate_test_and_branch(), and vectorizable_early_exit().
enum insn_code find_widening_optab_handler_and_mode | ( | optab | op, |
machine_mode | to_mode, | ||
machine_mode | from_mode, | ||
machine_mode * | found_mode ) |
Find a widening optab even if it doesn't widen as much as we want. E.g. if from_mode is HImode, and to_mode is DImode, and there is no direct HI->SI insn, then return SI->DI, if that exists.
References convert_optab_handler(), FOR_EACH_MODE, gcc_checking_assert, GET_MODE_CLASS, GET_MODE_INNER, GET_MODE_PRECISION(), GET_MODE_WIDER_MODE(), is_a(), known_lt, and VECTOR_MODE_P.
Referenced by convert_mult_to_widen(), convert_plusminus_to_widen(), and find_widening_optab_handler_and_mode().
|
static |
Return true if an instruction exists to access a field of mode FIELDMODE in a structure that has STRUCT_BITS significant bits. Describe the "best" such instruction in *INSN if so. PATTERN and TYPE describe the type of insertion or extraction we want to perform. For an insertion, the number of significant structure bits includes all bits of the target. For an extraction, it need only include the most significant bit of the field. Larger widths are acceptable in both cases.
References extraction_insn::field_mode, FOR_EACH_MODE_FROM, get_extraction_insn(), GET_MODE_SIZE(), maybe_gt, opt_mode< T >::require(), smallest_int_mode_for_size(), and TRULY_NOOP_TRUNCATION_MODES_P.
Referenced by get_best_mem_extraction_insn(), and get_best_reg_extraction_insn().
bool get_best_mem_extraction_insn | ( | extraction_insn * | insn, |
enum extraction_pattern | pattern, | ||
HOST_WIDE_INT | bitsize, | ||
HOST_WIDE_INT | bitnum, | ||
machine_mode | field_mode ) |
Return true if an instruction exists to access a field of BITSIZE bits starting BITNUM bits into a memory structure. Describe the "best" such instruction in *INSN if so. PATTERN describes the type of insertion or extraction we want to perform and FIELDMODE is the natural mode of the extracted field. The instructions considered here only access bytes that overlap the bitfield; they do not touch any surrounding bytes.
References ET_unaligned_mem, and get_best_extraction_insn().
Referenced by extract_integral_bit_field(), and store_integral_bit_field().
bool get_best_reg_extraction_insn | ( | extraction_insn * | insn, |
enum extraction_pattern | pattern, | ||
unsigned HOST_WIDE_INT | struct_bits, | ||
machine_mode | field_mode ) |
Return true if an instruction exists to access a field of mode FIELDMODE in a register structure that has STRUCT_BITS significant bits. Describe the "best" such instruction in *INSN if so. PATTERN describes the type of insertion or extraction we want to perform. For an insertion, the number of significant structure bits includes all bits of the target. For an extraction, it need only include the most significant bit of the field. Larger widths are acceptable in both cases.
References ET_reg, and get_best_extraction_insn().
Referenced by adjust_bit_field_mem_for_reg(), extract_integral_bit_field(), make_extraction(), and store_integral_bit_field().
|
static |
Return true if an instruction exists to perform an insertion or extraction (PATTERN says which) of type TYPE in mode MODE. Describe the instruction in *INSN if so.
References EP_extv, EP_extzv, EP_insv, gcc_unreachable, get_optab_extraction_insn(), get_traditional_extraction_insn(), and targetm.
Referenced by get_best_extraction_insn().
|
static |
Return true if an optab exists to perform an insertion or extraction of type TYPE in mode MODE. Describe the instruction in *INSN if so. REG_OPTAB is the optab to use for register structures and MISALIGN_OPTAB is the optab to use for misaligned memory structures. POS_OP is the operand number of the bit position.
References as_a(), direct_optab_handler(), ET_unaligned_mem, extraction_insn::field_mode, extraction_insn::icode, insn_data, operand_data::mode, data::operand, extraction_insn::pos_mode, extraction_insn::struct_mode, and word_mode.
Referenced by get_extraction_insn().
|
static |
Check whether insv, extv or extzv pattern ICODE can be used for an insertion or extraction of type TYPE on a structure of mode MODE. Return true if so and fill in *INSN accordingly. STRUCT_OP is the operand number of the structure (the first sign_extract or zero_extract operand) and FIELD_OP is the operand number of the field (the other side of the set from the sign_extract or zero_extract).
References as_a(), byte_mode, ET_unaligned_mem, extraction_insn::field_mode, extraction_insn::icode, insn_data, operand_data::mode, data::operand, extraction_insn::pos_mode, extraction_insn::struct_mode, and word_mode.
Referenced by get_extraction_insn().
Determine whether "1 << x" is relatively cheap in word_mode.
References const1_rtx, COSTS_N_INSNS, gen_raw_REG(), optab_handler(), set_src_cost(), and word_mode.
Referenced by optimize_range_tests().
opt_machine_mode qimode_for_vec_perm | ( | machine_mode | mode | ) |
If a target doesn't implement a permute on a vector with multibyte elements, we can try to do the same permute on byte elements. If this makes sense for vector mode MODE then return the appropriate byte vector mode.
References GET_MODE_INNER, GET_MODE_SIZE(), and related_vector_mode().
Referenced by can_vec_perm_const_p(), can_vec_perm_var_p(), expand_rotate_as_vec_perm(), expand_vec_perm_const(), and expand_vec_perm_var().
bool selector_fits_mode_p | ( | machine_mode | mode, |
const vec_perm_indices & | sel ) |
Return true if selector SEL can be represented in the integer equivalent of vector mode MODE.
References vec_perm_indices::all_in_range_p(), GET_MODE_INNER, GET_MODE_MASK, and HOST_WIDE_INT_M1U.
Referenced by can_vec_perm_const_p(), and expand_vec_perm_const().
If MODE is not VOIDmode, return true if vector conversion optab OP supports that mode, given that the second mode is always an integer vector. If MODE is VOIDmode, return true if OP supports any vector mode.
References convert_optab_handler(), end(), i, and VECTOR_MODE_P.
Referenced by supports_vec_gather_load_p(), and supports_vec_scatter_store_p().
bool supports_vec_gather_load_p | ( | machine_mode | mode | ) |
If MODE is not VOIDmode, return true if vec_gather_load is available for that mode. If MODE is VOIDmode, return true if gather_load is available for at least one vector mode.
References supports_vec_convert_optab_p(), and this_fn_optabs.
Referenced by vect_check_gather_scatter().
bool supports_vec_scatter_store_p | ( | machine_mode | mode | ) |
If MODE is not VOIDmode, return true if vec_scatter_store is available for that mode. If MODE is VOIDmode, return true if scatter_store is available for at least one vector mode.
References supports_vec_convert_optab_p(), and this_fn_optabs.
Referenced by vect_check_gather_scatter().
struct target_optabs default_target_optabs |
IR-agnostic target query functions relating to optabs 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/>.
struct target_optabs* this_fn_optabs = &default_target_optabs |