https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117476

--- Comment #11 from Alexey Merzlyakov <alexey.merzlyakov at samsung dot com> 
---
Analysis shown that the problem seem is related to incorrect check in the
optimization, introduced by the aforementioned patch:

    (zero_extend:M (subreg:N (not:M (X:M)))) -> (xor:M (X:M, mask))

In this patch the condition

    (nonzero_bits (XEXP (XEXP (op, 0), 0), mode)
     & ~GET_MODE_MASK (mode)) == 0)

should verify that X:M doesn't have any non-zero bits outside of mode N.
However, it seems that the in the last part of this check I've made a mistake.
To verify the "outside mode N" part, we need to change

     & ~GET_MODE_MASK (mode)) == 0)

to the:

     & ~GET_MODE_MASK(GET_MODE (op))) == 0)

as "op" is in "N" mode, not in "mode" (M) itself.

If this turns out to be true, I will elaborate a patch to fix this issue in the
coming days.

Reply via email to