On 07/09/11 16:43, Andrew Stubbs wrote:
>> So, what I've done in the end is add a new pointer entry "widening" into
>> optab_d, and dynamically build the widening operations table for each
>> optab that needs it. I've then added new accessor functions that take
>> both input and output modes, and altered the code to use them where
>> appropriate.
I think this is a reasonable approach given the way our code is structured.
> @@ -1242,7 +1242,8 @@ expand_binop_directly (enum machine_mode mode, optab
> binoptab,
> rtx target, int unsignedp, enum optab_methods methods,
> rtx last)
> {
> - enum insn_code icode = optab_handler (binoptab, mode);
> + enum machine_mode from_mode = GET_MODE (op0);
> + enum insn_code icode = widening_optab_handler (binoptab, mode, from_mode);
Please add a new function along the lines of
enum machine_mode
widened_mode (enum machine_mode to_mode, rtx op0, rtx op1)
{
if (GET_MODE (op1) == VOIDmode)
return GET_MODE (op0);
gcc_assert (GET_MODE (op0) == GET_MODE (op1);
return GET_MODE (op0);
}
I'll want to extend this at some point to allow widening multiplies
where only one operand is widened (with a new set of optabs).
> - if (optab_handler (binoptab, wider_mode) != CODE_FOR_nothing
> + if (optab_handler (binoptab, wider_mode)
> + != CODE_FOR_nothing
Spurious formatting change.
Otherwise ok.
Bernd