diff options
author | John Wehle <john@feith.com> | 2000-02-18 06:32:01 +0000 |
---|---|---|
committer | John Wehle <wehle@gcc.gnu.org> | 2000-02-18 06:32:01 +0000 |
commit | a49a6a680068d483645cbc0f63975760b5d57886 (patch) | |
tree | 3c30c190987a1ec418bb165199041649c8b305e1 /gcc/tree.c | |
parent | 930b1f40d0f3b4ad09d916f2a6da33f9d20dfad9 (diff) | |
download | gcc-a49a6a680068d483645cbc0f63975760b5d57886.zip gcc-a49a6a680068d483645cbc0f63975760b5d57886.tar.gz gcc-a49a6a680068d483645cbc0f63975760b5d57886.tar.bz2 |
loop.c (canonicalize_condition): New function, broken out of get_condition.
* loop.c (canonicalize_condition): New function,
broken out of get_condition.
(get_condition): Use it.
* expr.h (canonicalize_condition): Prototype it.
* tree.h (tree_int_cst_msb): Declare.
* tree.c (tree_int_cst_msb): New function.
From-SVN: r32045
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -4062,6 +4062,24 @@ tree_int_cst_lt (t1, t2) return INT_CST_LT_UNSIGNED (t1, t2); } +/* Return the most significant bit of the integer constant T. */ + +int +tree_int_cst_msb (t) + tree t; +{ + register int prec; + HOST_WIDE_INT h; + HOST_WIDE_INT l; + + /* Note that using TYPE_PRECISION here is wrong. We care about the + actual bits, not the (arbitrary) range of the type. */ + prec = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (t))) - 1; + rshift_double (TREE_INT_CST_LOW (t), TREE_INT_CST_HIGH (t), prec, + 2 * HOST_BITS_PER_WIDE_INT, &l, &h, 0); + return (l & 1) == 1; + } + /* Return an indication of the sign of the integer constant T. The return value is -1 if T < 0, 0 if T == 0, and 1 if T > 0. Note that -1 will never be returned it T's type is unsigned. */ |