3 ms·
> I wonder if we'll see a similar instruction for 2 bits -> 2 bits? Could be useful! You don't even need to support all 16 functions, as a number are duplicate
by RaisingSpear 3y ago
> I wonder if we'll see a similar instruction for 2 bits -> 2 bits? Could be useful!
You don't even need to support all 16 functions, as a number are duplicates or could be implemented with others. The following list covers all possibilities:
- AND, OR, XOR [supported basically everywhere]
- AND-NOT (a&~b), OR-NOT (a|~b) [sometimes supported]
- NOT-AND (~(a&b)), NOT-OR (~(a|b)), NOT-XOR (aka XNOR)
So only a few basic instructions need to exist to support all combinations of 2-operand bitwise logic.
- adrian_b 3y agoThat is why the IBM POWER ISA includes only the 8 of the 16 functions of 2 Boolean variables that cannot be obtained from the others by reversing the operand order or by using for both operands the same register (which is enough to obtain the maximum instruction count reduction in comparison with the ISAs that only include AND/OR/XOR).
- bruce343434 3y agoLisp has all 16! https://news.ycombinator.com/item?id=32802308 https://news.ycombinator.com/item?id=32802308