This is the mail archive of the gcc-patches@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]

[PATCH,TARGET]PR23726 Optimize divmod for AVR target


This AVR target patch was originally posted by Bjoern Haase in 2007 against 4.1 but never approved and the problem remains.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23726

The patch allows optimizers to eliminate redundant call to divmod when both quotient and remainder are required. For example, the following will currently require 2 divmod operations.

   x = y%n;
   y = y/n;

The patch changes AVR divmod expand patterns to define_insn_and_split simplifying use of hard register into parallel clobber.

I have retested this patch on 4.5 head and it works just fine. There are no regressions on gcc testsuite for AVR.


Ok for 4.5?



2009-12-10 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>


PR target/23726
* config/avr/predicates.md (pseudo_register_operand): Add new predicate for pseudos.
* config/avr/avr.md (divmodqi4): Replace with define_insn_and_split to allow div/mod optimization.
(udivmodqi4): Ditto.
(divmodhi4): Ditto.
(udivmodhi4): Ditto.
(divmodsi4): Ditto.
(udivmodsi4): Ditto.





Attachment: bh2005.patch
Description: Text document


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