diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-25 11:35:38 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-25 11:35:38 +0000 |
commit | 27d5d67b8f75a6ecb0ab168cf63ba85dc95fc924 (patch) | |
tree | 2c516d8bbd1d94a9cea0ff4574eb770c8f256524 /gcc/double-int.c | |
parent | 7064cb7f2cfc2d2f8e6c60f9ff17b84c4f3afa30 (diff) | |
download | gcc-27d5d67b8f75a6ecb0ab168cf63ba85dc95fc924.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186816 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/double-int.c')
-rw-r--r-- | gcc/double-int.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/double-int.c b/gcc/double-int.c index d0fde0ed89f..3a51bd35d00 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. |