aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtlanal.c
diff options
context:
space:
mode:
authorAdam Nemet <anemet@caviumnetworks.com>2009-08-11 17:31:09 +0000
committerAdam Nemet <nemet@gcc.gnu.org>2009-08-11 17:31:09 +0000
commit842e098c5ff56730b4d84d5560eb4053a12ebd61 (patch)
tree3685d54374ef0fee2a34f53968de7c8ccad1f008 /gcc/rtlanal.c
parentc53c2591f607409e311a2b319d95d17ea336a836 (diff)
downloadgcc-842e098c5ff56730b4d84d5560eb4053a12ebd61.zip
gcc-842e098c5ff56730b4d84d5560eb4053a12ebd61.tar.gz
gcc-842e098c5ff56730b4d84d5560eb4053a12ebd61.tar.bz2
combine.c (try_widen_shift_mode): Factor out code to check if an integer constant is a low-order bitmask from here ...
* combine.c (try_widen_shift_mode): Factor out code to check if an integer constant is a low-order bitmask from here ... * rtlanal.c (low_bitmask_len): ... to here. * rtl.h (low_bitmask_len): Declare. From-SVN: r150656
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r--gcc/rtlanal.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 49289b6..aebcfa6 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5032,3 +5032,20 @@ constant_pool_constant_p (rtx x)
x = avoid_constant_pool_reference (x);
return GET_CODE (x) == CONST_DOUBLE;
}
+
+/* If M is a bitmask that selects a field of low-order bits within an item but
+ not the entire word, return the length of the field. Return -1 otherwise.
+ M is used in machine mode MODE. */
+
+int
+low_bitmask_len (enum machine_mode mode, unsigned HOST_WIDE_INT m)
+{
+ if (mode != VOIDmode)
+ {
+ if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT)
+ return -1;
+ m &= GET_MODE_MASK (mode);
+ }
+
+ return exact_log2 (m + 1);
+}