This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] PR 32283


> -- changes to loop-iv.c and simplify-rtx.c to enable us to determine
>    that ((x << 2) - 4) & 3 == 0.

The change to simplify-rtx.c makes sense, but you should not need it
unless, of course, you know that the entire expression is never passed
to simplify-rtx.c:

- x << 2 has ~3 for its nonzero_bits

- 4 has 4 for its nonzero_bits

- (x << 2) - 4 has (see around rtlanal.c:3834)
        width0 = 32
        width1 = 2
        low0 = 2
        low1 = 2
        op0_maybe_minusp = 1
        op1_maybe_minusp = 0
        result_width = 32
        result_low = 4
        nonzero = ~3

- and then

      /* If we are turning off bits already known off in OP0, we need
         not do an AND.  */
      if (GET_CODE (trueop1) == CONST_INT
          && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
          && (nonzero_bits (trueop0, mode) & ~INTVAL (trueop1)) == 0)
        return op0;

Unless, again, you know that the entire expression is never passed to
simplify-rtx.c, can you check why this does not happen?

Thanks,

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]