This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/59174] [avr] Suboptimal multiplication when indexing an array
- From: "gjl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 02 Dec 2013 14:52:45 +0000
- Subject: [Bug target/59174] [avr] Suboptimal multiplication when indexing an array
- Auto-submitted: auto-generated
- References: <bug-59174-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59174
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |avr
Priority|P3 |P4
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-12-02
CC| |gjl at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Confirmed with the trunk.
This is an issue of cost computation in the avr backend.
If you compile with -O2 -mmcu=atmega2560 -mlog=rtx_costs you will see
avr_rtx_costs[test:combine(206)]=true (speed) total=36, outer=set:
(mult:HI (reg:HI 47 [ D.1460 ])
(const_int 10 [0xa]))
...
avr_rtx_costs[test:combine(206)]=true (speed) total=32, outer=set:
(plus:HI (ashift:HI (reg:HI 47 [ D.1460 ])
(const_int 3 [0x3]))
(ashift:HI (reg:HI 47 [ D.1460 ])
(const_int 1 [0x1])))
thus the MULT variant is taken as more costly that the ASHIFT + PLUS version.