sparc: Fix lazy flag calculation on interrupts, refactor