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

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Previously we entered STV pass with:

(insn 32 31 33 4 (parallel [
            (set (reg:DI 118)
                (and:DI (reg:DI 88 [ _5 ])
                    (reg:DI 97 [ _24 ])))
            (clobber (reg:CC 17 flags))
        ]) pr78794-1.c:24 391 {*anddi3_doubleword}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))
(insn 33 32 34 4 (parallel [
            (set (reg:DI 119)
                (xor:DI (reg:DI 97 [ _24 ])
                    (reg:DI 118)))
            (clobber (reg:CC 17 flags))
        ]) pr78794-1.c:24 415 {*xordi3_doubleword}
     (expr_list:REG_DEAD (reg:DI 118)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

and the gain was calculated for two instructions.

After the mentioned revision, we enter STV pass with:

(note 32 31 33 4 NOTE_INSN_DELETED)
(insn 33 32 34 4 (parallel [
            (set (reg:DI 119)
                (and:DI (not:DI (reg:DI 88 [ _5 ]))
                    (reg:DI 97 [ _24 ])))
            (clobber (reg:CC 17 flags))
        ]) "pr78794.c":24 395 {*andndi3_doubleword}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

And the gain calculated is considerably lower, since we convert one insn only.

The patch in the mentioned revision is beneficial, but the cost for andn should
be adjusted, since one insn replaces:

        notl    %ebx
        andl    4(%esp), %ebx
        notl    %ecx
        andl    (%esp), %ecx

Yuri, can you please adjust the costs?

Reply via email to