News for hackers. Stuff that matters.
Re:XOR'ing a register with itself is the idiom for zeroing i... by signa11 on Wednesday April 22, 2026 @04:07AM (#47860566)
indeed. riscv for instance. also, afaik, xor’ing is faster. i would assume that someone like mr. raymond would know…
Re:XOR'ing a register with itself is the idiom for zeroing i... by IshKebab on Wednesday April 22, 2026 @04:24AM (#47860676)
> afaik, xor’ing is faster

Even tiny tiny CPUs can do sub in one cycle, so I doubt that. On super-scalar CPUs xor and sub are normally issued to the same execution units so it wouldn't make a difference there either.

Re:XOR'ing a register with itself is the idiom for zeroing i... by tliltocatl on Wednesday April 22, 2026 @04:28AM (#47860701)
On superscalars running xor trick as is would be significantly slower because it implies a data dependency where there isn't one. But all OOO x86's optimize it away internally.
Re:XOR'ing a register with itself is the idiom for zeroing i... by IshKebab on Thursday April 23, 2026 @02:34AM (#47872791)
Sub has the same false data dependency.
Re:XOR'ing a register with itself is the idiom for zeroing i... by pif on Wednesday April 22, 2026 @04:29AM (#47860721)
Which part of "mathematical operations don’t reset the NaT bit" did you not understand?