public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/50256] AVR GCC - several unnecessary register moves
       [not found] <bug-50256-4@http.gcc.gnu.org/bugzilla/>
@ 2011-09-01  8:35 ` rguenth at gcc dot gnu.org
  2011-09-01 21:31 ` NickParker at Eaton dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-09-01  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011-09-01
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-01 08:35:16 UTC ---
GCC 4.3.x is no longer maintained, please try a newer version.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/50256] AVR GCC - several unnecessary register moves
       [not found] <bug-50256-4@http.gcc.gnu.org/bugzilla/>
  2011-09-01  8:35 ` [Bug target/50256] AVR GCC - several unnecessary register moves rguenth at gcc dot gnu.org
@ 2011-09-01 21:31 ` NickParker at Eaton dot com
  2011-09-03 12:35 ` gjl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-01 21:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from NickParker at Eaton dot com 2011-09-01 21:30:41 UTC ---
I have the latest AVR GCC release from 2010-01-10 (4.3.3) and this is what I am
using.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/50256] AVR GCC - several unnecessary register moves
       [not found] <bug-50256-4@http.gcc.gnu.org/bugzilla/>
  2011-09-01  8:35 ` [Bug target/50256] AVR GCC - several unnecessary register moves rguenth at gcc dot gnu.org
  2011-09-01 21:31 ` NickParker at Eaton dot com
@ 2011-09-03 12:35 ` gjl at gcc dot gnu.org
  2011-09-04 21:27 ` NickParker at Eaton dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-03 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|atmel avr                   |avr
                 CC|                            |gjl at gcc dot gnu.org

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-03 12:34:49 UTC ---
Supported versions of GCC are 4.4 upward at the moment. 

Your C-code does not show a call to MulU3U3S3 and the constants 167772 resp.
100000 occur nowhere. Please follow http://gcc.gnu.org/bugs/#need when
reporting bugs. Thanks.

Notice that early clobber forces moves. Moreover, some value is passed in r20
but you clobber that register so that register must be freed i.e. that forces a
move, too. Maybe you want your function static inline. Also notice that if you
have MUL, you always have MOVW. You don't need to save/restore __tmp_reg__. You
don't need to save __zero_reg__. It is sufficient to CLR __zero_reg__ after you
are done.

Last not least, you arithmetic apprears to be wrong because you add at most 3
bytes and lose the carries above.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/50256] AVR GCC - several unnecessary register moves
       [not found] <bug-50256-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-09-03 12:35 ` gjl at gcc dot gnu.org
@ 2011-09-04 21:27 ` NickParker at Eaton dot com
  2011-09-04 21:29 ` NickParker at Eaton dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-04 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from NickParker at Eaton dot com 2011-09-04 21:27:43 UTC ---
Hi,

Thanks for your input and sorry to make a mess of reporting this.
The arithmetic is fine and the code gives the results I expect.
However, I have since discovered and corrected a 'bug'.  
I was not initialising my 'temporary result registers i.e. r2,r3,r4,r5,r6,r7.

Regarding the arithmetic, the result is INTENTIONALLY accumulated from the
lowest partial products to highest partial products so that at most only 3
additions are ever needed per partial product.


Thanks, Nick


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/50256] AVR GCC - several unnecessary register moves
       [not found] <bug-50256-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-09-04 21:27 ` NickParker at Eaton dot com
@ 2011-09-04 21:29 ` NickParker at Eaton dot com
  2011-09-04 22:20 ` gjl at gcc dot gnu.org
  2012-09-15  9:30 ` gjl at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: NickParker at Eaton dot com @ 2011-09-04 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from NickParker at Eaton dot com 2011-09-04 21:29:40 UTC ---
Thanks, also was able to add a few movws to save cycles.
Nick.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/50256] AVR GCC - several unnecessary register moves
       [not found] <bug-50256-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-09-04 21:29 ` NickParker at Eaton dot com
@ 2011-09-04 22:20 ` gjl at gcc dot gnu.org
  2012-09-15  9:30 ` gjl at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-04 22:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-04 22:19:53 UTC ---
You don't need R20: Simply use %D0 which is cleared, anyway. As %0 is early
clobber, it's not an input and you can clear is at the beginning.

You don't need to clear R4/R5 (similar R6/R7): Just rearrange multiplications
and use (note R6 is (implicitely) 0 at that time)
   mul %A1,%C2
   movw r4,r0
instead of
   mul %A1,%C2
   add r4,r0
   adc r5,r1

You don't need to move to answer by hand; just use %A0 instead of R5 etc. and
you save moves and register footprint (notice that this interferes with
previous hint because you change registers even/odd; it's up to you to work it
out and find smartest way of your assembler).

Finally, you could let the compiler allocate temporary registers for you, i.e.
a 16-bit instead of R2/R3 etc. The compiler knows better which registers are
best and will try to use call-clobbered registers instead of expensive
call-used ones.

All in all, you will get a much greater performance gain by tweaking you code
than the compiler could ever do by saving some poor register moves ;-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/50256] AVR GCC - several unnecessary register moves
       [not found] <bug-50256-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2011-09-04 22:20 ` gjl at gcc dot gnu.org
@ 2012-09-15  9:30 ` gjl at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-09-15  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
   Last reconfirmed|2011-09-01 00:00:00         |
         Resolution|                            |INVALID

--- Comment #7 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2012-09-15 09:29:46 UTC ---
Closed.

There is still no test case for over one year now.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-15  9:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-50256-4@http.gcc.gnu.org/bugzilla/>
2011-09-01  8:35 ` [Bug target/50256] AVR GCC - several unnecessary register moves rguenth at gcc dot gnu.org
2011-09-01 21:31 ` NickParker at Eaton dot com
2011-09-03 12:35 ` gjl at gcc dot gnu.org
2011-09-04 21:27 ` NickParker at Eaton dot com
2011-09-04 21:29 ` NickParker at Eaton dot com
2011-09-04 22:20 ` gjl at gcc dot gnu.org
2012-09-15  9:30 ` gjl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).