svn commit: r187251 - head/sys/mips/malta

Stanislav Sedov stas at FreeBSD.org
Fri Jan 16 00:21:47 PST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 15 Jan 2009 17:55:00 -0700 (MST)
"M. Warner Losh" <imp at bsdimp.com> mentioned:

> In message: <496FC32F.3040104 at FreeBSD.org>
>             Maxim Sobolev <sobomax at FreeBSD.org> writes:
> : Christoph Mallon wrote:
> : > Alexey Dokuchaev schrieb:
> : >> On Wed, Jan 14, 2009 at 07:05:27PM -0700, M. Warner Losh wrote:
> : >>> In message: <20090115020752.52566769.stas at FreeBSD.org>
> : >>>             Stanislav Sedov <stas at FreeBSD.org> writes:
> : >>> : > +        shift = 8 * (reg & 3);
> : >>> : >  : : Would it make sense to replace this with
> : >>> : > +        shift = (reg & 3) << 3;
> : >>> : : to not rely on possible compiler optimizations?
> : >>>
> : >>> I don't think that it matters all that much these days...
> : >>
> : >> But the name "shift" kinda suggests << instead of *, no?
> : > 
> : > The value *is* a shift amount (see its uses a few lines down). Its name 
> : > does not imply the way it is calculated, but what it is used for.
> : > 
> : > BTW: Even the most cheap compilers emit shift instructions for 
> : > multiplication by a power of two. The new code also is clearly faster 
> : > then the old - quite some code gets generated for switches.
> : 
> : I believe Warner's point is that the code is not in the hot path, so 
> : that it should not really matter either way.
> 
> The code is clear the way it is, there's little reason to
> hyper-optimize this path in the face of bogus compiler optimizations
> or not, and the effort to optimize the hot-path should be aided by
> dtrace or kernel profiling rather than reading the code.
> 

Heh, that was just a suggestion, as the author decided to optimize the
code anyway.:-) Of course, this optimization doesn't matter here much.

- -- 
Stanislav Sedov
ST4096-RIPE
-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAklwQ5cACgkQK/VZk+smlYH9xQCffKoCymcGgyBUKBT2HHi4jLiM
L3IAn2QNrh3FsdQGMdD1H6rKMmc7YhzE
=qfKk
-----END PGP SIGNATURE-----

!DSPAM:49704399967005350815758!




More information about the svn-src-all mailing list