GCC Middle and Back End API Reference
|
Functions | |
int | floor_log2 (unsigned HOST_WIDE_INT x) |
int | ceil_log2 (unsigned HOST_WIDE_INT x) |
int | exact_log2 (unsigned HOST_WIDE_INT x) |
int | ctz_hwi (unsigned HOST_WIDE_INT x) |
int | clz_hwi (unsigned HOST_WIDE_INT x) |
int | ffs_hwi (unsigned HOST_WIDE_INT x) |
int | popcount_hwi (unsigned HOST_WIDE_INT x) |
HOST_WIDE_INT | gcd (HOST_WIDE_INT a, HOST_WIDE_INT b) |
HOST_WIDE_INT | pos_mul_hwi (HOST_WIDE_INT x, HOST_WIDE_INT y) |
HOST_WIDE_INT | mul_hwi (HOST_WIDE_INT x, HOST_WIDE_INT y) |
HOST_WIDE_INT | least_common_multiple (HOST_WIDE_INT a, HOST_WIDE_INT b) |
unsigned HOST_WIDE_INT | reflect_hwi (unsigned HOST_WIDE_INT value, unsigned bitwidth) |
int ceil_log2 | ( | unsigned HOST_WIDE_INT | x | ) |
Given X, an unsigned number, return the least Y such that 2**Y >= X.
References floor_log2().
Referenced by alloc_use_cost_map(), bp_pack_machine_mode(), choose_multiplier(), ctf_add_encoded(), ctf_add_slice(), define_builtin_macros_for_type_sizes(), tree_switch_conversion::switch_decision_tree::emit(), get_group_load_store_type(), ideal_phi_node_len(), lower_omp_target(), lto_write_mode_table(), vect_element_precision(), vect_lower_load_permutations(), vect_truncate_gather_scatter_offset(), vectorizable_load(), and vectorizable_store().
int clz_hwi | ( | unsigned HOST_WIDE_INT | x | ) |
Similarly for most significant bits.
References floor_log2(), and HOST_BITS_PER_WIDE_INT.
Referenced by carry_backpropagate(), wi::clrsb(), wi::clz(), divmod_internal_2(), int_loc_descriptor(), and size_of_int_loc_descriptor().
int ctz_hwi | ( | unsigned HOST_WIDE_INT | x | ) |
Given X, an unsigned number, return the number of least significant bits that are zero. When X == 0, the result is the word size.
References floor_log2(), HOST_BITS_PER_WIDE_INT, and least_bit_hwi().
Referenced by carry_backpropagate(), wi::ctz(), expand_doubleword_divmod(), force_reg(), get_pos_from_mask(), int_loc_descriptor(), ira_object_conflict_iter_cond(), minmax_set_iter_cond(), size_of_int_loc_descriptor(), synth_mult(), double_int::trailing_zeros(), tree_ctz(), and vect_lower_load_permutations().
int exact_log2 | ( | unsigned HOST_WIDE_INT | x | ) |
Return the logarithm of X, base 2, considering X unsigned, if X is a power of 2. Otherwise, returns -1.
References floor_log2(), and pow2p_hwi().
Referenced by tree_vector_builder::build(), calculate_table_based_CRC(), canonicalize_reload_addr(), carry_backpropagate(), check_func(), combine_simplify_rtx(), debug_set_to_format(), dump_generic_node(), encode_lfs(), wi::exact_log2(), expand_ifn_atomic_compare_exchange_into_call(), expand_omp_atomic(), expand_vec_perm_var(), ext_dce_process_sets(), final_addr_vec_align(), final_scan_insn_1(), find_split_point(), force_int_to_mode(), get_misalign_in_elems(), get_pos_from_mask(), get_required_cycles(), get_shiftadd_cost(), get_ubsan_type_info_for_type(), group_limit(), hwasan_check_func(), init_ggc(), int_loc_descriptor(), interpret_rhs_expr(), loc_list_from_tree_1(), low_bitmask_len(), make_compound_operation_int(), make_extraction(), noce_try_store_flag_constants(), report_error_func(), scan_store_can_perm_p(), SET_TYPE_VECTOR_SUBPARTS(), simd_clone_adjust(), simplify_and_const_int_1(), simplify_context::simplify_binary_operation_1(), simplify_comparison(), simplify_if_then_else(), simplify_shift_const_1(), synth_mult(), try_combine(), vect_create_epilog_for_reduction(), vect_gen_vector_loop_niters(), vect_gen_vector_loop_niters_mult_vf(), vect_grouped_load_supported(), vect_grouped_store_supported(), vect_lower_load_permutations(), vect_model_reduction_cost(), vect_need_peeling_or_partial_vectors_p(), vect_permute_load_chain(), vect_permute_store_chain(), vect_shift_permute_load_chain(), and vectorizable_simd_clone_call().
int ffs_hwi | ( | unsigned HOST_WIDE_INT | x | ) |
Similar to ctz_hwi, except that the least significant bit is numbered starting from 1, and X == 0 yields 0.
References floor_log2(), and least_bit_hwi().
Referenced by auto_flag< T >::auto_flag(), build_printable_array_type(), ctz_or_zero(), and layout_type().
int floor_log2 | ( | unsigned HOST_WIDE_INT | x | ) |
Operations on HOST_WIDE_INT. 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/>.
The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2, ceil_log2, and exact_log2 are defined as inline functions in hwint.h if GCC_VERSION >= 3004. The definitions here are used for older versions of GCC and non-GCC bootstrap compilers.
Given X, an unsigned number, return the largest int Y such that 2**Y <= X. If X is 0, return -1.
References HOST_BITS_PER_WIDE_INT, and HOST_WIDE_INT_1U.
Referenced by asan_emit_stack_protection(), assemble_align(), assemble_start_function(), assemble_trampoline_template(), assemble_variable(), bp_pack_int_in_range(), bp_unpack_int_in_range(), carry_backpropagate(), ceil_log2(), clz_hwi(), constant_size(), ctz_hwi(), estimate_num_insns(), exact_log2(), expand_divmod(), expand_mult(), expand_sdiv_pow2(), expand_smod_pow2(), expand_vector_divmod(), expand_widening_mult(), extended_count(), ffs_hwi(), force_int_to_mode(), get_required_cycles(), get_vectype_for_scalar_type(), nonzero_bits1(), sreal::normalize_down(), sreal::normalize_up(), num_sign_bit_copies1(), optimize_constant_pool(), output_call_frame_info(), output_constant_def_contents(), output_fde(), profile_function(), read_log_maxskip(), real_to_decimal_for_mode(), setup_allocno_priorities(), simplify_rotate(), switch_to_eh_frame_section(), synth_mult(), try_store_by_multiple_pieces(), vect_build_slp_instance(), vectorizable_bb_reduc_epilogue(), and vectorizable_simd_clone_call().
HOST_WIDE_INT gcd | ( | HOST_WIDE_INT | a, |
HOST_WIDE_INT | b ) |
Compute the greatest common divisor of two numbers A and B using Euclid's algorithm.
References a, abs_hwi(), b, and y.
Referenced by add_multivariate_self_dist(), compute_overlap_steps_for_affine_univar(), determine_unroll_factor(), gcd_of_steps_may_divide_p(), lambda_vector_gcd(), least_common_multiple(), process_command(), vectorizable_load(), and vectorizable_store().
HOST_WIDE_INT least_common_multiple | ( | HOST_WIDE_INT | a, |
HOST_WIDE_INT | b ) |
Compute the least common multiple of two numbers A and B .
References a, abs_hwi(), b, gcd(), and mul_hwi().
Referenced by vector_builder< T, Shape, Derived >::binary_encoded_nelts(), determine_unroll_factor(), fold_view_convert_vector_encoding(), vector_builder< T, Shape, Derived >::new_binary_operation(), vec_perm_indices::series_p(), simplify_const_vector_byte_offset(), simplify_const_vector_subreg(), vect_create_epilog_for_reduction(), and vectorizable_induction().
HOST_WIDE_INT mul_hwi | ( | HOST_WIDE_INT | x, |
HOST_WIDE_INT | y ) |
Return X multiplied by Y and check that the result does not overflow.
References gcc_checking_assert, HOST_WIDE_INT_MIN, pos_mul_hwi(), and y.
Referenced by lambda_matrix_row_add(), and least_common_multiple().
int popcount_hwi | ( | unsigned HOST_WIDE_INT | x | ) |
Return the number of set bits in X.
Referenced by get_nearest_type_subqualifiers(), condition_info::popcount(), double_int::popcount(), and wi::popcount().
HOST_WIDE_INT pos_mul_hwi | ( | HOST_WIDE_INT | x, |
HOST_WIDE_INT | y ) |
For X and Y positive integers, return X multiplied by Y and check that the result does not overflow.
References gcc_checking_assert, HOST_WIDE_INT_MAX, and y.
Referenced by mul_hwi().
unsigned HOST_WIDE_INT reflect_hwi | ( | unsigned HOST_WIDE_INT | value, |
unsigned | bitwidth ) |
Reflect (reverse) the bits of a given VALUE within a specified BITWIDTH.
References i.