This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question about pattern combining


Hello,

Regarding the pattern:

(insn 36 35 38 0 (set (reg:DI 127)
        (sign_extend:DI (reg:SI 130))) 15 {*rs6000.md:441} (insn_list 35 
(nil))
    (expr_list:REG_DEAD (reg:SI 130)
        (nil)))

(insn 38 36 39 0 (set (reg:SI 131)
        (plus:SI (subreg:SI (reg:DI 125) 4)
            (subreg:SI (reg:DI 127) 4))) 36 {*addsi3_internal1} (insn_list 
33
                                                        (insn_list 36 
(nil)))
    (expr_list:REG_DEAD (reg:DI 125)
        (expr_list:REG_DEAD (reg:DI 127)
            (nil))))

Combine should modify insn 38 to be:

(insn 38 36 39 0 (set (reg:SI 131)
        (plus:SI (subreg:SI (reg:DI 125) 4)
            (reg:SI 130))) 36 {*addsi3_internal1} (insn_list 33
                                                (insn_list 35 (nil)))
    (expr_list:REG_DEAD (reg:DI 125)
        (expr_list:REG_DEAD (reg:SI 130)
            (nil))))

and insn 36 should be removed.

Currently this does not happen. The reason is that during combine the
(reg:DI 127) in insn 38 is replaced with the rhs of insn 36 using subst, 
but
subst simplifies the sign-extension to ASHIFTRT ( ASHIFT ()) and then the
pattern is not recognized.

By disabling the algebraic simplification of sign extension inside
combine_simplify_rtx (removing the call to expand_compound_operation()),
combine succeeded to recognize the above pattern and works properly.
There is, of course, a tradeoff. This may disable other patterns from been
combined.

Does anyone has a better solution for the problem.


Thanks,
   Leehod


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]