serial, 8250: calculate irqflags bitmask before loop