This is the implementation of D149782
The patch implements a helper function that matches and fold the following cases in the DAGCombiner:
- bswap(logic_op(x, bswap(y))) -> logic_op(bswap(x), y)
- bswap(logic_op(bswap(x), y)) -> logic_op(x, bswap(y))
- bswap(logic_op(bswap(x), bswap(y))) -> logic_op(x, y) in multiuse case, which still reduces the number of instructions.
The helper function accepts SDValue with BSWAP and BITREVERSE opcode. This patch folds the BSWAP cases and remain the BITREVERSE optimization in the future
There is no opcode parameter. Maybe 'bswap or bitreverse nodes'?