Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.



That 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).





Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: