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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
make_compound_operation_int incorrectly turns
(ashiftrt:SI (ashift:SI (mult:SI (reg:SI 107 [ a_5 ])
            (const_int 3 [0x3]))
        (const_int 31 [0x1f]))
    (const_int 31 [0x1f]))
into
(mult:SI (sign_extract:SI (reg:SI 107 [ a_5 ])
        (const_int 2 [0x2])
        (const_int 0 [0]))
    (const_int 3 [0x3]))
Result of the original is -1 or 0, while the result of the latter is -3 or 0
(and testing a different bit than it should).
Given multiplication by 3 which is 2 * a_5 + a_5 where former is even and the
latter maybe odd, it is actually equivalent to just (sign_extract:SI (reg:SI
107 [ a_5 ]) (const_int 1 [0x1]) (const_int 0 [0])).

Reply via email to