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

Guennadi Liakhovetski lg at denx.de
Mon Aug 11 14:43:28 CEST 2008


On Mon, 11 Aug 2008, Wolfgang Denk wrote:

> 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?

No, I'll remove it.

> > 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...

Don't see a bug there, both look correct. The C-code is different too - 
one uses "%", another one multiplication and subtraction, don't think it 
should be alarming that the resulting asm-code is different too.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de



More information about the U-Boot mailing list