svn commit: r232721 - head/sys/x86/include

Bruce Evans brde at optusnet.com.au
Wed Mar 21 08:58:45 UTC 2012


On Wed, 21 Mar 2012, Tijl Coosemans wrote:

> On Tuesday 20 March 2012 19:56:14 John Baldwin wrote:
>> On Tuesday, March 20, 2012 10:19:07 am Tijl Coosemans wrote:
>...
>>> No, on i386 bswap64 with a variable argument currently expands to two
>>> bswap instructions. With your change it would be many shifts and logical
>>> operations. The _gen variants are more like fallback implementations.
>>> If bswapNN cannot be implemented directly it is split up. If those
>>> smaller problems can be implemented directly, good, if not split it up
>>> again and so on.
>>
>> Oh, I now parse the comment in __bswap64_var() correctly.  That's fugly.
>>
>> Still, it seems that if I keep the patch to port this to ia64 (so it
>> can do constants as constants), then it will need to use this approach
>> since it won't have the i386 problem (in its case the _gen variants
>> are only used for constants).
>
> Maybe name them _const then as on other architectures.

But we hoped to to use the "generic" version on all arches, with only
1 definition for it, and nothing MD except possibly the "var" version.

The "constant" version was renamed because it isn't limited to
constants.  I think it was changed to call the general version (above
the "generic" version) after that, since it would have made no sense for
the "constant" version to call a non-"constant" version.  The "generic"
version isn't really generic, since it only works for parameters without
side effects.  This is arranged by the "var" versions copying the parameters
to non-volatile variables and then applying either the "generic" version or
asm.

Bruce


More information about the svn-src-head mailing list