On Tue, Jan 09, 2024 at 10:39:50AM +0100, Richard Biener wrote: > > x86 can't combine IOR/XOR in any meaningful way, but can combine the > > sequence of PLUS (together with MULT) RTXes to LEA. > > Btw, this looks like a three-insn combination even with IOR so a > pattern for this case would work as well? > > Deciding whether to use PLUS or IOR at RTL expansion time would > need to somehow figure out what's better for the target in question. > I'm not sure how to do that?
Maybe a new optab which would be used when expanding BIT_IOR_EXPR/BIT_XOR_EXPR with operands which have no common bits (say in (get_nonzero_bits (arg1) & get_nonzero_bits (arg2)) == 0 sense)? x86 and riscv could just emit a PLUS in those cases... Jakub