arch_x86: use flags as bit instead of manipulating Xflags, core: add ternary IR