improve stack-selection code in irq_{save, return}