diff options
author | nemet <nemet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-11 17:31:09 +0000 |
---|---|---|
committer | nemet <nemet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-11 17:31:09 +0000 |
commit | d16b48d51064e73ea2141a4eaec1c56c3a6c307c (patch) | |
tree | 3685d54374ef0fee2a34f53968de7c8ccad1f008 /gcc/rtlanal.c | |
parent | 4c95716b8debe80d5b80d23c5e1e3db79b23d9a5 (diff) | |
download | gcc-d16b48d51064e73ea2141a4eaec1c56c3a6c307c.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150656 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r-- | gcc/rtlanal.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 49289b65c37..aebcfa66904 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); +} |