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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3
          Component|rtl-optimization            |tree-optimization

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On the trunk, I believe the first invalid transformation is when we subst:
(insn 14 10 15 2 (parallel [
            (set (reg:HI 102)
                (and:HI (subreg:HI (reg:SI 98) 0)
                    (const_int 8191 [0x1fff])))
            (clobber (reg:CC 17 flags))
        ]) "pr82192-2.c":7 391 {*andhi_1}
     (expr_list:REG_DEAD (reg:SI 98)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
from (reg:SI 98) to
(lshiftrt:SI (subreg:SI (reg:DI 94 [ a ]) 0)
    (subreg:QI (reg:SI 97) 0))
we generate:
(parallel [
        (set (subreg:DI (reg:HI 102) 0)
            (zero_extract:DI (reg:DI 94 [ a ])
                (const_int 13 [0xd])
                (zero_extend:SI (subreg:QI (reg:SI 97) 0))))
        (clobber (reg:CC 17 flags))
    ])
which is not the same thing if (subreg:QI (reg:SI 97) 0) is ever bigger than 32
- 13 - such as for the case when at runtime it is 31.  For the original
lshiftrt + and, say if (reg:DI 94) is all ones, for shift count 31 we get 1,
while for the zero_extract 0x1fff, similarly for shift count 29 we get 7, while
for the zero_extract 0x1fff.  If we have a guarantee that the shift count is
smaller or equal than 32 - 13, then the expressions are equivalent.

Reply via email to