Lines Matching refs:wi
76 wi::leu_p (a, b) as a more efficient short-hand for
156 wi::to_wide (t) // Treat T as a wide_int
157 wi::to_offset (t) // Treat T as an offset_int
158 wi::to_widest (t) // Treat T as a widest_int
164 wi::tree_to_wide_ref twide = wi::to_wide (t);
165 wi::tree_to_offset_ref toffset = wi::to_offset (t);
166 wi::tree_to_widest_ref twidest = wi::to_widest (t);
177 wide_int x = wi::shwi (c, prec); // sign-extend C if necessary
178 wide_int y = wi::uhwi (c, prec); // zero-extend C if necessary
189 wi::add (r1, r2); // add equal-sized rtx_mode_ts r1 and r2
190 wi::add (r1, 1); // add 1 to rtx_mode_t r1
191 wi::lshift (1, 100); // 1 << 100 as a widest_int
226 The inputs to comparison functions like wi::eq_p and wi::lts_p
270 typename wi::binary_traits <T1, T2>::result_type
275 typename wi::binary_traits <T1, T2>::operator_result
280 typename wi::binary_traits <T1, T2>::signed_shift_result_type
286 typename wi::binary_traits <T1, T2>::predicate_result
292 typename wi::binary_traits <T1, T2>::signed_predicate_result
296 typename wi::binary_traits <T, T>::result_type
305 wi::int_traits <WI_BINARY_RESULT (T1, T2)>::get_binary_result (X, Y); \
311 wi::int_traits <WI_UNARY_RESULT (T)>::get_binary_result (X, X); \
329 /* wi::storage_ref can be a reference to a primitive type,
345 <wide_int_ref_storage <wi::int_traits <T>::is_sign_extended, \
346 wi::int_traits <T>::host_dependent_precision> >
348 namespace wi
352 an unsigned int is 0 and does not overflow in C/C++, but wi::add
398 static wi::storage_ref *decompose (HOST_WIDE_INT *scratch,
401 wi::storage_ref. SCRATCH is available as scratch space if needed.
490 namespace wi
641 namespace wi
663 inline::wi::storage_ref::storage_ref (const HOST_WIDE_INT *val_in,
671 wi::storage_ref::get_len () const
677 wi::storage_ref::get_precision () const
683 wi::storage_ref::get_val () const
744 generic_wide_int &OP (const T &c) { return (*this = wi::F (*this, c)); }
773 = wi::int_traits <generic_wide_int <storage> >::is_sign_extended;
958 namespace wi
962 : public wi::int_traits <storage>
965 static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
972 wi::int_traits < generic_wide_int <storage> >::
979 inline wi::storage_ref
980 wi::int_traits < generic_wide_int <storage> >::
985 return wi::storage_ref (x.get_val (), x.get_len (), precision);
992 class wide_int_ref_storage : public wi::storage_ref
1002 wide_int_ref_storage (const wi::storage_ref &);
1014 wide_int_ref_storage (const wi::storage_ref &x)
1024 : storage_ref (wi::int_traits <T>::decompose (scratch,
1025 wi::get_precision (x), x))
1034 : storage_ref (wi::int_traits <T>::decompose (scratch, precision, x))
1038 namespace wi
1049 namespace wi
1090 namespace wi
1113 { STATIC_ASSERT (!wi::int_traits<T>::host_dependent_precision); }
1114 { STATIC_ASSERT (wi::int_traits<T>::precision_type != wi::CONST_PRECISION); }
1117 wi::copy (*this, xi);
1124 { STATIC_ASSERT (!wi::int_traits<T>::host_dependent_precision); }
1125 { STATIC_ASSERT (wi::int_traits<T>::precision_type != wi::CONST_PRECISION); }
1128 wi::copy (*this, xi);
1172 result.set_len (wi::force_to_size (result.write_val (), x.val, x.len,
1185 result.set_len (wi::from_array (result.write_val (), val, len, precision,
1201 wi::int_traits <wide_int_storage>::get_binary_result (const T1 &x, const T2 &y)
1204 STATIC_ASSERT (wi::int_traits <T1>::precision_type != FLEXIBLE_PRECISION
1205 || wi::int_traits <T2>::precision_type != FLEXIBLE_PRECISION);
1206 if (wi::int_traits <T1>::precision_type == FLEXIBLE_PRECISION)
1207 return wide_int::create (wi::get_precision (y));
1209 return wide_int::create (wi::get_precision (x));
1237 namespace wi
1262 wi::copy (*this, WIDE_INT_REF_FOR (T) (x, N));
1308 result.set_len (wi::force_to_size (result.write_val (), x.val, x.len,
1323 result.set_len (wi::from_array (result.write_val (), val, len,
1331 wi::int_traits < fixed_wide_int_storage <N> >::
1369 namespace wi
1455 wi::copy (*this, xi);
1483 return wi::storage_ref (&m_val[index * m_max_len],
1505 namespace wi
1515 static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int, T);
1521 wi::primitive_int_traits <T, signed_p>::get_precision (T)
1527 inline wi::storage_ref
1528 wi::primitive_int_traits <T, signed_p>::decompose (HOST_WIDE_INT *scratch,
1533 return wi::storage_ref (scratch, 1, precision);
1535 return wi::storage_ref (scratch, 2, precision);
1538 /* Allow primitive C types to be used in wi:: routines. */
1539 namespace wi
1576 namespace wi
1599 inline wi::hwi_with_prec::hwi_with_prec (HOST_WIDE_INT v, unsigned int p,
1610 inline wi::hwi_with_prec
1611 wi::shwi (HOST_WIDE_INT val, unsigned int precision)
1617 inline wi::hwi_with_prec
1618 wi::uhwi (unsigned HOST_WIDE_INT val, unsigned int precision)
1624 inline wi::hwi_with_prec
1625 wi::minus_one (unsigned int precision)
1627 return wi::shwi (-1, precision);
1631 inline wi::hwi_with_prec
1632 wi::zero (unsigned int precision)
1634 return wi::shwi (0, precision);
1638 inline wi::hwi_with_prec
1639 wi::one (unsigned int precision)
1641 return wi::shwi (1, precision);
1645 inline wi::hwi_with_prec
1646 wi::two (unsigned int precision)
1648 return wi::shwi (2, precision);
1651 namespace wi
1669 inline wi::hwi_with_prec
1670 wi::ints_for<T, wi::VAR_PRECISION>::zero (const T &x)
1672 return wi::zero (wi::get_precision (x));
1675 namespace wi
1678 struct int_traits <wi::hwi_with_prec>
1685 static unsigned int get_precision (const wi::hwi_with_prec &);
1686 static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
1687 const wi::hwi_with_prec &);
1692 wi::int_traits <wi::hwi_with_prec>::get_precision (const wi::hwi_with_prec &x)
1697 inline wi::storage_ref
1698 wi::int_traits <wi::hwi_with_prec>::
1700 const wi::hwi_with_prec &x)
1705 return wi::storage_ref (scratch, 1, precision);
1707 return wi::storage_ref (scratch, 2, precision);
1715 namespace wi
1776 wi::get_precision (const T &x)
1778 return wi::int_traits <T>::get_precision (x);
1785 wi::get_binary_precision (const T1 &x, const T2 &y)
1787 return get_precision (wi::int_traits <WI_BINARY_RESULT (T1, T2)>::
1794 wi::copy (T1 &x, const T2 &y)
1809 wi::fits_shwi_p (const T &x)
1819 wi::fits_uhwi_p (const T &x)
1833 wi::neg_p (const T &x, signop sgn)
1844 wi::sign_mask (const T &x)
1853 wi::eq_p (const T1 &x, const T2 &y)
1892 wi::ne_p (const T1 &x, const T2 &y)
1900 wi::lts_p (const T1 &x, const T2 &y)
1906 if (wi::fits_shwi_p (yi))
1908 /* Make lts_p (x, 0) as efficient as wi::neg_p (x). */
1912 if (wi::fits_shwi_p (xi))
1933 wi::ltu_p (const T1 &x, const T2 &y)
1958 wi::lt_p (const T1 &x, const T2 &y, signop sgn)
1969 wi::les_p (const T1 &x, const T2 &y)
1977 wi::leu_p (const T1 &x, const T2 &y)
1985 wi::le_p (const T1 &x, const T2 &y, signop sgn)
1996 wi::gts_p (const T1 &x, const T2 &y)
2004 wi::gtu_p (const T1 &x, const T2 &y)
2012 wi::gt_p (const T1 &x, const T2 &y, signop sgn)
2023 wi::ges_p (const T1 &x, const T2 &y)
2031 wi::geu_p (const T1 &x, const T2 &y)
2039 wi::ge_p (const T1 &x, const T2 &y, signop sgn)
2051 wi::cmps (const T1 &x, const T2 &y)
2056 if (wi::fits_shwi_p (yi))
2062 if (wi::fits_shwi_p (xi))
2088 wi::cmpu (const T1 &x, const T2 &y)
2130 wi::cmp (const T1 &x, const T2 &y, signop sgn)
2141 wi::bit_not (const T &x)
2154 wi::neg (const T &x)
2163 wi::neg (const T &x, overflow_type *overflow)
2172 wi::abs (const T &x)
2180 wi::sext (const T &x, unsigned int offset)
2199 wi::zext (const T &x, unsigned int offset)
2209 wi::copy (result, xi);
2229 wi::ext (const T &x, unsigned int offset, signop sgn)
2237 wi::set_bit (const T &x, unsigned int bit)
2256 wi::min (const T1 &x, const T2 &y, signop sgn)
2260 if (wi::le_p (x, y, sgn))
2261 wi::copy (result, WIDE_INT_REF_FOR (T1) (x, precision));
2263 wi::copy (result, WIDE_INT_REF_FOR (T2) (y, precision));
2270 wi::smin (const T1 &x, const T2 &y)
2272 return wi::min (x, y, SIGNED);
2278 wi::umin (const T1 &x, const T2 &y)
2280 return wi::min (x, y, UNSIGNED);
2287 wi::max (const T1 &x, const T2 &y, signop sgn)
2291 if (wi::ge_p (x, y, sgn))
2292 wi::copy (result, WIDE_INT_REF_FOR (T1) (x, precision));
2294 wi::copy (result, WIDE_INT_REF_FOR (T2) (y, precision));
2301 wi::smax (const T1 &x, const T2 &y)
2303 return wi::max (x, y, SIGNED);
2309 wi::umax (const T1 &x, const T2 &y)
2311 return wi::max (x, y, UNSIGNED);
2317 wi::bit_and (const T1 &x, const T2 &y)
2338 wi::bit_and_not (const T1 &x, const T2 &y)
2359 wi::bit_or (const T1 &x, const T2 &y)
2380 wi::bit_or_not (const T1 &x, const T2 &y)
2401 wi::bit_xor (const T1 &x, const T2 &y)
2422 wi::add (const T1 &x, const T2 &y)
2465 wi::add (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2508 wi::sub (const T1 &x, const T2 &y)
2551 wi::sub (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2593 wi::mul (const T1 &x, const T2 &y)
2614 wi::mul (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2630 wi::smul (const T1 &x, const T2 &y, overflow_type *overflow)
2639 wi::umul (const T1 &x, const T2 &y, overflow_type *overflow)
2648 wi::mul_high (const T1 &x, const T2 &y, signop sgn)
2665 wi::div_trunc (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2682 wi::sdiv_trunc (const T1 &x, const T2 &y)
2690 wi::udiv_trunc (const T1 &x, const T2 &y)
2700 wi::div_floor (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2715 if (wi::neg_p (x, sgn) != wi::neg_p (y, sgn) && remainder != 0)
2723 wi::sdiv_floor (const T1 &x, const T2 &y)
2732 wi::udiv_floor (const T1 &x, const T2 &y)
2742 wi::div_ceil (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2757 if (wi::neg_p (x, sgn) == wi::neg_p (y, sgn) && remainder != 0)
2765 wi::udiv_ceil (const T1 &x, const T2 &y)
2775 wi::div_round (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2795 WI_BINARY_RESULT (T1, T2) abs_remainder = wi::abs (remainder);
2796 if (wi::geu_p (abs_remainder, wi::sub (wi::abs (y), abs_remainder)))
2798 if (wi::neg_p (x, sgn) != wi::neg_p (y, sgn))
2806 if (wi::geu_p (remainder, wi::sub (y, remainder)))
2817 wi::divmod_trunc (const T1 &x, const T2 &y, signop sgn,
2841 wi::gcd (const T1 &a, const T2 &b, signop sgn)
2845 x = wi::abs (a);
2846 y = wi::abs (b);
2863 wi::mod_trunc (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2883 wi::smod_trunc (const T1 &x, const T2 &y)
2892 wi::umod_trunc (const T1 &x, const T2 &y)
2902 wi::mod_floor (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2918 if (wi::neg_p (x, sgn) != wi::neg_p (y, sgn) && remainder != 0)
2928 wi::umod_floor (const T1 &x, const T2 &y)
2938 wi::mod_ceil (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2954 if (wi::neg_p (x, sgn) == wi::neg_p (y, sgn) && remainder != 0)
2964 wi::mod_round (const T1 &x, const T2 &y, signop sgn, overflow_type *overflow)
2984 WI_BINARY_RESULT (T1, T2) abs_remainder = wi::abs (remainder);
2985 if (wi::geu_p (abs_remainder, wi::sub (wi::abs (y), abs_remainder)))
2987 if (wi::neg_p (x, sgn) != wi::neg_p (y, sgn))
2995 if (wi::geu_p (remainder, wi::sub (y, remainder)))
3006 wi::multiple_of_p (const T1 &x, const T2 &y, signop sgn)
3008 return wi::mod_trunc (x, y, sgn) == 0;
3015 wi::multiple_of_p (const T1 &x, const T2 &y, signop sgn,
3033 wi::lshift (const T1 &x, const T2 &y)
3076 wi::lrshift (const T1 &x, const T2 &y)
3120 wi::arshift (const T1 &x, const T2 &y)
3152 wi::rshift (const T1 &x, const T2 &y, signop sgn)
3165 wi::lrotate (const T1 &x, const T2 &y, unsigned int width)
3171 WI_UNARY_RESULT (T1) left = wi::lshift (x, ymod);
3173 = wi::lrshift (width != precision ? wi::zext (x, width) : x,
3174 wi::sub (width, ymod));
3176 return wi::zext (left, width) | right;
3185 wi::rrotate (const T1 &x, const T2 &y, unsigned int width)
3192 = wi::lrshift (width != precision ? wi::zext (x, width) : x, ymod);
3193 WI_UNARY_RESULT (T1) left = wi::lshift (x, wi::sub (width, ymod));
3195 return wi::zext (left, width) | right;
3202 wi::parity (const wide_int_ref &x)
3210 wi::extract_uhwi (const T &x, unsigned int bitpos, unsigned int width)
3237 wi::min_precision (const T &x, signop sgn)
3250 return wi::F (x, y); \
3265 return wi::F (x); \
3273 return wi::F (x, y); \
3281 return wi::F (x, y); \
3289 return wi::F (x, y); \
3313 return wi::arshift (x, y);
3320 return wi::sdiv_trunc (x, y);
3327 return wi::smod_trunc (x, y);
3366 namespace wi
3418 wi::mask (unsigned int width, bool negate_p, unsigned int precision)
3429 wi::shifted_mask (unsigned int start, unsigned int width, bool negate_p,
3441 wi::set_bit_in_zero (unsigned int bit, unsigned int precision)
3450 wi::mask (unsigned int width, bool negate_p)
3452 STATIC_ASSERT (wi::int_traits<T>::precision);
3455 wi::int_traits <T>::precision));
3464 wi::shifted_mask (unsigned int start, unsigned int width, bool negate_p)
3466 STATIC_ASSERT (wi::int_traits<T>::precision);
3470 wi::int_traits <T>::precision));
3478 wi::set_bit_in_zero (unsigned int bit)
3486 wi::accumulate_overflow (wi::overflow_type &overflow,
3487 wi::overflow_type suboverflow)
3494 overflow = wi::OVF_UNKNOWN;