
11 Aug
2008
11 Aug
'08
2:12 p.m.
Dear Guennadi,
In message Pine.LNX.4.64.0808111238420.30591@axis700.grange you wrote:
Ok, would this be better
u32 reg; u32 pclk = get_PCLK(); u32 baudrate = gd->baudrate; int i;
reg = pclk / baudrate / 16 - 1; i = (pclk / baudrate) % 16;
Is "reg" still used anywhere else?
This way the compiler does optimize it to only one division, and the operations say what they do, and there doesn't seem to be any need for comment left. Still, the code produced by this is 1 asm instruction longer than my original code:-)
Is the generated code equivalent? This smells like a subtle bug...
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
The games have always strengthened us. Death becomes a familiar
pattern. We don't fear it as you do.
-- Proconsul Marcus Claudius, "Bread and Circuses",
stardate 4041.2