def fmt_swapflags(regno):
    cpu = SIM_current_processor()
    swapflags = SIM_read_register(cpu, regno)
    s = "%d" % (swapflags & 0x7fff)
    if swapflags & 0x8000:
        s += "|PREFER"
    return s