4 ms·
Presumably you mean that false should be represented with 0 and true with ~0? And the motivation is maybe to be able to toggle boolean values with one instructi
by nsajko 7y ago
Presumably you mean that false should be represented with 0 and true with ~0? And the motivation is maybe to be able to toggle boolean values with one instruction?
Has there been any discussion on this matter on risc-v mailing lists or somewhere? If the RISC-V Base ISA is now ratified, I think it is too late to change such things.
Edit: seems to be too late. According to [0], SLTx instructions "set the destination register to one or zero depending on whether the relation is true or not."
[0] https://www.imperialviolet.org/2016/12/31/riscv.html https://www.imperialviolet.org/2016/12/31/riscv.html
- cesarb 7y ago> And the motivation is maybe to be able to toggle boolean values with one instruction? You can already do that: use XORI with immediate 1 to toggle.
- nsajko 7y agoFun fact: riscv does not even have a machine not instruction. In assembly it is just an alias for xori.
- Vogtinator 7y agoFun fact, neither does AArch64, it uses ORRN with xzr instead.
- ncmncm 7y agoYes, I was hasty. Boolean true should be ~0.
- brianpaul 7y agoConverting true=1 to true=~0 is trivial: negate the value, or subtract from zero.