GCC Middle and Back End API Reference
hwint.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
Include dependency graph for hwint.cc:

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)
 

Function Documentation

◆ ceil_log2()

◆ clz_hwi()

int clz_hwi ( unsigned HOST_WIDE_INT x)
Similarly for most significant bits.   

References floor_log2(), and HOST_BITS_PER_WIDE_INT.

Referenced by wi::clrsb(), wi::clz(), divmod_internal_2(), int_loc_descriptor(), and size_of_int_loc_descriptor().

◆ ctz_hwi()

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 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(), and tree_ctz().

◆ exact_log2()

int exact_log2 ( unsigned HOST_WIDE_INT x)

◆ ffs_hwi()

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().

◆ floor_log2()

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(), 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().

◆ gcd()

◆ least_common_multiple()

◆ mul_hwi()

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().

◆ popcount_hwi()

int popcount_hwi ( unsigned HOST_WIDE_INT x)
Return the number of set bits in X.   

References CHAR_BIT, ggc_alloc(), and i.

Referenced by get_nearest_type_subqualifiers(), double_int::popcount(), condition_info::popcount(), and wi::popcount().

◆ pos_mul_hwi()

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().