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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization

--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
The costing code is expecting

(parallel [
        (set (reg:SI 124 [ _7 ])
            (ne:SI (reg:SI 122 [ _2 ])
                (const_int 0 [0])))
        (clobber (reg:CC 100 cc))
    ])


To result in the assembler output

SUBS r124, R122, #1
SBC  r124, R122, r124

so really should have a cost of 8 (two insns).  But for some reason the thumb2
back-end is not generating that output in this case.  Overall, that means that
for bic_si_test

BIC r0, r0, r1
SUBS r1, r0, #1
SBC r0, r0, r1

is neither better nor worse than

BICS r0, r0, r1
IT ne
MOVNE r0, #1

and certainly better than

BICS r0, r0, r1
ITE ne
MOVNE r2, #1
MOVEQ r2, #0

at least when it comes to code size.

So the test is somewhat flaky, but there is a further problem with the compiler
not generating the expected sequence for NE(reg, 0) in Thumb2.

Reply via email to