[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Shift by multiple of 8 is really shifting...

From: Ben Jackson
Subject: [avr-gcc-list] Shift by multiple of 8 is really shifting...
Date: Fri, 29 Jul 2005 01:51:03 -0700
User-agent: Mutt/1.5.6i

Here I'm doing something like

                l = ((ulong)i << 16) + ...;

It's actually loading the i, expanding it, then shifting it.  Once
again I'm sure I've seen gcc do better (on i386 or PPC, not sure).
If it's not useful for me to point out these problems as I run
across them, feel free to tell me to shut up.  :-)  Better yet,
give me an idea of where in gcc I should fix this (clearly it could
be fixed with a peephole rule of some kind, but I bet it's also
possible to just generate better code).

BTW, this is not purely academic for me, I'm working on a LC meter
that greatly benefits from the float math etc and I've managed to
get the float-using version down from 2046 to 1662, which is going
to leave space to finish the code.  This asm got generated when I
started tracking timer0/1 overflows and adding them in, scaled, at
the end.  It's still a win, but it'd be even better if both copies
of this saved 4 more instructions!

b2:   20 91 6a 00     lds     r18, 0x006A
b6:   30 91 6b 00     lds     r19, 0x006B
ba:   44 27           eor     r20, r20
bc:   55 27           eor     r21, r21
be:   53 2f           mov     r21, r19
c0:   42 2f           mov     r20, r18
c2:   33 27           eor     r19, r19
c4:   22 27           eor     r18, r18

Ben Jackson

reply via email to

[Prev in Thread] Current Thread [Next in Thread]