This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] combine.c: Remove unnecessary AND when storing intozero_extract.
Hi Richard,
> In fact, any mask where the inserted bits are a subset of the mask. So in
> the above case that would be 1, 3, 5, 7, 9, 11...
>
> Or in general,
> and_mask & ((1 << field_width) - 1) == ((1 << field_width) - 1)
IMHO, such a wide mask won't happen. Here is a comment taken from
make_field_assignment.
/* The other case we handle is assignments into a constant-position
field. They look like (ior/xor (and DEST C1) OTHER). If C1 represents
a mask that has all one bits except for a group of zero bits and
OTHER is known to have zeros where C1 has ones, this is such an
assignment. Compute the position and length from C1. Shift OTHER
to the appropriate position, force it to the required mode, and
make the extraction. Check for the AND in both operands. */
So the nonzero bits of C1 and OTHER really have to be disjoint before
make_field_assignment() can make a field assignment. Suppose OTHER is
of the form (and:m (VAROP) (CONSTANT_MASK)) with CONSTANT_MASK wider
than the field that we are trying to assign. Since the AND is against
CONSTANT_MASK, simplify_and_const_int() should be called by the time
we get to make_filed_assignment(). After calling
simplify_and_const_int(), all the bits that are known to be zero in
VAROP are turned off in CONSTANT_MASK. In other words, CONSTANT_MASK
indicates all the bits that are potentially 1. Then we cannot meet
the condition that the nonzero bits of C1 and OTHER have to be
disjoint, so we cannot make a field assignment in the first place.
Kazu Hirata