aboutsummaryrefslogtreecommitdiff
path: root/gcc/double-int.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-04-25 13:35:38 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2012-04-25 13:35:38 +0200
commit0ea62d936f1915759660b1a4e6ed124f73ac37ee (patch)
tree2c516d8bbd1d94a9cea0ff4574eb770c8f256524 /gcc/double-int.c
parent228f466fd61238fb74283b6b7d85cba483ce51ef (diff)
downloadgcc-0ea62d936f1915759660b1a4e6ed124f73ac37ee.zip
gcc-0ea62d936f1915759660b1a4e6ed124f73ac37ee.tar.gz
gcc-0ea62d936f1915759660b1a4e6ed124f73ac37ee.tar.bz2
re PR tree-optimization/53058 (Another ice in remove_range_assertions)
PR tree-optimization/53058 * double-int.h (double_int_max_value, double_int_min_value): New prototypes. * double-int.c (double_int_max_value, double_int_min_value): New functions. * tree-vrp.c (register_edge_assert_for_2): Compare mask for LE_EXPR or GT_EXPR with double_int_max_value instead of double_int_mask. * gcc.c-torture/compile/pr53058.c: New test. From-SVN: r186816
Diffstat (limited to 'gcc/double-int.c')
-rw-r--r--gcc/double-int.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/double-int.c b/gcc/double-int.c
index d0fde0e..3a51bd3 100644
--- a/gcc/double-int.c
+++ b/gcc/double-int.c
@@ -1,5 +1,5 @@
/* Operations with long integers.
- Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -616,6 +616,26 @@ double_int_mask (unsigned prec)
return mask;
}
+/* Returns a maximum value for signed or unsigned integer
+ of precision PREC. */
+
+double_int
+double_int_max_value (unsigned int prec, bool uns)
+{
+ return double_int_mask (prec - (uns ? 0 : 1));
+}
+
+/* Returns a minimum value for signed or unsigned integer
+ of precision PREC. */
+
+double_int
+double_int_min_value (unsigned int prec, bool uns)
+{
+ if (uns)
+ return double_int_zero;
+ return double_int_lshift (double_int_one, prec - 1, prec, false);
+}
+
/* Clears the bits of CST over the precision PREC. If UNS is false, the bits
outside of the precision are set to the sign bit (i.e., the PREC-th one),
otherwise they are set to zero.