This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH,TARGET]PR23726 Optimize divmod for AVR target
- From: Andrew Hutchinson <andrewhutchinson at cox dot net>
- To: gcc-patches at gcc dot gnu dot org, Denis Chertykov <chertykov at gmail dot com>, Anatoly Sokolov <aesok at post dot ru>
- Cc: "Weddington, Eric" <Eric dot Weddington at atmel dot com>
- Date: Thu, 10 Dec 2009 20:33:55 -0500
- Subject: [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