roy rosen schrieb: > Thanks Georg, > The -fdump-rtl-combine-details really helps. > Regarding implementing it through cbranchhi4, this is not enough for > me because when getting to this pattern the operands have already been > expanded, and I am trying to prevent that. > Is there a way around it? > > Roy. > > 2010/10/25 Georg Lay <a...@gjlay.de>: >> roy rosen schrieb: >>> In my port I get to such a situation: >>> >>> (insn 60 59 61 4 a.c:65 (set (subreg:SI (reg:HI 129 [ __prephitmp_4 ]) 0) >>> (zero_extract:SI (subreg:SI (reg/v:DI 138 [ v4hi1 ]) 4) >>> (const_int 16 [0x10]) >>> (const_int 16 [0x10]))) 53 {extzv} (nil)) >>> >>> (insn 61 60 62 4 a.c:65 (set (reg:BI 159) >>> (gtu:BI (reg:HI 129 [ __prephitmp_4 ]) >>> (reg/v:HI 143 [ usiThresh ]))) 94 {cmprr_hi_gtu} (nil)) >>> >>> The patterns for these are: >>> >>> (define_insn "extzv" >>> [(set (match_operand:SI 0 "register_operand" "=d") >>> (zero_extract:SI (match_operand:SI 1 "register_operand" "d") >>> (match_operand:SI 2 "immediate_operand" "U06") >>> (match_operand:SI 3 "immediate_operand" "U06")))] >>> "" >>> "extractua\t %2, %3, %1, %0 %!" >>> ) >>> >>> and >>> >>> (define_insn "cmprr_hi_<code>" >>> [(set (match_operand:BI 0 "register_operand" "=c") >>> (any_cond_rr:BI (match_operand:HI 1 "register_operand" "d") >>> (match_operand:HI 2 "register_operand" "d")))] >>> "" >>> "cmp<code> %2.L, %1.L, %0:%I0 %!" >>> ) >>> >>> I want the combiner to combine both insns since I have an intruction >>> which can compare from an HI partial register. >>> I am trying to write an insn pattern for that but the combiner does not use >>> i. >>> I thought about something like: >>> >>> (define_insn "cmprr_hi_<code>_1" >>> [(set (match_operand:BI 0 "register_operand" "=c") >>> (any_cond_rr:BI (zero_extract:SI (match_operand:DI 1 >>> "register_operand" "d") >>> (const_int 16) (const_int 16)) >>> (match_operand:HI 2 "register_operand" "d")))] >>> "" >>> "cmp<code> %2.L, %1.L, %0:%I0 %!" >>> ) >>> >>> but it does not work. >>> Can someone please help? >> To compare HI there are standard insns "cstorehi4" and "cbranchhi4". Maybe >> you >> wand to implement an insn/expander that supports them. >> >> As far as the combiner is concerned: Look at combiner dumps with >> -fdump-rtl-combine-details if the combiner tries to combine these insns and >> the >> way it does this. It's useless to write patterns that combine will never >> try... >> >> Moreover, the first pattern looks rather like an "insv" than an extract. So >> it >> might help to write proper insv-expanders.
Hard to tell without seeing what combine tries and how insv expands. In some situations I get better results by expanding insv algebraically, i.e. as a combination of AND and IOR stuff. This is a little bit tedious but allows the output operand to be different from the insertion dest. Georg Lay