Is there a way to perform a bitwise NAND operation on the bits in two registers in ARM7, either with the existing AND, OR and EOR operations or other instructions?
Asked
Active
Viewed 3,697 times
2 Answers
8
and
then mvn
(move not).
From GCC explorer
int nand(int a, int b) {
return ~(a & b);
}
nand(int, int):
and r0, r0, r1
mvn r0, r0
bx lr

auselen
- 27,577
- 7
- 73
- 114
1
Sure; AND the two registers and then EOR the result with all 1's (for the negation).

Scott Hunter
- 48,888
- 12
- 60
- 101
-
1Note that `eor r0, #-1` is not encodeable; you'd need the all-ones constant in a register. That's what makes `mvn` a better choice. – Peter Cordes Nov 08 '20 at 02:59