[U-Boot] [PATCH 5/7 v6] serial: add S3C64XX serial driver

Wolfgang Denk wd at denx.de
Mon Aug 11 14:12:37 CEST 2008


Dear Guennadi,

In message <Pine.LNX.4.64.0808111238420.30591 at 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 at 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



More information about the U-Boot mailing list