3 ms·
A flags register is "threaded through the entirety of the program" just as much as all other registers. Though lui+add does have the benefit that the add should
by dzaima 3y ago
A flags register is "threaded through the entirety of the program" just as much as all other registers. Though lui+add does have the benefit that the add should write over the lui result, whereas cmp+branch needs to both update the flags & do the branch (but x86 cores should have no problem with that, as every single add & xor & and & inc & load & etc also write to flags already).
Flags for FP aren't particularly nice, but without them you just can't implement <fenv.h> which software may be expecting. (of course using a global flag for semantics isn't particularly nice either, but hey that's what's been standardized in C)