[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] New EU_SHL Instruction



On Thu, Jan 09, 2003 at 01:59:35AM +0100, Yann Guidon wrote:
[...]
> and_reduce (or "combine" as written in ROP2) is not possible
> for very wide data.
> 
> Furthermore, the xorn.and trick is useful for "detecting" that a byte
> corresponds, but if you need to find the index of the character,
> the "obvious" answer is to loop over the register.
> if you have a result of 0x00FF000000000000, it's not a good solution.
> So the idea is to "transpose" the bits in the word, that would become
> 0x4040404040404040 and the last byte can then ben binary encoded
> in INC (if it's implemented).

Wouldn't it be sufficient to `collapse' each chunk into a single bit?
That is, if the chunk's value is not zero, the corresponding bit will
be set, otherwise it will be zero:

	r2 = 0xab00cd00ef0000
	collapse.b r2, r1
	r1 <= 0x54
	collapse.d r2, r1
	r1 <= 0x0e

and so on. A complementary `uncollapse' instruction would be nice,
too (it would allow you to generate chunk masks more easily):

	r2 = 0x5a
	uncollapse.b r2, r1
	r1 <= 0x00ff00ffff00ff00
	uncollapse.d r2, r1
	r1 <= 0x0000ffff0000ffffffff0000ffff0000	// yes, that's 128 bits ;)

-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/