by wwwtyro · 2y ago · 0 comments
The easiest example is xor, which can trivially be interpreted as either xoring one large integer or xoring a vector of smaller integers.
Take a look at the SWAR example here [0] as a pretty common/easy example of that technique being good for something in the real world.
Dedicated hardware is almost always better, but you can still get major improvements with a little elbow grease.
If one value is 0, it is 0.
If the signs are different, it is -1.
If the signs are the same, it is 1.
I’m sure those can be done with relatively few instructions using far less power hungry hardware.