GCC Middle and Back End API Reference
hwint.c File Reference

Functions

int floor_log2 ()
int ceil_log2 ()
int exact_log2 ()
int ctz_hwi ()
int clz_hwi ()
int ffs_hwi ()
int popcount_hwi ()
HOST_WIDE_INT abs_hwi ()
unsigned HOST_WIDE_INT absu_hwi ()
HOST_WIDE_INT gcd ()
HOST_WIDE_INT pos_mul_hwi ()
HOST_WIDE_INT mul_hwi ()
HOST_WIDE_INT least_common_multiple ()

Function Documentation

HOST_WIDE_INT abs_hwi ( )
   Compute the absolute value of X.  

References HOST_WIDE_INT.

unsigned HOST_WIDE_INT absu_hwi ( )
   Compute the absolute value of X as an unsigned type.  

Referenced by double_int::lshift(), double_int::rshift(), double_int::trailing_zeros(), and vect_find_same_alignment_drs().

int ceil_log2 ( )
   Given X, an unsigned number, return the largest Y such that 2**Y >= X.  

References floor_log2().

int clz_hwi ( )
   Similarly for most significant bits.  

References floor_log2().

int ctz_hwi ( )
   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(), and HOST_BITS_PER_WIDE_INT.

Referenced by fold_builtin_cbrt(), force_reg(), simplify_const_unary_operation(), and double_int::udiv().

int exact_log2 ( )
   Return the logarithm of X, base 2, considering X unsigned,
   if X is a power of 2.  Otherwise, returns -1.  

Referenced by find_insert_point(), find_loop_location(), make_extraction(), simplify_and_const_int_1(), vect_do_peeling_for_loop_bound(), vect_find_same_alignment_drs(), vect_get_store_cost(), and vect_model_store_cost().

int ffs_hwi ( )
   Similar to ctz_hwi, except that the least significant bit is numbered
   starting from 1, and X == 0 yields 0.  

Referenced by fold_builtin_cbrt(), and simplify_const_unary_operation().

int floor_log2 ( )
@verbatim 

Operations on HOST_WIDE_INT. Copyright (C) 1987-2013 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.  

Referenced by bp_pack_int_in_range(), cached_num_sign_bit_copies(), ceil_log2(), clz_hwi(), ctz_hwi(), expand_mult(), expand_mult_highpart_adjust(), final_start_function(), fold_builtin_cbrt(), gcov_time(), get_named_section(), push_allocnos_to_stack(), simplify_const_unary_operation(), simplify_rotate(), and streamer_read_hwi_in_range().

HOST_WIDE_INT gcd ( )
   Compute the greatest common divisor of two numbers A and B using
   Euclid's algorithm.  

Referenced by normalize_omega_problem(), and omega_solve_eq().

HOST_WIDE_INT least_common_multiple ( )
   Compute the least common multiple of two numbers A and B .  

Referenced by may_use_storent_in_loop_p(), and vect_build_slp_tree_1().

HOST_WIDE_INT mul_hwi ( )
   Return X multiplied by Y and check that the result does not
   overflow.  
int popcount_hwi ( )
   Return the number of set bits in X.  
HOST_WIDE_INT pos_mul_hwi ( )
   For X and Y positive integers, return X multiplied by Y and check
   that the result does not overflow.  

References HOST_WIDE_INT_MIN.