Richard Henderson wrote:
> On 07/18/2011 08:41 AM, Georg-Johann Lay wrote:
>> +(define_insn_and_split "*muluqihi3.uconst"
>> +  [(set (match_operand:HI 0 "register_operand"                         "=r")
>> +        (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" 
>> "r"))
>> +                 (match_operand:HI 2 "u8_operand"                       
>> "M")))]
>> +  "AVR_HAVE_MUL
>> +   && avr_gate_split1()"
>> +  { gcc_unreachable(); }
>> +  "&& 1"
>> +  [(set (match_dup 3)
>> +        (match_dup 2))
>> +   ; umulqihi3
>> +   (set (match_dup 0)
>> +        (mult:HI (zero_extend:HI (match_dup 1))
>> +                 (zero_extend:HI (match_dup 3))))]
>> +  {
>> +    operands[2] = gen_int_mode (INTVAL (operands[2]), QImode);
>> +    operands[3] = gen_reg_rtx (QImode);
>> +  })
>> +
> 
> I'm not keen on this at all.  I'd much prefer a formulation like
> 
> (define_insn_and_split "*muliqihi3_uconst"
>   [(set (match_operand:HI 0 "register_operand" "=r")
>       (mult:HI (zero_extend:HI
>                 (match_operand:QI 1 "register_operand" "r"))
>                (match_operand:HI 2 "u8_operand" "n")))
>    (clobber (match_scratch:QI 3 "=&r"))]
>   "AVR_HAVE_MUL"
>   "#"
>   "&& reload_completed"
>   [...]
> )
> 
> I see the obvious problem, of course, pass_split_after_reload
> runs after pass_postreload_cse.

I intend to do similar things for HI->SI widening multiply.
These multiplications are too complex to do them inline and
thus are expanded to libgcc calls like so:

(define_expand "umulhisi3"
  [(set (reg:HI 18)
        (match_operand:HI 1 "register_operand" ""))
   (set (reg:HI 20)
        (match_operand:HI 2 "register_operand" ""))
   (set (reg:SI 22)
        (mult:SI (zero_extend:SI (reg:HI 18))
                 (zero_extend:SI (reg:HI 20))))
   (set (match_operand:SI 0 "register_operand" "")
        (reg:SI 22))]
  "AVR_HAVE_MUL"
  "")

This is no more possible after reload, so for these cases
there is no alternative to doing it a pre-reload split.
Or am I something missing?

Johann

Reply via email to