[Patch,AVR]: Fix PR36467, PR49687 (better widening mul)

Georg-Johann Lay avr@gjlay.de
Mon Jul 18 16:37:00 GMT 2011


This patch improves 16=8*8 and 16*16*8 multiplication.

mulhi3 is extended to care for small, signed 9-bit constants
that can be handled more efficiently than loading the constants
and performing a 16-bit multiplication.

Some combine patterns are added to match if one operand is a small
constant which is then split in the remainder.

Cost computation adapted to the new patterns.

Test cases attached to the PRs compile to good code now.

Tested without regressions.

Ok to commit?

	PR target/36467
	PR target/49687
	* config/avr/avr.md (mulhi3): Use register_or_s9_operand for
	operand2 and expand appropriately if there is a CONST_INT in
	operand2.
	(usmulqihi3): New insn.
	(*sumulqihi3): New insn.
	(*osmulqihi3): New insn.
	(*oumulqihi3): New insn.
	(*muluqihi3.uconst): New insn_and_split.
	(*muluqihi3.sconst): New insn_and_split.
	(*mulsqihi3.sconst): New insn_and_split.
	(*mulsqihi3.uconst): New insn_and_split.
	(*mulsqihi3.oconst): New insn_and_split.
	(*ashifthi3.signx.const): New insn_and_split.
	(*ashifthi3.signx.const7): New insn_and_split.
	(*ashifthi3.zerox.const): New insn_and_split.
	(mulsqihi3): New insn.
	(muluqihi3): New insn.
	(muloqihi3): New insn.
	* config/avr/avr.c (avr_rtx_costs): Report costs of above insns.
	(avr_gate_split1): New function.
	* config/avr/avr-protos.h (avr_gate_split1): New prototype.
	* config/avr/predicates.md (const_2_to_7_operand): New.
	(const_2_to_6_operand): New.
	(u8_operand): New.
	(s8_operand): New.
	(o8_operand): New.
	(s9_operand): New.
	(register_or_s9_operand): New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opt-mul16-gate.diff
Type: text/x-patch
Size: 16761 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110718/c6221b79/attachment.bin>


More information about the Gcc-patches mailing list