aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2011-10-10 09:57:02 +0000
committerGeorg-Johann Lay <gjl@gcc.gnu.org>2011-10-10 09:57:02 +0000
commitbeddf669bb9117e6425aae6908e8d339aec37ffd (patch)
treef8acd0af0cc2a488df61df97489565ee3f495ca1
parente12693c1edf12b1e92d17313b4a83038ba4f8aa5 (diff)
downloadgcc-beddf669bb9117e6425aae6908e8d339aec37ffd.zip
gcc-beddf669bb9117e6425aae6908e8d339aec37ffd.tar.gz
gcc-beddf669bb9117e6425aae6908e8d339aec37ffd.tar.bz2
avr.md (*mulhi3_enh): Treat squaring smarter.
* config/avr/avr.md (*mulhi3_enh): Treat squaring smarter. From-SVN: r179739
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/avr/avr.md12
2 files changed, 9 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7e7d6b2..6dc2963 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2011-10-10 Georg-Johann Lay <avr@gjlay.de>
+ * config/avr/avr.md (*mulhi3_enh): Treat squaring smarter.
+
+2011-10-10 Georg-Johann Lay <avr@gjlay.de>
+
PR target/50652
* config/avr/avr-mcus.def (AVR_MCU): Set .data_section_start of
atmega164a to 0x100.
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index f1ac95d..e17f7f2 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -1560,13 +1560,11 @@
(mult:HI (match_operand:HI 1 "register_operand" "r")
(match_operand:HI 2 "register_operand" "r")))]
"AVR_HAVE_MUL"
- "mul %A1,%A2
- movw %0,r0
- mul %A1,%B2
- add %B0,r0
- mul %B1,%A2
- add %B0,r0
- clr r1"
+ {
+ return REGNO (operands[1]) == REGNO (operands[2])
+ ? "mul %A1,%A1\;movw %0,r0\;mul %A1,%B1\;add %B0,r0\;add %B0,r0\;clr r1"
+ : "mul %A1,%A2\;movw %0,r0\;mul %A1,%B2\;add %B0,r0\;mul %B1,%A2\;add %B0,r0\;clr r1";
+ }
[(set_attr "length" "7")
(set_attr "cc" "clobber")])