/* An bitmask as wide as the number of bytes in the word that
contains a 1 if the byte may be needed. The store is unused if
all of the bits are 0. */
- long positions_needed;
+ unsigned HOST_WIDE_INT positions_needed;
/* The next store info for this insn. */
struct store_info *next;
rtx rhs;
};
+/* Return a bitmask with the first N low bits set. */
+
+static unsigned HOST_WIDE_INT
+lowpart_bitmask (int n)
+{
+ unsigned HOST_WIDE_INT mask = ~(unsigned HOST_WIDE_INT) 0;
+ return mask >> (HOST_BITS_PER_WIDE_INT - n);
+}
+
typedef struct store_info *store_info_t;
static alloc_pool cse_store_info_pool;
static alloc_pool rtx_store_info_pool;
&& (GET_MODE (mem) == entry->mode))
{
delete = true;
- s_info->positions_needed = 0;
+ s_info->positions_needed = (unsigned HOST_WIDE_INT) 0;
}
if (dump_file)
fprintf (dump_file, " trying spill store in insn=%d alias_set=%d\n",
(int)s_info->begin, (int)s_info->end);
for (i = offset; i < offset+width; i++)
if (i >= s_info->begin && i < s_info->end)
- s_info->positions_needed &= ~(1L << (i - s_info->begin));
+ s_info->positions_needed
+ &= ~(((unsigned HOST_WIDE_INT) 1) << (i - s_info->begin));
}
else if (s_info->rhs)
/* Need to see if it is possible for this store to overwrite
/* An insn can be deleted if every position of every one of
its s_infos is zero. */
- if (s_info->positions_needed != 0)
+ if (s_info->positions_needed != (unsigned HOST_WIDE_INT) 0)
delete = false;
if (delete)
ptr = next;
}
- gcc_assert ((unsigned) width < sizeof (store_info->positions_needed) * CHAR_BIT);
+ gcc_assert ((unsigned) width
+ <= sizeof (store_info->positions_needed) * CHAR_BIT);
/* Finish filling in the store_info. */
store_info->next = insn_info->store_rec;
store_info->alias_set = spill_alias_set;
store_info->mem_addr = get_addr (XEXP (mem, 0));
store_info->cse_base = base;
- store_info->positions_needed = (1L << width) - 1;
+ store_info->positions_needed = lowpart_bitmask (width);
store_info->group_id = group_id;
store_info->begin = offset;
store_info->end = offset + width;
&& (offset >= store_info->begin)
&& (offset + width <= store_info->end))
{
- int mask = ((1L << width) - 1) << (offset - store_info->begin);
-
+ unsigned HOST_WIDE_INT mask
+ = (lowpart_bitmask (width)
+ << (offset - store_info->begin));
+
if ((store_info->positions_needed & mask) == mask
&& replace_read (store_info, i_ptr,
read_info, insn_info, loc))
&& (offset >= store_info->begin)
&& (offset + width <= store_info->end))
{
- int mask = ((1L << width) - 1) << (offset - store_info->begin);
-
+ unsigned HOST_WIDE_INT mask
+ = (lowpart_bitmask (width)
+ << (offset - store_info->begin));
+
if ((store_info->positions_needed & mask) == mask
&& replace_read (store_info, i_ptr,
read_info, insn_info, loc))