Newsgroups: comp.arch Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Bitfield instructions--a good idea? Message-ID: <1991Apr19.170337.18222@zoo.toronto.edu> Date: Fri, 19 Apr 1991 17:03:37 GMT References: <1991Apr15.193425.3436@waikato.ac.nz> <1991Apr18.093804.18183@odin.diku.dk> <1991Apr18.195841.10588@zoo.toronto.edu> <3357@crdos1.crd.ge.COM> Organization: U of Toronto Zoology In article <3357@crdos1.crd.ge.COM> davidsen@crdos1.crd.ge.com (bill davidsen) writes: > The problem comes when I want to go from words back to byte packing. >In this case a lookup doesn't help, and I have to fetch, shift, and or >the bits regardless of wether I do it with an instruction or a loop. I'm not quite sure what you mean by "go from words back to byte packing". If you're referring to the "unzip" instruction, transforming AaBbCcDd to ABCDabcd, note that you can do the shifts when generating tables. You look up AaBb in *two* tables, one giving you AB-- and one giving ab--, and look up CdDd in tables that give you --CD and --cd. You still get to OR them together yourself, however. How the tradeoffs go on this depends a lot on memory access speeds (and on whether your caches are big enough to contain your lookup tables!), and also on whether the operations being done are regular enough to lend themselves to table generation, but table lookup is always worth considering for messy bit operations. -- And the bean-counter replied, | Henry Spencer @ U of Toronto Zoology "beans are more important". | henry@zoo.toronto.edu utzoo!henry